source: rtems-tools/specbuilder/specbuilder/freebsd.py @ a2bc901

4.104.115
Last change on this file since a2bc901 was a2bc901, checked in by Chris Johns <chrisj@…>, on 12/05/11 at 11:32:44

Add FreeBSD support.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#
2# $Id$
3#
4# RTEMS Tools Project (http://www.rtems.org/)
5# Copyright 2010 Chris Johns (chrisj@rtems.org)
6# All rights reserved.
7#
8# This file is part of the RTEMS Tools package in 'rtems-tools'.
9#
10# RTEMS Tools is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# RTEMS Tools is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with RTEMS Tools.  If not, see <http://www.gnu.org/licenses/>.
22#
23
24#
25# This code is based on what ever doco about spec files I could find and
26# RTEMS project's spec files.
27#
28
29import pprint
30import os
31
32import execute
33
34def load():
35    uname = os.uname()
36    sysctl = '/sbin/sysctl '
37    e = execute.capture_execution()
38    exit_code, proc, output = e.shell(sysctl + 'hw.ncpu')
39    if exit_code == 0:
40        smp_mflags = '-j' + output.split(' ')[1].strip()
41    else:
42        smp_mflags = ''
43    if uname[4] == 'amd64':
44        cpu = 'x86_64'
45    else:
46        cpu = uname[4]
47    version = uname[2]
48    if version.find('-') > 0:
49        version = version.split('-')[0]
50    defines = {
51        '_os':                     'freebsd',
52        '_host':                   cpu + '-freebsd' + uname[2],
53        '_host_vendor':            'freebsd',
54        '_host_os':                'freebsd',
55        '_host_cpu':               cpu,
56        '_host_alias':             '%{nil}',
57        '_host_arch':              cpu,
58        '_usr':                    '/usr/local',
59        '_var':                    '/usr/local/var',
60        'optflags':                '-O2 -fasynchronous-unwind-tables',
61        '_smp_mflags':             smp_mflags,
62        '__xz':                    '/usr/bin/xz',
63        }
64    return defines
65
66if __name__ == '__main__':
67    pprint.pprint(load())
Note: See TracBrowser for help on using the repository browser.