source: rtems-tools/specbuilder/specbuilder/freebsd.py @ 68c9b8a

4.104.115
Last change on this file since 68c9b8a was 68c9b8a, checked in by Chris Johns <chrisj@…>, on 08/04/12 at 12:29:24

Remove CVS Id and update the copyright year.

  • Property mode set to 100644
File size: 2.1 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':                     'freebsd',
50        '_host':                   cpu + '-freebsd' + version,
51        '_host_vendor':            'pc',
52        '_host_os':                'freebsd',
53        '_host_cpu':               cpu,
54        '_host_alias':             '%{nil}',
55        '_host_arch':              cpu,
56        '_usr':                    '/usr/local',
57        '_var':                    '/usr/local/var',
58        'optflags':                '-O2 -I/usr/local/include -L/usr/local/lib',
59        '_smp_mflags':             smp_mflags,
60        '__xz':                    '/usr/bin/xz',
61        '__make':                  'gmake',
62        }
63    return defines
64
65if __name__ == '__main__':
66    pprint.pprint(load())
Note: See TracBrowser for help on using the repository browser.