source: rtems-source-builder/source-builder/sb/freebsd.py @ c80560d

4.104.114.95
Last change on this file since c80560d was c80560d, checked in by Chris Johns <chrisj@…>, on 11/05/12 at 23:09:40

Move into the source-builder tree.

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