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 | |
---|
24 | import error |
---|
25 | import pprint |
---|
26 | import os |
---|
27 | |
---|
28 | import execute |
---|
29 | |
---|
30 | def 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 | defines = { |
---|
66 | '_ncpus': ('none', 'none', ncpus), |
---|
67 | '_os': ('none', 'none', 'win32'), |
---|
68 | '_build': ('triplet', 'required', build_triple), |
---|
69 | '_host': ('triplet', 'required', host_triple), |
---|
70 | '_host_vendor': ('none', 'none', 'microsoft'), |
---|
71 | '_host_os': ('none', 'none', 'win32'), |
---|
72 | '_host_cpu': ('none', 'none', hosttype), |
---|
73 | '_host_alias': ('none', 'none', '%{nil}'), |
---|
74 | '_host_arch': ('none', 'none', hosttype), |
---|
75 | '_usr': ('dir', 'optional', '/opt/local'), |
---|
76 | '_var': ('dir', 'optional', '/opt/local/var'), |
---|
77 | '__bash': ('exe', 'required', 'bash'), |
---|
78 | '__bzip2': ('exe', 'required', 'bzip2'), |
---|
79 | '__bison': ('exe', 'required', 'bison'), |
---|
80 | '__cat': ('exe', 'required', 'cat'), |
---|
81 | '__cc': ('exe', 'required', 'gcc'), |
---|
82 | '__chgrp': ('exe', 'required', 'chgrp'), |
---|
83 | '__chmod': ('exe', 'required', 'chmod'), |
---|
84 | '__chown': ('exe', 'required', 'chown'), |
---|
85 | '__cp': ('exe', 'required', 'cp'), |
---|
86 | '__cxx': ('exe', 'required', 'g++'), |
---|
87 | '__flex': ('exe', 'required', 'flex'), |
---|
88 | '__git': ('exe', 'required', 'git'), |
---|
89 | '__grep': ('exe', 'required', 'grep'), |
---|
90 | '__gzip': ('exe', 'required', 'gzip'), |
---|
91 | '__id': ('exe', 'required', 'id'), |
---|
92 | '__install': ('exe', 'required', 'install'), |
---|
93 | '__install_info': ('exe', 'required', 'install-info'), |
---|
94 | '__ld': ('exe', 'required', 'ld'), |
---|
95 | '__ldconfig': ('exe', 'none', ''), |
---|
96 | '__makeinfo': ('exe', 'required', 'makeinfo'), |
---|
97 | '__mkdir': ('exe', 'required', 'mkdir'), |
---|
98 | '__mv': ('exe', 'required', 'mv'), |
---|
99 | '__nm': ('exe', 'required', 'nm'), |
---|
100 | '__nm': ('exe', 'required', 'nm'), |
---|
101 | '__objcopy': ('exe', 'required', 'objcopy'), |
---|
102 | '__objdump': ('exe', 'required', 'objdump'), |
---|
103 | '__patch': ('exe', 'required', 'patch'), |
---|
104 | '__rm': ('exe', 'required', 'rm'), |
---|
105 | '__sed': ('exe', 'required', 'sed'), |
---|
106 | '__sh': ('exe', 'required', 'sh'), |
---|
107 | '__tar': ('exe', 'required', 'bsdtar'), |
---|
108 | '__unzip': ('exe', 'required', 'unzip'), |
---|
109 | '__xz': ('exe', 'required', 'xz'), |
---|
110 | '_buildshell': ('exe', 'required', '%{__sh}'), |
---|
111 | '___setup_shell': ('exe', 'required', '%{__sh}'), |
---|
112 | 'optflags': ('none', 'none', '-O2 -pipe'), |
---|
113 | } |
---|
114 | return defines |
---|
115 | |
---|
116 | if __name__ == '__main__': |
---|
117 | pprint.pprint(load()) |
---|