source: rtems-tools/rtemstoolkit/windows.py @ 87e0e76

4.104.115
Last change on this file since 87e0e76 was 50fdf12, checked in by Chris Johns <chrisj@…>, on 02/14/14 at 19:30:06

rt: Add the rtems-tester.

  • Property mode set to 100644
File size: 5.9 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2014 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# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions are met:
10#
11# 1. Redistributions of source code must retain the above copyright notice,
12# this list of conditions and the following disclaimer.
13#
14# 2. Redistributions in binary form must reproduce the above copyright notice,
15# this list of conditions and the following disclaimer in the documentation
16# and/or other materials provided with the distribution.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28# POSSIBILITY OF SUCH DAMAGE.
29#
30
31#
32# Windows specific support and overrides.
33#
34
35import error
36import pprint
37import os
38
39import execute
40
41def load():
42    # Default to the native Windows Python.
43    uname = 'win32'
44    system = 'mingw32'
45    if os.environ.has_key('HOSTTYPE'):
46        hosttype = os.environ['HOSTTYPE']
47    else:
48        hosttype = 'i686'
49    host_triple = hosttype + '-pc-' + system
50    build_triple = hosttype + '-pc-' + system
51
52    # See if this is actually Cygwin Python
53    if os.name == 'posix':
54        try:
55            uname = os.uname()
56            hosttype = uname[4]
57            uname = uname[0]
58            if uname.startswith('CYGWIN'):
59                if uname.endswith('WOW64'):
60                    uname = 'cygwin'
61                    build_triple = hosttype + '-pc-' + uname
62                    hosttype = 'x86_64'
63                    host_triple = hosttype + '-w64-' + system
64                else:
65                    raise error.general('invalid uname for Windows')
66            else:
67                raise error.general('invalid POSIX python')
68        except:
69            pass
70
71    if os.environ.has_key('NUMBER_OF_PROCESSORS'):
72        ncpus = os.environ['NUMBER_OF_PROCESSORS']
73    else:
74        ncpus = '1'
75
76    defines = {
77        '_ncpus':         ('none',    'none',     ncpus),
78        '_os':            ('none',    'none',     'win32'),
79        '_build':         ('triplet', 'required', build_triple),
80        '_build_vendor':  ('none',    'none',     'microsoft'),
81        '_build_os':      ('none',    'none',     'win32'),
82        '_build_cpu':     ('none',    'none',     hosttype),
83        '_build_alias':   ('none',    'none',     '%{nil}'),
84        '_build_arch':    ('none',    'none',     hosttype),
85        '_host':          ('triplet', 'required', host_triple),
86        '_host_vendor':   ('none',    'none',     'microsoft'),
87        '_host_os':       ('none',    'none',     'win32'),
88        '_host_cpu':      ('none',    'none',     hosttype),
89        '_host_alias':    ('none',    'none',     '%{nil}'),
90        '_host_arch':     ('none',    'none',     hosttype),
91        '_usr':           ('dir',     'optional', '/opt/local'),
92        '_var':           ('dir',     'optional', '/opt/local/var'),
93        '__bash':         ('exe',     'required', 'bash'),
94        '__bzip2':        ('exe',     'required', 'bzip2'),
95        '__bison':        ('exe',     'required', 'bison'),
96        '__cat':          ('exe',     'required', 'cat'),
97        '__cc':           ('exe',     'required', 'gcc'),
98        '__chgrp':        ('exe',     'required', 'chgrp'),
99        '__chmod':        ('exe',     'required', 'chmod'),
100        '__chown':        ('exe',     'required', 'chown'),
101        '__cp':           ('exe',     'required', 'cp'),
102        '__cvs':          ('exe',     'required', 'cvs'),
103        '__cxx':          ('exe',     'required', 'g++'),
104        '__flex':         ('exe',     'required', 'flex'),
105        '__git':          ('exe',     'required', 'git'),
106        '__grep':         ('exe',     'required', 'grep'),
107        '__gzip':         ('exe',     'required', 'gzip'),
108        '__id':           ('exe',     'required', 'id'),
109        '__install':      ('exe',     'required', 'install'),
110        '__install_info': ('exe',     'required', 'install-info'),
111        '__ld':           ('exe',     'required', 'ld'),
112        '__ldconfig':     ('exe',     'none',     ''),
113        '__makeinfo':     ('exe',     'required', 'makeinfo'),
114        '__mkdir':        ('exe',     'required', 'mkdir'),
115        '__mv':           ('exe',     'required', 'mv'),
116        '__nm':           ('exe',     'required', 'nm'),
117        '__nm':           ('exe',     'required', 'nm'),
118        '__objcopy':      ('exe',     'required', 'objcopy'),
119        '__objdump':      ('exe',     'required', 'objdump'),
120        '__patch':        ('exe',     'required', 'patch'),
121        '__patch_bin':    ('exe',     'required', 'patch'),
122        '__rm':           ('exe',     'required', 'rm'),
123        '__sed':          ('exe',     'required', 'sed'),
124        '__sh':           ('exe',     'required', 'sh'),
125        '__tar':          ('exe',     'required', 'bsdtar'),
126        '__touch':        ('exe',     'required', 'touch'),
127        '__unzip':        ('exe',     'required', 'unzip'),
128        '__xz':           ('exe',     'required', 'xz'),
129        '_buildshell':    ('exe',     'required', '%{__sh}'),
130        '___setup_shell': ('exe',     'required', '%{__sh}')
131        }
132    return defines
133
134if __name__ == '__main__':
135    pprint.pprint(load())
Note: See TracBrowser for help on using the repository browser.