Gentoo Archives: gentoo-commits

From: "Mike Gilbert (floppym)" <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/pypy/files: pypy-1.7-distutils-fix_handling_of_executables_and_flags.patch pypy-1.7-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
Date: Mon, 30 Jan 2012 15:50:45
Message-Id: 20120130155035.D601E2004C@flycatcher.gentoo.org
1 floppym 12/01/30 15:50:35
2
3 Added:
4 pypy-1.7-distutils-fix_handling_of_executables_and_flags.patch
5 pypy-1.7-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
6 Log:
7 Apply patches from Arfrever to resolve bug 397523.
8
9 (Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
10
11 Revision Changes Path
12 1.1 dev-python/pypy/files/pypy-1.7-distutils-fix_handling_of_executables_and_flags.patch
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pypy/files/pypy-1.7-distutils-fix_handling_of_executables_and_flags.patch?rev=1.1&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pypy/files/pypy-1.7-distutils-fix_handling_of_executables_and_flags.patch?rev=1.1&content-type=text/plain
16
17 Index: pypy-1.7-distutils-fix_handling_of_executables_and_flags.patch
18 ===================================================================
19 --- lib-python/modified-2.7/distutils/ccompiler.py
20 +++ lib-python/modified-2.7/distutils/ccompiler.py
21 @@ -27,10 +27,12 @@
22 varies across Unices and is stored in Python's Makefile.
23 """
24 if compiler.compiler_type == "unix":
25 - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
26 - _sysconfig.get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
27 - 'CCSHARED', 'LDSHARED', 'SO', 'AR',
28 - 'ARFLAGS')
29 + (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
30 + _sysconfig.get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED',
31 + 'LDCXXSHARED', 'SO', 'AR', 'ARFLAGS')
32 +
33 + cflags = ''
34 + cxxflags = ''
35
36 if 'CC' in os.environ:
37 cc = os.environ['CC']
38 @@ -38,19 +40,27 @@
39 cxx = os.environ['CXX']
40 if 'LDSHARED' in os.environ:
41 ldshared = os.environ['LDSHARED']
42 + if 'LDCXXSHARED' in os.environ:
43 + ldcxxshared = os.environ['LDCXXSHARED']
44 if 'CPP' in os.environ:
45 cpp = os.environ['CPP']
46 else:
47 cpp = cc + " -E" # not always
48 if 'LDFLAGS' in os.environ:
49 ldshared = ldshared + ' ' + os.environ['LDFLAGS']
50 + ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
51 if 'CFLAGS' in os.environ:
52 - cflags = opt + ' ' + os.environ['CFLAGS']
53 + cflags = os.environ['CFLAGS']
54 ldshared = ldshared + ' ' + os.environ['CFLAGS']
55 + if 'CXXFLAGS' in os.environ:
56 + cxxflags = os.environ['CXXFLAGS']
57 + ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
58 if 'CPPFLAGS' in os.environ:
59 cpp = cpp + ' ' + os.environ['CPPFLAGS']
60 cflags = cflags + ' ' + os.environ['CPPFLAGS']
61 + cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
62 ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
63 + ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
64 if 'AR' in os.environ:
65 ar = os.environ['AR']
66 if 'ARFLAGS' in os.environ:
67 @@ -59,13 +69,17 @@
68 archiver = ar + ' ' + ar_flags
69
70 cc_cmd = cc + ' ' + cflags
71 + cxx_cmd = cxx + ' ' + cxxflags
72 compiler.set_executables(
73 preprocessor=cpp,
74 compiler=cc_cmd,
75 compiler_so=cc_cmd + ' ' + ccshared,
76 - compiler_cxx=cxx,
77 + compiler_cxx=cxx_cmd,
78 + compiler_so_cxx=cxx_cmd + ' ' + ccshared,
79 linker_so=ldshared,
80 linker_exe=cc,
81 + linker_so_cxx=ldcxxshared,
82 + linker_exe_cxx=cxx,
83 archiver=archiver)
84
85 compiler.shared_lib_extension = so_ext
86 --- lib-python/modified-2.7/distutils/cygwinccompiler.py
87 +++ lib-python/modified-2.7/distutils/cygwinccompiler.py
88 @@ -135,9 +135,13 @@
89 self.set_executables(compiler='gcc -mcygwin -O -Wall',
90 compiler_so='gcc -mcygwin -mdll -O -Wall',
91 compiler_cxx='g++ -mcygwin -O -Wall',
92 + compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
93 linker_exe='gcc -mcygwin',
94 linker_so=('%s -mcygwin %s' %
95 - (self.linker_dll, shared_option)))
96 + (self.linker_dll, shared_option)),
97 + linker_exe_cxx='g++ -mcygwin',
98 + linker_so_cxx=('%s -mcygwin %s' %
99 + (self.linker_dll, shared_option)))
100
101 # cygwin and mingw32 need different sets of libraries
102 if self.gcc_version == "2.91.57":
103 @@ -163,8 +167,12 @@
104 raise CompileError, msg
105 else: # for other files use the C-compiler
106 try:
107 - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
108 - extra_postargs)
109 + if self.detect_language(src) == 'c++':
110 + self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
111 + extra_postargs)
112 + else:
113 + self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
114 + extra_postargs)
115 except DistutilsExecError, msg:
116 raise CompileError, msg
117
118 @@ -325,10 +333,15 @@
119 self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
120 compiler_so='gcc -mno-cygwin -mdll -O -Wall',
121 compiler_cxx='g++ -mno-cygwin -O -Wall',
122 + compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
123 linker_exe='gcc -mno-cygwin',
124 linker_so='%s -mno-cygwin %s %s'
125 % (self.linker_dll, shared_option,
126 - entry_point))
127 + entry_point),
128 + linker_exe_cxx='g++ -mno-cygwin',
129 + linker_so_cxx='%s -mno-cygwin %s %s'
130 + % (self.linker_dll, shared_option,
131 + entry_point))
132 # Maybe we should also append -mthreads, but then the finished
133 # dlls need another dll (mingwm10.dll see Mingw32 docs)
134 # (-mthreads: Support thread-safe exception handling on `Mingw32')
135 --- lib-python/modified-2.7/distutils/emxccompiler.py
136 +++ lib-python/modified-2.7/distutils/emxccompiler.py
137 @@ -65,8 +65,12 @@
138 # XXX optimization, warnings etc. should be customizable.
139 self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
140 compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
141 + compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
142 + compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
143 linker_exe='gcc -Zomf -Zmt -Zcrtdll',
144 - linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
145 + linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
146 + linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
147 + linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
148
149 # want the gcc library statically linked (so that we don't have
150 # to distribute a version dependent on the compiler we have)
151 @@ -83,8 +87,12 @@
152 raise CompileError, msg
153 else: # for other files use the C-compiler
154 try:
155 - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
156 - extra_postargs)
157 + if self.detect_language(src) == 'c++':
158 + self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
159 + extra_postargs)
160 + else:
161 + self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
162 + extra_postargs)
163 except DistutilsExecError, msg:
164 raise CompileError, msg
165
166 --- lib-python/modified-2.7/distutils/sysconfig_cpython.py
167 +++ lib-python/modified-2.7/distutils/sysconfig_cpython.py
168 @@ -149,9 +149,12 @@
169 varies across Unices and is stored in Python's Makefile.
170 """
171 if compiler.compiler_type == "unix":
172 - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \
173 - get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
174 - 'CCSHARED', 'LDSHARED', 'SO')
175 + (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext) = \
176 + get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED',
177 + 'LDCXXSHARED', 'SO')
178 +
179 + cflags = ''
180 + cxxflags = ''
181
182 if 'CC' in os.environ:
183 cc = os.environ['CC']
184 @@ -159,28 +162,40 @@
185 cxx = os.environ['CXX']
186 if 'LDSHARED' in os.environ:
187 ldshared = os.environ['LDSHARED']
188 + if 'LDCXXSHARED' in os.environ:
189 + ldcxxshared = os.environ['LDCXXSHARED']
190 if 'CPP' in os.environ:
191 cpp = os.environ['CPP']
192 else:
193 cpp = cc + " -E" # not always
194 if 'LDFLAGS' in os.environ:
195 ldshared = ldshared + ' ' + os.environ['LDFLAGS']
196 + ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
197 if 'CFLAGS' in os.environ:
198 - cflags = opt + ' ' + os.environ['CFLAGS']
199 + cflags = os.environ['CFLAGS']
200 ldshared = ldshared + ' ' + os.environ['CFLAGS']
201 + if 'CXXFLAGS' in os.environ:
202 + cxxflags = os.environ['CXXFLAGS']
203 + ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
204 if 'CPPFLAGS' in os.environ:
205 cpp = cpp + ' ' + os.environ['CPPFLAGS']
206 cflags = cflags + ' ' + os.environ['CPPFLAGS']
207 + cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
208 ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
209 + ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
210
211 cc_cmd = cc + ' ' + cflags
212 + cxx_cmd = cxx + ' ' + cxxflags
213 compiler.set_executables(
214 preprocessor=cpp,
215 compiler=cc_cmd,
216 compiler_so=cc_cmd + ' ' + ccshared,
217 - compiler_cxx=cxx,
218 + compiler_cxx=cxx_cmd,
219 + compiler_so_cxx=cxx_cmd + ' ' + ccshared,
220 linker_so=ldshared,
221 - linker_exe=cc)
222 + linker_exe=cc,
223 + linker_so_cxx=ldcxxshared,
224 + linker_exe_cxx=cxx)
225
226 compiler.shared_lib_extension = so_ext
227
228 @@ -506,7 +521,7 @@
229 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
230 # a number of derived variables. These need to be
231 # patched up as well.
232 - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
233 + 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
234 flags = _config_vars[key]
235 flags = re.sub('-arch\s+\w+\s', ' ', flags)
236 flags = re.sub('-isysroot [^ \t]*', ' ', flags)
237 @@ -525,7 +540,7 @@
238 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
239 # a number of derived variables. These need to be
240 # patched up as well.
241 - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
242 + 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
243
244 flags = _config_vars[key]
245 flags = re.sub('-arch\s+\w+\s', ' ', flags)
246 @@ -549,7 +564,7 @@
247 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
248 # a number of derived variables. These need to be
249 # patched up as well.
250 - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
251 + 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
252
253 flags = _config_vars[key]
254 flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
255 --- lib-python/modified-2.7/distutils/sysconfig_pypy.py
256 +++ lib-python/modified-2.7/distutils/sysconfig_pypy.py
257 @@ -114,13 +114,56 @@
258 optional C speedup components.
259 """
260 if compiler.compiler_type == "unix":
261 - compiler.compiler_so.extend(['-fPIC', '-Wimplicit'])
262 + cc = ' '.join(compiler.compiler)
263 + cxx = ' '.join(compiler.compiler_cxx)
264 + ldshared = ' '.join(compiler.linker_so)
265 + ldcxxshared = ' '.join(compiler.linker_so_cxx)
266 +
267 + cflags = ''
268 + cxxflags = ''
269 + ccshared = '-fPIC'
270 +
271 + if 'CC' in os.environ:
272 + cc = os.environ['CC']
273 + if 'CXX' in os.environ:
274 + cxx = os.environ['CXX']
275 + if 'LDSHARED' in os.environ:
276 + ldshared = os.environ['LDSHARED']
277 + if 'LDCXXSHARED' in os.environ:
278 + ldcxxshared = os.environ['LDCXXSHARED']
279 + if 'CPP' in os.environ:
280 + cpp = os.environ['CPP']
281 + else:
282 + cpp = cc + " -E" # not always
283 + if 'LDFLAGS' in os.environ:
284 + ldshared = ldshared + ' ' + os.environ['LDFLAGS']
285 + ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
286 + if 'CFLAGS' in os.environ:
287 + cflags = os.environ['CFLAGS']
288 + ldshared = ldshared + ' ' + os.environ['CFLAGS']
289 + if 'CXXFLAGS' in os.environ:
290 + cxxflags = os.environ['CXXFLAGS']
291 + ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
292 + if 'CPPFLAGS' in os.environ:
293 + cpp = cpp + ' ' + os.environ['CPPFLAGS']
294 + cflags = cflags + ' ' + os.environ['CPPFLAGS']
295 + cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
296 + ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
297 + ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
298 +
299 + cc_cmd = cc + ' ' + cflags
300 + cxx_cmd = cxx + ' ' + cxxflags
301 + compiler.set_executables(
302 + preprocessor=cpp,
303 + compiler=cc_cmd,
304 + compiler_so=cc_cmd + ' ' + ccshared,
305 + compiler_cxx=cxx_cmd,
306 + compiler_so_cxx=cxx_cmd + ' ' + ccshared,
307 + linker_so=ldshared,
308 + linker_exe=cc,
309 + linker_so_cxx=ldcxxshared,
310 + linker_exe_cxx=cxx)
311 compiler.shared_lib_extension = get_config_var('SO')
312 - if "CFLAGS" in os.environ:
313 - cflags = os.environ["CFLAGS"]
314 - compiler.compiler.append(cflags)
315 - compiler.compiler_so.append(cflags)
316 - compiler.linker_so.append(cflags)
317
318
319 from sysconfig_cpython import (
320 --- lib-python/modified-2.7/distutils/unixccompiler.py
321 +++ lib-python/modified-2.7/distutils/unixccompiler.py
322 @@ -114,14 +114,17 @@
323 # are pretty generic; they will probably have to be set by an outsider
324 # (eg. using information discovered by the sysconfig about building
325 # Python extensions).
326 - executables = {'preprocessor' : None,
327 - 'compiler' : ["cc"],
328 - 'compiler_so' : ["cc"],
329 - 'compiler_cxx' : ["cc"],
330 - 'linker_so' : ["cc", "-shared"],
331 - 'linker_exe' : ["cc"],
332 - 'archiver' : ["ar", "-cr"],
333 - 'ranlib' : None,
334 + executables = {'preprocessor' : None,
335 + 'compiler' : ["cc"],
336 + 'compiler_so' : ["cc"],
337 + 'compiler_cxx' : ["c++"],
338 + 'compiler_so_cxx' : ["c++"],
339 + 'linker_so' : ["cc", "-shared"],
340 + 'linker_exe' : ["cc"],
341 + 'linker_so_cxx' : ["c++", "-shared"],
342 + 'linker_exe_cxx' : ["c++"],
343 + 'archiver' : ["ar", "-cr"],
344 + 'ranlib' : None,
345 }
346
347 if sys.platform[:6] == "darwin":
348 @@ -186,11 +189,18 @@
349
350 def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
351 compiler_so = self.compiler_so
352 + compiler_so_cxx = self.compiler_so_cxx
353 if sys.platform == 'darwin':
354 compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
355 + compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args +
356 + extra_postargs)
357 try:
358 - self.spawn(compiler_so + cc_args + [src, '-o', obj] +
359 - extra_postargs)
360 + if self.detect_language(src) == 'c++':
361 + self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
362 + extra_postargs)
363 + else:
364 + self.spawn(compiler_so + cc_args + [src, '-o', obj] +
365 + extra_postargs)
366 except DistutilsExecError, msg:
367 raise CompileError, msg
368
369 @@ -247,23 +257,16 @@
370 ld_args.extend(extra_postargs)
371 self.mkpath(os.path.dirname(output_filename))
372 try:
373 - if target_desc == CCompiler.EXECUTABLE:
374 - linker = self.linker_exe[:]
375 + if target_lang == "c++":
376 + if target_desc == CCompiler.EXECUTABLE:
377 + linker = self.linker_exe_cxx[:]
378 + else:
379 + linker = self.linker_so_cxx[:]
380 else:
381 - linker = self.linker_so[:]
382 - if target_lang == "c++" and self.compiler_cxx:
383 - # skip over environment variable settings if /usr/bin/env
384 - # is used to set up the linker's environment.
385 - # This is needed on OSX. Note: this assumes that the
386 - # normal and C++ compiler have the same environment
387 - # settings.
388 - i = 0
389 - if os.path.basename(linker[0]) == "env":
390 - i = 1
391 - while '=' in linker[i]:
392 - i = i + 1
393 -
394 - linker[i] = self.compiler_cxx[i]
395 + if target_desc == CCompiler.EXECUTABLE:
396 + linker = self.linker_exe[:]
397 + else:
398 + linker = self.linker_so[:]
399
400 if sys.platform == 'darwin':
401 linker = _darwin_compiler_fixup(linker, ld_args)
402
403
404
405 1.1 dev-python/pypy/files/pypy-1.7-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
406
407 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pypy/files/pypy-1.7-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch?rev=1.1&view=markup
408 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pypy/files/pypy-1.7-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch?rev=1.1&content-type=text/plain
409
410 Index: pypy-1.7-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
411 ===================================================================
412 --- lib-python/modified-2.7/distutils/unixccompiler.py
413 +++ lib-python/modified-2.7/distutils/unixccompiler.py
414 @@ -297,7 +297,7 @@
415 # this time, there's no way to determine this information from
416 # the configuration data stored in the Python installation, so
417 # we use this hack.
418 - compiler = os.path.basename(sysconfig.get_config_var("CC"))
419 + compiler = os.path.basename(self.compiler[0])
420 if sys.platform[:6] == "darwin":
421 # MacOSX's linker doesn't understand the -R flag at all
422 return "-L" + dir