source: rtems-tools/rtemstoolkit/solaris.py @ 1676b9c

4.105
Last change on this file since 1676b9c was b0fa2ae, checked in by Chris Johns <chrisj@…>, on 03/03/16 at 05:46:18

Update rtems-tool to support Python 2 and 3.

Add solaris and netbsd.

Close #2619.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2016 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# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20#
21# This code is based on what ever doco about spec files I could find and
22# RTEMS project's spec files.
23#
24
25import pprint
26import os
27
28try:
29    from . import check
30    from . import error
31    from . import execute
32except (ValueError, SystemError):
33    import check
34    import error
35    import execute
36
37def load():
38    uname = os.uname()
39    psrinfo = '/sbin/psrinfo|wc -l'
40    e = execute.capture_execution()
41    exit_code, proc, output = e.shell(psrinfo)
42    if exit_code == 0:
43        ncpus = output
44    else:
45        ncpus = '1'
46    if uname[4] == 'i86pc':
47        cpu = 'i386'
48    else:
49        cpu = uname[4]
50    version = uname[2]
51    if version.find('-') > 0:
52        version = version.split('-')[0]
53    defines = {
54        '_ncpus':           ('none',    'none',     ncpus),
55        '_os':              ('none',    'none',     'solaris'),
56        '_host':            ('triplet', 'required', cpu + '-pc-solaris2'),
57        '_host_vendor':     ('none',    'none',     'pc'),
58        '_host_os':         ('none',    'none',     'solaris'),
59        '_host_os_version': ('none',    'none',     version),
60        '_host_cpu':        ('none',    'none',     cpu),
61        '_host_alias':      ('none',    'none',     '%{nil}'),
62        '_host_arch':       ('none',    'none',     cpu),
63        '_usr':             ('dir',     'required', '/usr'),
64        '_var':             ('dir',     'optional', '/var'),
65        '__bash':           ('exe',     'optional', '/usr/bin/bash'),
66        '__bison':          ('exe',     'required', '/usr/bin/bison'),
67        '__git':            ('exe',     'required', '/usr/bin/git'),
68        '__svn':            ('exe',     'required', '/usr/bin/svn'),
69        '__cvs':            ('exe',     'required', '/usr/bin/cvs'),
70        '__xz':             ('exe',     'optional', '/usr/bin/xz'),
71        '__make':           ('exe',     'required', 'gmake'),
72        '__patch_opts':     ('none',     'none',    '-E'),
73        '__chown':          ('exe',     'required', '/usr/bin/chown'),
74        '__install':        ('exe',     'required', '/usr/bin/ginstall'),
75        '__cc':             ('exe',     'required', '/usr/bin/gcc'),
76        '__cxx':            ('exe',     'required', '/usr/bin/g++'),
77        'with_iconv':       ('none',    'none',     '0')
78        }
79
80    defines['_build']        = defines['_host']
81    defines['_build_vendor'] = defines['_host_vendor']
82    defines['_build_os']     = defines['_host_os']
83    defines['_build_cpu']    = defines['_host_cpu']
84    defines['_build_alias']  = defines['_host_alias']
85    defines['_build_arch']   = defines['_host_arch']
86
87    return defines
88
89if __name__ == '__main__':
90    pprint.pprint(load())
Note: See TracBrowser for help on using the repository browser.