1 |
commit: de2429b416e556af4cec2cf05da1ede52cb6a473 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 24 20:14:35 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 25 21:49:15 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de2429b4 |
7 |
|
8 |
dev-python/pypy3: Update the distutils C++ patch |
9 |
|
10 |
.../pypy3/files/5.7.1_all_distutils_cxx.patch | 342 +++++++++++++++++++++ |
11 |
dev-python/pypy3/pypy3-9999.ebuild | 2 +- |
12 |
2 files changed, 343 insertions(+), 1 deletion(-) |
13 |
|
14 |
diff --git a/dev-python/pypy3/files/5.7.1_all_distutils_cxx.patch b/dev-python/pypy3/files/5.7.1_all_distutils_cxx.patch |
15 |
new file mode 100644 |
16 |
index 00000000000..52a833f29d9 |
17 |
--- /dev/null |
18 |
+++ b/dev-python/pypy3/files/5.7.1_all_distutils_cxx.patch |
19 |
@@ -0,0 +1,342 @@ |
20 |
+From b2f2c9d23996d431d606ac7d8ed731a5302b4e97 Mon Sep 17 00:00:00 2001 |
21 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
22 |
+Date: Tue, 25 Apr 2017 17:42:33 +0200 |
23 |
+Subject: [PATCH] Fancy distutils C++ support, rebased for PyPy3.5 |
24 |
+ |
25 |
+https://bugs.python.org/issue1222585 |
26 |
+--- |
27 |
+ _osx_support.py | 10 +++--- |
28 |
+ distutils/cygwinccompiler.py | 21 +++++++++-- |
29 |
+ distutils/sysconfig_cpython.py | 25 ++++++++++--- |
30 |
+ distutils/sysconfig_pypy.py | 35 +++++++++++++++---- |
31 |
+ distutils/unixccompiler.py | 54 ++++++++++++++++------------- |
32 |
+ 5 files changed, 100 insertions(+), 45 deletions(-) |
33 |
+ |
34 |
+diff --git a/_osx_support.py b/_osx_support.py |
35 |
+index 13fcd8b..0525be1 100644 |
36 |
+--- a/_osx_support.py |
37 |
++++ b/_osx_support.py |
38 |
+@@ -14,13 +14,13 @@ __all__ = [ |
39 |
+ # configuration variables that may contain universal build flags, |
40 |
+ # like "-arch" or "-isdkroot", that may need customization for |
41 |
+ # the user environment |
42 |
+-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS', |
43 |
+- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX', |
44 |
+- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS', |
45 |
+- 'PY_CORE_CFLAGS') |
46 |
++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', |
47 |
++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED', |
48 |
++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS', |
49 |
++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS') |
50 |
+ |
51 |
+ # configuration variables that may contain compiler calls |
52 |
+-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX') |
53 |
++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX') |
54 |
+ |
55 |
+ # prefix added to original configuration variable names |
56 |
+ _INITPRE = '_OSX_SUPPORT_INITIAL_' |
57 |
+diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py |
58 |
+index c879646..a6157fb 100644 |
59 |
+--- a/distutils/cygwinccompiler.py |
60 |
++++ b/distutils/cygwinccompiler.py |
61 |
+@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler): |
62 |
+ # dllwrap 2.10.90 is buggy |
63 |
+ if self.ld_version >= "2.10.90": |
64 |
+ self.linker_dll = "gcc" |
65 |
++ self.linker_dll_cxx = "g++" |
66 |
+ else: |
67 |
+ self.linker_dll = "dllwrap" |
68 |
++ self.linker_dll_cxx = "dllwrap" |
69 |
+ |
70 |
+ # ld_version >= "2.13" support -shared so use it instead of |
71 |
+ # -mdll -static |
72 |
+@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler): |
73 |
+ self.set_executables(compiler='gcc -mcygwin -O -Wall', |
74 |
+ compiler_so='gcc -mcygwin -mdll -O -Wall', |
75 |
+ compiler_cxx='g++ -mcygwin -O -Wall', |
76 |
++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall', |
77 |
+ linker_exe='gcc -mcygwin', |
78 |
+ linker_so=('%s -mcygwin %s' % |
79 |
+- (self.linker_dll, shared_option))) |
80 |
++ (self.linker_dll, shared_option)), |
81 |
++ linker_exe_cxx='g++ -mcygwin', |
82 |
++ linker_so_cxx=('%s -mcygwin %s' % |
83 |
++ (self.linker_dll_cxx, shared_option))) |
84 |
+ |
85 |
+ # cygwin and mingw32 need different sets of libraries |
86 |
+ if self.gcc_version == "2.91.57": |
87 |
+@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler): |
88 |
+ raise CompileError(msg) |
89 |
+ else: # for other files use the C-compiler |
90 |
+ try: |
91 |
+- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + |
92 |
+- extra_postargs) |
93 |
++ if self.detect_language(src) == 'c++': |
94 |
++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] + |
95 |
++ extra_postargs) |
96 |
++ else: |
97 |
++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] + |
98 |
++ extra_postargs) |
99 |
+ except DistutilsExecError as msg: |
100 |
+ raise CompileError(msg) |
101 |
+ |
102 |
+@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler): |
103 |
+ self.set_executables(compiler='gcc -O -Wall', |
104 |
+ compiler_so='gcc -mdll -O -Wall', |
105 |
+ compiler_cxx='g++ -O -Wall', |
106 |
++ compiler_so_cxx='g++ -mdll -O -Wall', |
107 |
+ linker_exe='gcc', |
108 |
+ linker_so='%s %s %s' |
109 |
+ % (self.linker_dll, shared_option, |
110 |
++ entry_point), |
111 |
++ linker_exe_cxx='g++', |
112 |
++ linker_so_cxx='%s %s %s' |
113 |
++ % (self.linker_dll_cxx, shared_option, |
114 |
+ entry_point)) |
115 |
+ # Maybe we should also append -mthreads, but then the finished |
116 |
+ # dlls need another dll (mingwm10.dll see Mingw32 docs) |
117 |
+diff --git a/distutils/sysconfig_cpython.py b/distutils/sysconfig_cpython.py |
118 |
+index 573724d..0a04f33 100644 |
119 |
+--- a/distutils/sysconfig_cpython.py |
120 |
++++ b/distutils/sysconfig_cpython.py |
121 |
+@@ -173,9 +173,12 @@ def customize_compiler(compiler): |
122 |
+ _osx_support.customize_compiler(_config_vars) |
123 |
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' |
124 |
+ |
125 |
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ |
126 |
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', |
127 |
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') |
128 |
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ |
129 |
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', |
130 |
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') |
131 |
++ |
132 |
++ cflags = '' |
133 |
++ cxxflags = '' |
134 |
+ |
135 |
+ if 'CC' in os.environ: |
136 |
+ newcc = os.environ['CC'] |
137 |
+@@ -190,19 +193,27 @@ def customize_compiler(compiler): |
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 = opt + ' ' + os.environ['CFLAGS'] |
152 |
++ cflags = os.environ['CFLAGS'] |
153 |
+ ldshared = ldshared + ' ' + os.environ['CFLAGS'] |
154 |
++ if 'CXXFLAGS' in os.environ: |
155 |
++ cxxflags = os.environ['CXXFLAGS'] |
156 |
++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] |
157 |
+ if 'CPPFLAGS' in os.environ: |
158 |
+ cpp = cpp + ' ' + os.environ['CPPFLAGS'] |
159 |
+ cflags = cflags + ' ' + os.environ['CPPFLAGS'] |
160 |
++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] |
161 |
+ ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] |
162 |
++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] |
163 |
+ if 'AR' in os.environ: |
164 |
+ ar = os.environ['AR'] |
165 |
+ if 'ARFLAGS' in os.environ: |
166 |
+@@ -211,13 +222,17 @@ def customize_compiler(compiler): |
167 |
+ archiver = ar + ' ' + ar_flags |
168 |
+ |
169 |
+ cc_cmd = cc + ' ' + cflags |
170 |
++ cxx_cmd = cxx + ' ' + cxxflags |
171 |
+ compiler.set_executables( |
172 |
+ preprocessor=cpp, |
173 |
+ compiler=cc_cmd, |
174 |
+ compiler_so=cc_cmd + ' ' + ccshared, |
175 |
+- compiler_cxx=cxx, |
176 |
++ compiler_cxx=cxx_cmd, |
177 |
++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, |
178 |
+ linker_so=ldshared, |
179 |
+ linker_exe=cc, |
180 |
++ linker_so_cxx=ldcxxshared, |
181 |
++ linker_exe_cxx=cxx, |
182 |
+ archiver=archiver) |
183 |
+ |
184 |
+ compiler.shared_lib_extension = shlib_suffix |
185 |
+diff --git a/distutils/sysconfig_pypy.py b/distutils/sysconfig_pypy.py |
186 |
+index a0a8dec..aa97c4e 100644 |
187 |
+--- a/distutils/sysconfig_pypy.py |
188 |
++++ b/distutils/sysconfig_pypy.py |
189 |
+@@ -72,6 +72,7 @@ def _init_posix(): |
190 |
+ g['CFLAGS'] = "-DNDEBUG -O2" |
191 |
+ g['CCSHARED'] = "-fPIC" |
192 |
+ g['LDSHARED'] = "gcc -pthread -shared" |
193 |
++ g['LDCXXSHARED'] = "g++ -pthread -shared" |
194 |
+ g['EXT_SUFFIX'] = so_ext |
195 |
+ g['SHLIB_SUFFIX'] = so_ext |
196 |
+ g['SO'] = so_ext # deprecated in Python 3, for backward compatibility |
197 |
+@@ -156,36 +157,52 @@ def customize_compiler(compiler): |
198 |
+ _osx_support.customize_compiler(_config_vars) |
199 |
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True' |
200 |
+ |
201 |
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \ |
202 |
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', |
203 |
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') |
204 |
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \ |
205 |
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED', |
206 |
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS') |
207 |
++ |
208 |
++ cflags = '' |
209 |
++ cxxflags = '' |
210 |
+ |
211 |
+ if 'CC' in os.environ: |
212 |
+ newcc = os.environ['CC'] |
213 |
+- if (sys.platform == 'darwin' |
214 |
++ if (True |
215 |
+ and 'LDSHARED' not in os.environ |
216 |
+ and ldshared.startswith(cc)): |
217 |
+ # On OS X, if CC is overridden, use that as the default |
218 |
+ # command for LDSHARED as well |
219 |
++ # Gentoo: s/OS X/every system/ |
220 |
+ ldshared = newcc + ldshared[len(cc):] |
221 |
+ cc = newcc |
222 |
+ if 'CXX' in os.environ: |
223 |
+- cxx = os.environ['CXX'] |
224 |
++ newcxx = os.environ['CXX'] |
225 |
++ if ('LDCXXSHARED' not in os.environ |
226 |
++ and ldcxxshared.startswith(cxx)): |
227 |
++ ldcxxshared = newcxx + ldcxxshared[len(cxx):] |
228 |
++ cxx = newcxx |
229 |
+ if 'LDSHARED' in os.environ: |
230 |
+ ldshared = os.environ['LDSHARED'] |
231 |
++ if 'LDCXXSHARED' in os.environ: |
232 |
++ ldcxxshared = os.environ['LDCXXSHARED'] |
233 |
+ if 'CPP' in os.environ: |
234 |
+ cpp = os.environ['CPP'] |
235 |
+ else: |
236 |
+ cpp = cc + " -E" # not always |
237 |
+ if 'LDFLAGS' in os.environ: |
238 |
+ ldshared = ldshared + ' ' + os.environ['LDFLAGS'] |
239 |
++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] |
240 |
+ if 'CFLAGS' in os.environ: |
241 |
+- cflags = opt + ' ' + os.environ['CFLAGS'] |
242 |
++ cflags = os.environ['CFLAGS'] |
243 |
+ ldshared = ldshared + ' ' + os.environ['CFLAGS'] |
244 |
++ if 'CXXFLAGS' in os.environ: |
245 |
++ cxxflags = os.environ['CXXFLAGS'] |
246 |
++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS'] |
247 |
+ if 'CPPFLAGS' in os.environ: |
248 |
+ cpp = cpp + ' ' + os.environ['CPPFLAGS'] |
249 |
+ cflags = cflags + ' ' + os.environ['CPPFLAGS'] |
250 |
++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS'] |
251 |
+ ldshared = ldshared + ' ' + os.environ['CPPFLAGS'] |
252 |
++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS'] |
253 |
+ if 'AR' in os.environ: |
254 |
+ ar = os.environ['AR'] |
255 |
+ if 'ARFLAGS' in os.environ: |
256 |
+@@ -194,13 +211,17 @@ def customize_compiler(compiler): |
257 |
+ archiver = ar + ' ' + ar_flags |
258 |
+ |
259 |
+ cc_cmd = cc + ' ' + cflags |
260 |
++ cxx_cmd = cxx + ' ' + cxxflags |
261 |
+ compiler.set_executables( |
262 |
+ preprocessor=cpp, |
263 |
+ compiler=cc_cmd, |
264 |
+ compiler_so=cc_cmd + ' ' + ccshared, |
265 |
+- compiler_cxx=cxx, |
266 |
++ compiler_cxx=cxx_cmd, |
267 |
++ compiler_so_cxx=cxx_cmd + ' ' + ccshared, |
268 |
+ linker_so=ldshared, |
269 |
+ linker_exe=cc, |
270 |
++ linker_so_cxx=ldcxxshared, |
271 |
++ linker_exe_cxx=cxx, |
272 |
+ archiver=archiver) |
273 |
+ |
274 |
+ compiler.shared_lib_extension = shlib_suffix |
275 |
+diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py |
276 |
+index 254b22d..c9cacc1 100644 |
277 |
+--- a/distutils/unixccompiler.py |
278 |
++++ b/distutils/unixccompiler.py |
279 |
+@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler): |
280 |
+ # are pretty generic; they will probably have to be set by an outsider |
281 |
+ # (eg. using information discovered by the sysconfig about building |
282 |
+ # Python extensions). |
283 |
+- executables = {'preprocessor' : None, |
284 |
+- 'compiler' : ["cc"], |
285 |
+- 'compiler_so' : ["cc"], |
286 |
+- 'compiler_cxx' : ["c++"], # pypy: changed, 'cc' is bogus |
287 |
+- 'linker_so' : ["cc", "-shared"], |
288 |
+- 'linker_exe' : ["cc"], |
289 |
+- 'archiver' : ["ar", "-cr"], |
290 |
+- 'ranlib' : None, |
291 |
++ executables = {'preprocessor' : None, |
292 |
++ 'compiler' : ["cc"], |
293 |
++ 'compiler_so' : ["cc"], |
294 |
++ 'compiler_cxx' : ["c++"], |
295 |
++ 'compiler_so_cxx' : ["c++"], |
296 |
++ 'linker_so' : ["cc", "-shared"], |
297 |
++ 'linker_exe' : ["cc"], |
298 |
++ 'linker_so_cxx' : ["c++", "-shared"], |
299 |
++ 'linker_exe_cxx' : ["c++"], |
300 |
++ 'archiver' : ["ar", "-cr"], |
301 |
++ 'ranlib' : None, |
302 |
+ } |
303 |
+ |
304 |
+ if sys.platform[:6] == "darwin": |
305 |
+@@ -125,12 +128,19 @@ class UnixCCompiler(CCompiler): |
306 |
+ |
307 |
+ def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): |
308 |
+ compiler_so = self.compiler_so |
309 |
++ compiler_so_cxx = self.compiler_so_cxx |
310 |
+ if sys.platform == 'darwin': |
311 |
+ compiler_so = _osx_support.compiler_fixup(compiler_so, |
312 |
+ cc_args + extra_postargs) |
313 |
++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx, |
314 |
++ cc_args + extra_postargs) |
315 |
+ try: |
316 |
+- self.spawn(compiler_so + cc_args + [src, '-o', obj] + |
317 |
+- extra_postargs) |
318 |
++ if self.detect_language(src) == 'c++': |
319 |
++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] + |
320 |
++ extra_postargs) |
321 |
++ else: |
322 |
++ self.spawn(compiler_so + cc_args + [src, '-o', obj] + |
323 |
++ extra_postargs) |
324 |
+ except DistutilsExecError as msg: |
325 |
+ raise CompileError(msg) |
326 |
+ |
327 |
+@@ -188,22 +198,16 @@ class UnixCCompiler(CCompiler): |
328 |
+ ld_args.extend(extra_postargs) |
329 |
+ self.mkpath(os.path.dirname(output_filename)) |
330 |
+ try: |
331 |
+- if target_desc == CCompiler.EXECUTABLE: |
332 |
+- linker = self.linker_exe[:] |
333 |
++ if target_lang == "c++": |
334 |
++ if target_desc == CCompiler.EXECUTABLE: |
335 |
++ linker = self.linker_exe_cxx[:] |
336 |
++ else: |
337 |
++ linker = self.linker_so_cxx[:] |
338 |
+ else: |
339 |
+- linker = self.linker_so[:] |
340 |
+- if target_lang == "c++" and self.compiler_cxx: |
341 |
+- # skip over environment variable settings if /usr/bin/env |
342 |
+- # is used to set up the linker's environment. |
343 |
+- # This is needed on OSX. Note: this assumes that the |
344 |
+- # normal and C++ compiler have the same environment |
345 |
+- # settings. |
346 |
+- i = 0 |
347 |
+- if os.path.basename(linker[0]) == "env": |
348 |
+- i = 1 |
349 |
+- while '=' in linker[i]: |
350 |
+- i += 1 |
351 |
+- linker[i] = self.compiler_cxx[i] |
352 |
++ if target_desc == CCompiler.EXECUTABLE: |
353 |
++ linker = self.linker_exe[:] |
354 |
++ else: |
355 |
++ linker = self.linker_so[:] |
356 |
+ |
357 |
+ if sys.platform == 'darwin': |
358 |
+ linker = _osx_support.compiler_fixup(linker, ld_args) |
359 |
+-- |
360 |
+2.12.2 |
361 |
+ |
362 |
|
363 |
diff --git a/dev-python/pypy3/pypy3-9999.ebuild b/dev-python/pypy3/pypy3-9999.ebuild |
364 |
index 315b209ae38..e192a166b39 100644 |
365 |
--- a/dev-python/pypy3/pypy3-9999.ebuild |
366 |
+++ b/dev-python/pypy3/pypy3-9999.ebuild |
367 |
@@ -96,7 +96,7 @@ src_prepare() { |
368 |
|
369 |
# apply CPython stdlib patches |
370 |
pushd lib-python/3 > /dev/null || die |
371 |
- epatch "${FILESDIR}"/5.2.0-distutils-c++.patch \ |
372 |
+ epatch "${FILESDIR}"/5.7.1_all_distutils_cxx.patch \ |
373 |
"${WORKDIR}"/patches/24_all_sqlite-3.8.4.patch |
374 |
popd > /dev/null || die |