source: rtems-tools/specbuilder/specbuilder/linux.py @ a86cd82

4.104.115
Last change on this file since a86cd82 was a86cd82, checked in by Chris Johns <chrisj@…>, on 06/09/11 at 05:59:32

2011-06-09 Chris Johns <chrisj@…>

  • specbuilder/specbuilder/build.py, specbuilder/specbuilder/crossgcc.py, specbuilder/specbuilder/defaults.py, specbuilder/specbuilder/linux.py, specbuilder/specbuilder/spec.py: Add CentOS support for older Pythons. Add options to build the tools with specific flags.
  • Property mode set to 100644
File size: 2.2 KB
RevLine 
[31d4e80]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    smp_mflags = ''
37    processors = '/bin/grep processor /proc/cpuinfo'
38    e = execute.capture_execution()
39    exit_code, proc, output = e.shell(processors)
40    if exit_code == 0:
41        cpus = 0
42        for l in output.split('\n'):
43            count = l.split(':')[1].strip()
44            if count > cpus:
[a86cd82]45                cpus = int(count)
[31d4e80]46        if cpus > 0:
47            smp_mflags = '-j%d' % (cpus)
48    defines = {
49        '_os':                     'linux',
50        '_host':                   uname[4] + '-linux-gnu',
51        '_host_vendor':            'gnu',
52        '_host_os':                'linux',
53        '_host_cpu':               uname[4],
54        '_host_alias':             '%{nil}',
55        '_host_arch':              uname[4],
56        '_usr':                    '/usr',
57        '_var':                    '/usr/var',
58        'optflags':                '-O2 -fasynchronous-unwind-tables',
59        '_smp_mflags':             smp_mflags,
[a86cd82]60        '__bzip2':                 '/usr/bin/bzip2',
[31d4e80]61        '__gzip':                  '/bin/gzip',
62        '__tar':                   '/bin/tar'
63        }
64    return defines
65
66if __name__ == '__main__':
67    pprint.pprint(load())
Note: See TracBrowser for help on using the repository browser.