Line
Link Here
|
0 |
-- lib-python/2.7/distutils/cygwinccompiler.py |
0 |
++ lib-python/2.7/distutils/cygwinccompiler.py |
Lines 135-143
Link Here
|
135 |
self.set_executables(compiler='gcc -mcygwin -O -Wall', |
135 |
self.set_executables(compiler='gcc -mcygwin -O -Wall', |
136 |
compiler_so='gcc -mcygwin -mdll -O -Wall', |
136 |
compiler_so='gcc -mcygwin -mdll -O -Wall', |
137 |
compiler_cxx='g++ -mcygwin -O -Wall', |
137 |
compiler_cxx='g++ -mcygwin -O -Wall', |
|
|
138 |
compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', |
138 |
linker_exe='gcc -mcygwin', |
139 |
linker_exe='gcc -mcygwin', |
139 |
linker_so=('%s -mcygwin %s' % |
140 |
linker_so=('%s -mcygwin %s' % |
140 |
(self.linker_dll, shared_option))) |
141 |
(self.linker_dll, shared_option)), |
|
|
142 |
linker_exe_cxx='g++ -mcygwin', |
143 |
linker_so_cxx=('%s -mcygwin %s' % |
144 |
(self.linker_dll, shared_option))) |
141 |
|
145 |
|
142 |
# cygwin and mingw32 need different sets of libraries |
146 |
# cygwin and mingw32 need different sets of libraries |
143 |
if self.gcc_version == "2.91.57": |
147 |
if self.gcc_version == "2.91.57": |
Lines 163-170
Link Here
|
163 |
raise CompileError, msg |
167 |
raise CompileError, msg |
164 |
else: # for other files use the C-compiler |
168 |
else: # for other files use the C-compiler |
165 |
try: |
169 |
try: |
166 |
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + |
170 |
if self.detect_language(src) == 'c++': |
167 |
extra_postargs) |
171 |
self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + |
|
|
172 |
extra_postargs) |
173 |
else: |
174 |
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + |
175 |
extra_postargs) |
168 |
except DistutilsExecError, msg: |
176 |
except DistutilsExecError, msg: |
169 |
raise CompileError, msg |
177 |
raise CompileError, msg |
170 |
|
178 |
|
Lines 325-334
Link Here
|
325 |
self.set_executables(compiler='gcc -mno-cygwin -O -Wall', |
338 |
self.set_executables(compiler='gcc -mno-cygwin -O -Wall', |
326 |
compiler_so='gcc -mno-cygwin -mdll -O -Wall', |
339 |
compiler_so='gcc -mno-cygwin -mdll -O -Wall', |
327 |
compiler_cxx='g++ -mno-cygwin -O -Wall', |
340 |
compiler_cxx='g++ -mno-cygwin -O -Wall', |
|
|
341 |
compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall', |
328 |
linker_exe='gcc -mno-cygwin', |
342 |
linker_exe='gcc -mno-cygwin', |
329 |
linker_so='%s -mno-cygwin %s %s' |
343 |
linker_so='%s -mno-cygwin %s %s' |
330 |
% (self.linker_dll, shared_option, |
344 |
% (self.linker_dll, shared_option, |
331 |
entry_point)) |
345 |
entry_point), |
|
|
346 |
linker_exe_cxx='g++ -mno-cygwin', |
347 |
linker_so_cxx='%s -mno-cygwin %s %s' |
348 |
% (self.linker_dll, shared_option, |
349 |
entry_point)) |
332 |
# Maybe we should also append -mthreads, but then the finished |
350 |
# Maybe we should also append -mthreads, but then the finished |
333 |
# dlls need another dll (mingwm10.dll see Mingw32 docs) |
351 |
# dlls need another dll (mingwm10.dll see Mingw32 docs) |
334 |
# (-mthreads: Support thread-safe exception handling on `Mingw32') |
352 |
# (-mthreads: Support thread-safe exception handling on `Mingw32') |
335 |
-- lib-python/2.7/distutils/emxccompiler.py |
353 |
++ lib-python/2.7/distutils/emxccompiler.py |
Lines 65-72
Link Here
|
65 |
# XXX optimization, warnings etc. should be customizable. |
65 |
# XXX optimization, warnings etc. should be customizable. |
66 |
self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', |
66 |
self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', |
67 |
compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', |
67 |
compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', |
|
|
68 |
compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', |
69 |
compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', |
68 |
linker_exe='gcc -Zomf -Zmt -Zcrtdll', |
70 |
linker_exe='gcc -Zomf -Zmt -Zcrtdll', |
69 |
linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') |
71 |
linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll', |
|
|
72 |
linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll', |
73 |
linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll') |
70 |
|
74 |
|
71 |
# want the gcc library statically linked (so that we don't have |
75 |
# want the gcc library statically linked (so that we don't have |
72 |
# to distribute a version dependent on the compiler we have) |
76 |
# to distribute a version dependent on the compiler we have) |
Lines 83-90
Link Here
|
83 |
raise CompileError, msg |
87 |
raise CompileError, msg |
84 |
else: # for other files use the C-compiler |
88 |
else: # for other files use the C-compiler |
85 |
try: |
89 |
try: |
86 |
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + |
90 |
if self.detect_language(src) == 'c++': |
87 |
extra_postargs) |
91 |
self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + |
|
|
92 |
extra_postargs) |
93 |
else: |
94 |
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + |
95 |
extra_postargs) |
88 |
except DistutilsExecError, msg: |
96 |
except DistutilsExecError, msg: |
89 |
raise CompileError, msg |
97 |
raise CompileError, msg |
90 |
|
98 |
|
91 |
-- lib-python/2.7/distutils/sysconfig_cpython.py |
99 |
++ lib-python/2.7/distutils/sysconfig_cpython.py |
Lines 149-158
Link Here
|
149 |
varies across Unices and is stored in Python's Makefile. |
149 |
varies across Unices and is stored in Python's Makefile. |
150 |
""" |
150 |
""" |
151 |
if compiler.compiler_type == "unix": |
151 |
if compiler.compiler_type == "unix": |
152 |
(cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \ |
152 |
(cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \ |
153 |
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', |
153 |
get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', |
154 |
'CCSHARED', 'LDSHARED', 'SO', 'AR', |
154 |
'SO', 'AR', 'ARFLAGS') |
155 |
'ARFLAGS') |
155 |
|
|
|
156 |
cflags = '' |
157 |
cxxflags = '' |
156 |
|
158 |
|
157 |
newcc = None |
159 |
newcc = None |
158 |
if 'CC' in os.environ: |
160 |
if 'CC' in os.environ: |
Lines 190-208
Link Here
|
190 |
cxx = os.environ['CXX'] |
192 |
cxx = os.environ['CXX'] |
191 |
if 'LDSHARED' in os.environ: |
193 |
if 'LDSHARED' in os.environ: |
192 |
ldshared = os.environ['LDSHARED'] |
194 |
ldshared = os.environ['LDSHARED'] |
|
|
195 |
if 'LDCXXSHARED' in os.environ: |
196 |
ldcxxshared = os.environ['LDCXXSHARED'] |
193 |
if 'CPP' in os.environ: |
197 |
if 'CPP' in os.environ: |
194 |
cpp = os.environ['CPP'] |
198 |
cpp = os.environ['CPP'] |
195 |
else: |
199 |
else: |
196 |
cpp = cc + " -E" # not always |
200 |
cpp = cc + " -E" # not always |
197 |
if 'LDFLAGS' in os.environ: |
201 |
if 'LDFLAGS' in os.environ: |
198 |
ldshared = ldshared + ' ' + os.environ['LDFLAGS'] |
202 |
ldshared = ldshared + ' ' + os.environ['LDFLAGS'] |
|
|
203 |
ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] |
199 |
if 'CFLAGS' in os.environ: |
204 |
if 'CFLAGS' in os.environ: |
200 |
cflags = opt + ' ' + os.environ['CFLAGS'] |
205 |
cflags = os.environ['CFLAGS'] |
201 |
ldshared = ldshared + ' ' + os.environ['CFLAGS'] |
206 |
ldshared = ldshared + ' ' + os.environ['CFLAGS'] |
|
|
207 |
if 'CXXFLAGS' in os.environ: |
208 |
cxxflags = os.environ['CXXFLAGS'] |
209 |
ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] |
202 |
if 'CPPFLAGS' in os.environ: |
210 |
if 'CPPFLAGS' in os.environ: |
203 |
cpp = cpp + ' ' + os.environ['CPPFLAGS'] |
211 |
cpp = cpp + ' ' + os.environ['CPPFLAGS'] |
204 |
cflags = cflags + ' ' + os.environ['CPPFLAGS'] |
212 |
cflags = cflags + ' ' + os.environ['CPPFLAGS'] |
|
|
213 |
cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] |
205 |
ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] |
214 |
ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] |
|
|
215 |
ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] |
206 |
if 'AR' in os.environ: |
216 |
if 'AR' in os.environ: |
207 |
ar = os.environ['AR'] |
217 |
ar = os.environ['AR'] |
208 |
if 'ARFLAGS' in os.environ: |
218 |
if 'ARFLAGS' in os.environ: |
Lines 211-223
Link Here
|
211 |
archiver = ar + ' ' + ar_flags |
221 |
archiver = ar + ' ' + ar_flags |
212 |
|
222 |
|
213 |
cc_cmd = cc + ' ' + cflags |
223 |
cc_cmd = cc + ' ' + cflags |
|
|
224 |
cxx_cmd = cxx + ' ' + cxxflags |
214 |
compiler.set_executables( |
225 |
compiler.set_executables( |
215 |
preprocessor=cpp, |
226 |
preprocessor=cpp, |
216 |
compiler=cc_cmd, |
227 |
compiler=cc_cmd, |
217 |
compiler_so=cc_cmd + ' ' + ccshared, |
228 |
compiler_so=cc_cmd + ' ' + ccshared, |
218 |
compiler_cxx=cxx, |
229 |
compiler_cxx=cxx_cmd, |
|
|
230 |
compiler_so_cxx=cxx_cmd + ' ' + ccshared, |
219 |
linker_so=ldshared, |
231 |
linker_so=ldshared, |
220 |
linker_exe=cc, |
232 |
linker_exe=cc, |
|
|
233 |
linker_so_cxx=ldcxxshared, |
234 |
linker_exe_cxx=cxx, |
221 |
archiver=archiver) |
235 |
archiver=archiver) |
222 |
|
236 |
|
223 |
compiler.shared_lib_extension = so_ext |
237 |
compiler.shared_lib_extension = so_ext |
Lines 529-535
Link Here
|
529 |
for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', |
543 |
for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', |
530 |
# a number of derived variables. These need to be |
544 |
# a number of derived variables. These need to be |
531 |
# patched up as well. |
545 |
# patched up as well. |
532 |
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
546 |
'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
533 |
flags = _config_vars[key] |
547 |
flags = _config_vars[key] |
534 |
flags = re.sub('-arch\s+\w+\s', ' ', flags) |
548 |
flags = re.sub('-arch\s+\w+\s', ' ', flags) |
535 |
flags = re.sub('-isysroot [^ \t]*', ' ', flags) |
549 |
flags = re.sub('-isysroot [^ \t]*', ' ', flags) |
Lines 548-554
Link Here
|
548 |
for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', |
562 |
for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', |
549 |
# a number of derived variables. These need to be |
563 |
# a number of derived variables. These need to be |
550 |
# patched up as well. |
564 |
# patched up as well. |
551 |
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
565 |
'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
552 |
|
566 |
|
553 |
flags = _config_vars[key] |
567 |
flags = _config_vars[key] |
554 |
flags = re.sub('-arch\s+\w+\s', ' ', flags) |
568 |
flags = re.sub('-arch\s+\w+\s', ' ', flags) |
Lines 572-578
Link Here
|
572 |
for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', |
586 |
for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED', |
573 |
# a number of derived variables. These need to be |
587 |
# a number of derived variables. These need to be |
574 |
# patched up as well. |
588 |
# patched up as well. |
575 |
'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
589 |
'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'): |
576 |
|
590 |
|
577 |
flags = _config_vars[key] |
591 |
flags = _config_vars[key] |
578 |
flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags) |
592 |
flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags) |
579 |
-- lib-python/2.7/distutils/sysconfig_pypy.py |
593 |
++ lib-python/2.7/distutils/sysconfig_pypy.py |
Lines 123-129
Link Here
|
123 |
optional C speedup components. |
123 |
optional C speedup components. |
124 |
""" |
124 |
""" |
125 |
if compiler.compiler_type == "unix": |
125 |
if compiler.compiler_type == "unix": |
126 |
compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit']) |
126 |
cc = ' '.join(compiler.compiler) |
|
|
127 |
cxx = ' '.join(compiler.compiler_cxx) |
128 |
ldshared = ' '.join(compiler.linker_so) |
129 |
ldcxxshared = ' '.join(compiler.linker_so_cxx) |
130 |
|
131 |
cflags = '' |
132 |
cxxflags = '' |
133 |
ccshared = '-fPIC' |
134 |
|
135 |
if 'CC' in os.environ: |
136 |
cc = os.environ['CC'] |
137 |
if 'CXX' in os.environ: |
138 |
cxx = os.environ['CXX'] |
139 |
if 'LDSHARED' in os.environ: |
140 |
ldshared = os.environ['LDSHARED'] |
141 |
if 'LDCXXSHARED' in os.environ: |
142 |
ldcxxshared = os.environ['LDCXXSHARED'] |
143 |
if 'CPP' in os.environ: |
144 |
cpp = os.environ['CPP'] |
145 |
else: |
146 |
cpp = cc + " -E" # not always |
147 |
if 'LDFLAGS' in os.environ: |
148 |
ldshared = ldshared + ' ' + os.environ['LDFLAGS'] |
149 |
ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] |
150 |
if 'CFLAGS' in os.environ: |
151 |
cflags = os.environ['CFLAGS'] |
152 |
ldshared = ldshared + ' ' + os.environ['CFLAGS'] |
153 |
if 'CXXFLAGS' in os.environ: |
154 |
cxxflags = os.environ['CXXFLAGS'] |
155 |
ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] |
156 |
if 'CPPFLAGS' in os.environ: |
157 |
cpp = cpp + ' ' + os.environ['CPPFLAGS'] |
158 |
cflags = cflags + ' ' + os.environ['CPPFLAGS'] |
159 |
cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] |
160 |
ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] |
161 |
ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] |
162 |
|
163 |
cc_cmd = cc + ' ' + cflags |
164 |
cxx_cmd = cxx + ' ' + cxxflags |
165 |
compiler.set_executables( |
166 |
preprocessor=cpp, |
167 |
compiler=cc_cmd, |
168 |
compiler_so=cc_cmd + ' ' + ccshared, |
169 |
compiler_cxx=cxx_cmd, |
170 |
compiler_so_cxx=cxx_cmd + ' ' + ccshared, |
171 |
linker_so=ldshared, |
172 |
linker_exe=cc, |
173 |
linker_so_cxx=ldcxxshared, |
174 |
linker_exe_cxx=cxx) |
127 |
compiler.shared_lib_extension = get_config_var('SO') |
175 |
compiler.shared_lib_extension = get_config_var('SO') |
128 |
if "CPPFLAGS" in os.environ: |
176 |
if "CPPFLAGS" in os.environ: |
129 |
cppflags = shlex.split(os.environ["CPPFLAGS"]) |
177 |
cppflags = shlex.split(os.environ["CPPFLAGS"]) |
130 |
-- lib-python/2.7/distutils/unixccompiler.py |
178 |
++ lib-python/2.7/distutils/unixccompiler.py |
Lines 114-127
Link Here
|
114 |
# are pretty generic; they will probably have to be set by an outsider |
114 |
# are pretty generic; they will probably have to be set by an outsider |
115 |
# (eg. using information discovered by the sysconfig about building |
115 |
# (eg. using information discovered by the sysconfig about building |
116 |
# Python extensions). |
116 |
# Python extensions). |
117 |
executables = {'preprocessor' : None, |
117 |
executables = {'preprocessor' : None, |
118 |
'compiler' : ["cc"], |
118 |
'compiler' : ["cc"], |
119 |
'compiler_so' : ["cc"], |
119 |
'compiler_so' : ["cc"], |
120 |
'compiler_cxx' : ["cc"], |
120 |
'compiler_cxx' : ["c++"], |
121 |
'linker_so' : ["cc", "-shared"], |
121 |
'compiler_so_cxx' : ["c++"], |
122 |
'linker_exe' : ["cc"], |
122 |
'linker_so' : ["cc", "-shared"], |
123 |
'archiver' : ["ar", "-cr"], |
123 |
'linker_exe' : ["cc"], |
124 |
'ranlib' : None, |
124 |
'linker_so_cxx' : ["c++", "-shared"], |
|
|
125 |
'linker_exe_cxx' : ["c++"], |
126 |
'archiver' : ["ar", "-cr"], |
127 |
'ranlib' : None, |
125 |
} |
128 |
} |
126 |
|
129 |
|
127 |
if sys.platform[:6] == "darwin": |
130 |
if sys.platform[:6] == "darwin": |
Lines 171-181
Link Here
|
171 |
|
174 |
|
172 |
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): |
175 |
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): |
173 |
compiler_so = self.compiler_so |
176 |
compiler_so = self.compiler_so |
|
|
177 |
compiler_so_cxx = self.compiler_so_cxx |
174 |
if sys.platform == 'darwin': |
178 |
if sys.platform == 'darwin': |
175 |
compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) |
179 |
compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs) |
|
|
180 |
compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args + |
181 |
extra_postargs) |
176 |
try: |
182 |
try: |
177 |
self.spawn(compiler_so + cc_args + [src, '-o', obj] + |
183 |
if self.detect_language(src) == 'c++': |
178 |
extra_postargs) |
184 |
self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + |
|
|
185 |
extra_postargs) |
186 |
else: |
187 |
self.spawn(compiler_so + cc_args + [src, '-o', obj] + |
188 |
extra_postargs) |
179 |
except DistutilsExecError, msg: |
189 |
except DistutilsExecError, msg: |
180 |
raise CompileError, msg |
190 |
raise CompileError, msg |
181 |
|
191 |
|
Lines 232-254
Link Here
|
232 |
ld_args.extend(extra_postargs) |
242 |
ld_args.extend(extra_postargs) |
233 |
self.mkpath(os.path.dirname(output_filename)) |
243 |
self.mkpath(os.path.dirname(output_filename)) |
234 |
try: |
244 |
try: |
235 |
if target_desc == CCompiler.EXECUTABLE: |
245 |
if target_lang == "c++": |
236 |
linker = self.linker_exe[:] |
246 |
if target_desc == CCompiler.EXECUTABLE: |
|
|
247 |
linker = self.linker_exe_cxx[:] |
248 |
else: |
249 |
linker = self.linker_so_cxx[:] |
237 |
else: |
250 |
else: |
238 |
linker = self.linker_so[:] |
251 |
if target_desc == CCompiler.EXECUTABLE: |
239 |
if target_lang == "c++" and self.compiler_cxx: |
252 |
linker = self.linker_exe[:] |
240 |
# skip over environment variable settings if /usr/bin/env |
253 |
else: |
241 |
# is used to set up the linker's environment. |
254 |
linker = self.linker_so[:] |
242 |
# This is needed on OSX. Note: this assumes that the |
|
|
243 |
# normal and C++ compiler have the same environment |
244 |
# settings. |
245 |
i = 0 |
246 |
if os.path.basename(linker[0]) == "env": |
247 |
i = 1 |
248 |
while '=' in linker[i]: |
249 |
i = i + 1 |
250 |
|
251 |
linker[i] = self.compiler_cxx[i] |
252 |
|
255 |
|
253 |
if sys.platform == 'darwin': |
256 |
if sys.platform == 'darwin': |
254 |
linker = _darwin_compiler_fixup(linker, ld_args) |
257 |
linker = _darwin_compiler_fixup(linker, ld_args) |