Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3/, dev-python/pypy3/files/
Date: Sun, 20 Dec 2015 22:03:13
Message-Id: 1450648971.0dd2eb79f9fe0834698bc21203ad6c8969a10be1.mgorny@gentoo
1 commit: 0dd2eb79f9fe0834698bc21203ad6c8969a10be1
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 20 22:01:52 2015 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 20 22:02:51 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0dd2eb79
7
8 dev-python/pypy3: Add an updated distutils/C++ patch
9
10 dev-python/pypy3/files/21_all_distutils_c++.patch | 251 ++++++++++++++++++++++
11 dev-python/pypy3/pypy3-9999.ebuild | 5 +
12 2 files changed, 256 insertions(+)
13
14 diff --git a/dev-python/pypy3/files/21_all_distutils_c++.patch b/dev-python/pypy3/files/21_all_distutils_c++.patch
15 new file mode 100644
16 index 0000000..f12df8a
17 --- /dev/null
18 +++ b/dev-python/pypy3/files/21_all_distutils_c++.patch
19 @@ -0,0 +1,251 @@
20 +http://bugs.python.org/issue1222585
21 +
22 +--- Lib/distutils/cygwinccompiler.py
23 ++++ Lib/distutils/cygwinccompiler.py
24 +@@ -136,9 +136,13 @@
25 + self.set_executables(compiler='gcc -mcygwin -O -Wall',
26 + compiler_so='gcc -mcygwin -mdll -O -Wall',
27 + compiler_cxx='g++ -mcygwin -O -Wall',
28 ++ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
29 + linker_exe='gcc -mcygwin',
30 + linker_so=('%s -mcygwin %s' %
31 +- (self.linker_dll, shared_option)))
32 ++ (self.linker_dll, shared_option)),
33 ++ linker_exe_cxx='g++ -mcygwin',
34 ++ linker_so_cxx=('%s -mcygwin %s' %
35 ++ (self.linker_dll, shared_option)))
36 +
37 + # cygwin and mingw32 need different sets of libraries
38 + if self.gcc_version == "2.91.57":
39 +@@ -162,8 +166,12 @@
40 + raise CompileError(msg)
41 + else: # for other files use the C-compiler
42 + try:
43 +- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
44 +- extra_postargs)
45 ++ if self.detect_language(src) == 'c++':
46 ++ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
47 ++ extra_postargs)
48 ++ else:
49 ++ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
50 ++ extra_postargs)
51 + except DistutilsExecError as msg:
52 + raise CompileError(msg)
53 +
54 +@@ -294,10 +302,15 @@
55 + self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
56 + compiler_so='gcc -mno-cygwin -mdll -O -Wall',
57 + compiler_cxx='g++ -mno-cygwin -O -Wall',
58 ++ compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
59 + linker_exe='gcc -mno-cygwin',
60 + linker_so='%s -mno-cygwin %s %s'
61 + % (self.linker_dll, shared_option,
62 +- entry_point))
63 ++ entry_point),
64 ++ linker_exe_cxx='g++ -mno-cygwin',
65 ++ linker_so_cxx='%s -mno-cygwin %s %s'
66 ++ % (self.linker_dll, shared_option,
67 ++ entry_point))
68 + # Maybe we should also append -mthreads, but then the finished
69 + # dlls need another dll (mingwm10.dll see Mingw32 docs)
70 + # (-mthreads: Support thread-safe exception handling on `Mingw32')
71 +--- Lib/distutils/emxccompiler.py
72 ++++ Lib/distutils/emxccompiler.py
73 +@@ -63,8 +63,12 @@
74 + # XXX optimization, warnings etc. should be customizable.
75 + self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
76 + compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
77 ++ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
78 ++ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
79 + linker_exe='gcc -Zomf -Zmt -Zcrtdll',
80 +- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
81 ++ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
82 ++ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
83 ++ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
84 +
85 + # want the gcc library statically linked (so that we don't have
86 + # to distribute a version dependent on the compiler we have)
87 +@@ -81,8 +85,12 @@
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 +--- Lib/distutils/sysconfig_cpython.py
103 ++++ Lib/distutils/sysconfig_cpython.py
104 +@@ -170,9 +170,12 @@
105 + _osx_support.customize_compiler(_config_vars)
106 + _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
107 +
108 +- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
109 +- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
110 +- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
111 ++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
112 ++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
113 ++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
114 ++
115 ++ cflags = ''
116 ++ cxxflags = ''
117 +
118 + newcc = None
119 + if 'CC' in os.environ:
120 +@@ -181,19 +184,27 @@
121 + cxx = os.environ['CXX']
122 + if 'LDSHARED' in os.environ:
123 + ldshared = os.environ['LDSHARED']
124 ++ if 'LDCXXSHARED' in os.environ:
125 ++ ldcxxshared = os.environ['LDCXXSHARED']
126 + if 'CPP' in os.environ:
127 + cpp = os.environ['CPP']
128 + else:
129 + cpp = cc + " -E" # not always
130 + if 'LDFLAGS' in os.environ:
131 + ldshared = ldshared + ' ' + os.environ['LDFLAGS']
132 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
133 + if 'CFLAGS' in os.environ:
134 +- cflags = opt + ' ' + os.environ['CFLAGS']
135 ++ cflags = os.environ['CFLAGS']
136 + ldshared = ldshared + ' ' + os.environ['CFLAGS']
137 ++ if 'CXXFLAGS' in os.environ:
138 ++ cxxflags = os.environ['CXXFLAGS']
139 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
140 + if 'CPPFLAGS' in os.environ:
141 + cpp = cpp + ' ' + os.environ['CPPFLAGS']
142 + cflags = cflags + ' ' + os.environ['CPPFLAGS']
143 ++ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
144 + ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
145 ++ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
146 + if 'AR' in os.environ:
147 + ar = os.environ['AR']
148 + if 'ARFLAGS' in os.environ:
149 +@@ -202,13 +213,17 @@
150 + archiver = ar + ' ' + ar_flags
151 +
152 + cc_cmd = cc + ' ' + cflags
153 ++ cxx_cmd = cxx + ' ' + cxxflags
154 + compiler.set_executables(
155 + preprocessor=cpp,
156 + compiler=cc_cmd,
157 + compiler_so=cc_cmd + ' ' + ccshared,
158 +- compiler_cxx=cxx,
159 ++ compiler_cxx=cxx_cmd,
160 ++ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
161 + linker_so=ldshared,
162 + linker_exe=cc,
163 ++ linker_so_cxx=ldcxxshared,
164 ++ linker_exe_cxx=cxx,
165 + archiver=archiver)
166 +
167 + compiler.shared_lib_extension = shlib_suffix
168 +--- Lib/distutils/unixccompiler.py
169 ++++ Lib/distutils/unixccompiler.py
170 +@@ -52,14 +52,17 @@
171 + # are pretty generic; they will probably have to be set by an outsider
172 + # (eg. using information discovered by the sysconfig about building
173 + # Python extensions).
174 +- executables = {'preprocessor' : None,
175 +- 'compiler' : ["cc"],
176 +- 'compiler_so' : ["cc"],
177 +- 'compiler_cxx' : ["c++"], # pypy: changed, 'cc' is bogus
178 +- 'linker_so' : ["cc", "-shared"],
179 +- 'linker_exe' : ["cc"],
180 +- 'archiver' : ["ar", "-cr"],
181 +- 'ranlib' : None,
182 ++ executables = {'preprocessor' : None,
183 ++ 'compiler' : ["cc"],
184 ++ 'compiler_so' : ["cc"],
185 ++ 'compiler_cxx' : ["c++"],
186 ++ 'compiler_so_cxx' : ["c++"],
187 ++ 'linker_so' : ["cc", "-shared"],
188 ++ 'linker_exe' : ["cc"],
189 ++ 'linker_so_cxx' : ["c++", "-shared"],
190 ++ 'linker_exe_cxx' : ["c++"],
191 ++ 'archiver' : ["ar", "-cr"],
192 ++ 'ranlib' : None,
193 + }
194 +
195 + if sys.platform[:6] == "darwin":
196 +@@ -108,12 +111,19 @@
197 +
198 + def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
199 + compiler_so = self.compiler_so
200 ++ compiler_so_cxx = self.compiler_so_cxx
201 + if sys.platform == 'darwin':
202 + compiler_so = _osx_support.compiler_fixup(compiler_so,
203 + cc_args + extra_postargs)
204 ++ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
205 ++ cc_args + extra_postargs)
206 + try:
207 +- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
208 +- extra_postargs)
209 ++ if self.detect_language(src) == 'c++':
210 ++ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
211 ++ extra_postargs)
212 ++ else:
213 ++ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
214 ++ extra_postargs)
215 + except DistutilsExecError as msg:
216 + raise CompileError(msg)
217 +
218 +@@ -171,22 +181,16 @@
219 + ld_args.extend(extra_postargs)
220 + self.mkpath(os.path.dirname(output_filename))
221 + try:
222 +- if target_desc == CCompiler.EXECUTABLE:
223 +- linker = self.linker_exe[:]
224 ++ if target_lang == "c++":
225 ++ if target_desc == CCompiler.EXECUTABLE:
226 ++ linker = self.linker_exe_cxx[:]
227 ++ else:
228 ++ linker = self.linker_so_cxx[:]
229 + else:
230 +- linker = self.linker_so[:]
231 +- if target_lang == "c++" and self.compiler_cxx:
232 +- # skip over environment variable settings if /usr/bin/env
233 +- # is used to set up the linker's environment.
234 +- # This is needed on OSX. Note: this assumes that the
235 +- # normal and C++ compiler have the same environment
236 +- # settings.
237 +- i = 0
238 +- if os.path.basename(linker[0]) == "env":
239 +- i = 1
240 +- while '=' in linker[i]:
241 +- i += 1
242 +- linker[i] = self.compiler_cxx[i]
243 ++ if target_desc == CCompiler.EXECUTABLE:
244 ++ linker = self.linker_exe[:]
245 ++ else:
246 ++ linker = self.linker_so[:]
247 +
248 + if sys.platform == 'darwin':
249 + linker = _osx_support.compiler_fixup(linker, ld_args)
250 +--- Lib/_osx_support.py
251 ++++ Lib/_osx_support.py
252 +@@ -14,13 +14,13 @@
253 + # configuration variables that may contain universal build flags,
254 + # like "-arch" or "-isdkroot", that may need customization for
255 + # the user environment
256 +-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
257 +- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
258 +- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
259 +- 'PY_CORE_CFLAGS')
260 ++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
261 ++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
262 ++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
263 ++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
264 +
265 + # configuration variables that may contain compiler calls
266 +-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
267 ++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
268 +
269 + # prefix added to original configuration variable names
270 + _INITPRE = '_OSX_SUPPORT_INITIAL_'
271
272 diff --git a/dev-python/pypy3/pypy3-9999.ebuild b/dev-python/pypy3/pypy3-9999.ebuild
273 index a335b0f..73bd159 100644
274 --- a/dev-python/pypy3/pypy3-9999.ebuild
275 +++ b/dev-python/pypy3/pypy3-9999.ebuild
276 @@ -88,6 +88,11 @@ src_prepare() {
277 -e "s^@libdir@^$(get_libdir)^" \
278 -i lib-python/3/distutils/command/install.py || die
279
280 + # apply CPython stdlib patches
281 + pushd lib-python/3 > /dev/null || die
282 + epatch "${FILESDIR}"/21_all_distutils_c++.patch
283 + popd > /dev/null || die
284 +
285 epatch_user
286 }