source: rtems-source-builder/source-builder/sb/windows.py @ a14171f

4.104.114.95
Last change on this file since a14171f was a14171f, checked in by Chris Johns <chrisj@…>, on 04/10/14 at 08:26:42

sb: Add _host_os_version to all supported hosts.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2013 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# Windows specific support and overrides.
22#
23
24import error
25import pprint
26import os
27
28import execute
29
30def load():
31    # Default to the native Windows Python.
32    uname = 'win32'
33    system = 'mingw32'
34    if os.environ.has_key('HOSTTYPE'):
35        hosttype = os.environ['HOSTTYPE']
36    else:
37        hosttype = 'i686'
38    host_triple = hosttype + '-pc-' + system
39    build_triple = hosttype + '-pc-' + system
40
41    # See if this is actually Cygwin Python
42    if os.name == 'posix':
43        try:
44            uname = os.uname()
45            hosttype = uname[4]
46            uname = uname[0]
47            if uname.startswith('CYGWIN'):
48                if uname.endswith('WOW64'):
49                    uname = 'cygwin'
50                    build_triple = hosttype + '-pc-' + uname
51                    hosttype = 'x86_64'
52                    host_triple = hosttype + '-w64-' + system
53                else:
54                    raise error.general('invalid uname for Windows')
55            else:
56                raise error.general('invalid POSIX python')
57        except:
58            pass
59
60    if os.environ.has_key('NUMBER_OF_PROCESSORS'):
61        ncpus = os.environ['NUMBER_OF_PROCESSORS']
62    else:
63        ncpus = '1'
64
65    version = uname[2]
66    defines = {
67        '_ncpus':            ('none',    'none',     ncpus),
68        '_os':               ('none',    'none',     'win32'),
69        '_build':            ('triplet', 'required', build_triple),
70        '_build_vendor':     ('none',    'none',     'microsoft'),
71        '_build_os':         ('none',    'none',     'win32'),
72        '_build_os_version': ('none',    'none',     version),
73        '_build_cpu':        ('none',    'none',     hosttype),
74        '_build_alias':      ('none',    'none',     '%{nil}'),
75        '_build_arch':       ('none',    'none',     hosttype),
76        '_host':             ('triplet', 'required', host_triple),
77        '_host_vendor':      ('none',    'none',     'microsoft'),
78        '_host_os':          ('none',    'none',     'win32'),
79        '_host_cpu':         ('none',    'none',     hosttype),
80        '_host_alias':       ('none',    'none',     '%{nil}'),
81        '_host_arch':        ('none',    'none',     hosttype),
82        '_usr':              ('dir',     'optional', '/opt/local'),
83        '_var':              ('dir',     'optional', '/opt/local/var'),
84        '__bash':            ('exe',     'required', 'bash'),
85        '__bzip2':           ('exe',     'required', 'bzip2'),
86        '__bison':           ('exe',     'required', 'bison'),
87        '__cat':             ('exe',     'required', 'cat'),
88        '__cc':              ('exe',     'required', 'gcc'),
89        '__chgrp':           ('exe',     'required', 'chgrp'),
90        '__chmod':           ('exe',     'required', 'chmod'),
91        '__chown':           ('exe',     'required', 'chown'),
92        '__cp':              ('exe',     'required', 'cp'),
93        '__cvs':             ('exe',     'required', 'cvs'),
94        '__cxx':             ('exe',     'required', 'g++'),
95        '__flex':            ('exe',     'required', 'flex'),
96        '__git':             ('exe',     'required', 'git'),
97        '__grep':            ('exe',     'required', 'grep'),
98        '__gzip':            ('exe',     'required', 'gzip'),
99        '__id':              ('exe',     'required', 'id'),
100        '__install':         ('exe',     'required', 'install'),
101        '__install_info':    ('exe',     'required', 'install-info'),
102        '__ld':              ('exe',     'required', 'ld'),
103        '__ldconfig':        ('exe',     'none',     ''),
104        '__makeinfo':        ('exe',     'required', 'makeinfo'),
105        '__mkdir':           ('exe',     'required', 'mkdir'),
106        '__mv':              ('exe',     'required', 'mv'),
107        '__nm':              ('exe',     'required', 'nm'),
108        '__nm':              ('exe',     'required', 'nm'),
109        '__objcopy':         ('exe',     'required', 'objcopy'),
110        '__objdump':         ('exe',     'required', 'objdump'),
111        '__patch':           ('exe',     'required', 'patch'),
112        '__patch_bin':       ('exe',     'required', 'patch'),
113        '__rm':              ('exe',     'required', 'rm'),
114        '__sed':             ('exe',     'required', 'sed'),
115        '__sh':              ('exe',     'required', 'sh'),
116        '__tar':             ('exe',     'required', 'bsdtar'),
117        '__touch':           ('exe',     'required', 'touch'),
118        '__unzip':           ('exe',     'required', 'unzip'),
119        '__xz':              ('exe',     'required', 'xz'),
120        '_buildshell':       ('exe',     'required', '%{__sh}'),
121        '___setup_shell':    ('exe',     'required', '%{__sh}')
122        }
123    return defines
124
125if __name__ == '__main__':
126    pprint.pprint(load())
Note: See TracBrowser for help on using the repository browser.