Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit 6c295c0

Browse files
committed
fixed problems with Makefile on x86_64, patches from gentoo added
1 parent 5943e3c commit 6c295c0

6 files changed

Lines changed: 621 additions & 36 deletions

python3-distutils-cxx.patch

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
diff -r d9893d13c628 Lib/_osx_support.py
2+
--- a/Lib/_osx_support.py Sat Apr 06 09:40:02 2013 +0200
3+
+++ b/Lib/_osx_support.py Sat Apr 27 16:51:50 2013 -0700
4+
@@ -14,7 +14,7 @@
5+
# configuration variables that may contain universal build flags,
6+
# like "-arch" or "-isdkroot", that may need customization for
7+
# the user environment
8+
-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
9+
+_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
10+
'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
11+
'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
12+
'PY_CORE_CFLAGS')
13+
diff -r d9893d13c628 Lib/distutils/cygwinccompiler.py
14+
--- a/Lib/distutils/cygwinccompiler.py Sat Apr 06 09:40:02 2013 +0200
15+
+++ b/Lib/distutils/cygwinccompiler.py Sat Apr 27 16:51:50 2013 -0700
16+
@@ -139,9 +139,13 @@
17+
self.set_executables(compiler='gcc -mcygwin -O -Wall',
18+
compiler_so='gcc -mcygwin -mdll -O -Wall',
19+
compiler_cxx='g++ -mcygwin -O -Wall',
20+
+ compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
21+
linker_exe='gcc -mcygwin',
22+
linker_so=('%s -mcygwin %s' %
23+
- (self.linker_dll, shared_option)))
24+
+ (self.linker_dll, shared_option)),
25+
+ linker_exe_cxx='g++ -mcygwin',
26+
+ linker_so_cxx=('%s -mcygwin %s' %
27+
+ (self.linker_dll, shared_option)))
28+
29+
# cygwin and mingw32 need different sets of libraries
30+
if self.gcc_version == "2.91.57":
31+
@@ -165,8 +169,12 @@
32+
raise CompileError(msg)
33+
else: # for other files use the C-compiler
34+
try:
35+
- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
36+
- extra_postargs)
37+
+ if self.detect_language(src) == 'c++':
38+
+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
39+
+ extra_postargs)
40+
+ else:
41+
+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
42+
+ extra_postargs)
43+
except DistutilsExecError as msg:
44+
raise CompileError(msg)
45+
46+
@@ -297,10 +305,15 @@
47+
self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
48+
compiler_so='gcc -mno-cygwin -mdll -O -Wall',
49+
compiler_cxx='g++ -mno-cygwin -O -Wall',
50+
+ compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
51+
linker_exe='gcc -mno-cygwin',
52+
linker_so='%s -mno-cygwin %s %s'
53+
% (self.linker_dll, shared_option,
54+
- entry_point))
55+
+ entry_point),
56+
+ linker_exe_cxx='g++ -mno-cygwin',
57+
+ linker_so_cxx='%s -mno-cygwin %s %s'
58+
+ % (self.linker_dll, shared_option,
59+
+ entry_point))
60+
# Maybe we should also append -mthreads, but then the finished
61+
# dlls need another dll (mingwm10.dll see Mingw32 docs)
62+
# (-mthreads: Support thread-safe exception handling on `Mingw32')
63+
diff -r d9893d13c628 Lib/distutils/emxccompiler.py
64+
--- a/Lib/distutils/emxccompiler.py Sat Apr 06 09:40:02 2013 +0200
65+
+++ b/Lib/distutils/emxccompiler.py Sat Apr 27 16:51:50 2013 -0700
66+
@@ -63,8 +63,12 @@
67+
# XXX optimization, warnings etc. should be customizable.
68+
self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
69+
compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
70+
+ compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
71+
+ compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
72+
linker_exe='gcc -Zomf -Zmt -Zcrtdll',
73+
- linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
74+
+ linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
75+
+ linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
76+
+ linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
77+
78+
# want the gcc library statically linked (so that we don't have
79+
# to distribute a version dependent on the compiler we have)
80+
@@ -81,8 +85,12 @@
81+
raise CompileError(msg)
82+
else: # for other files use the C-compiler
83+
try:
84+
- self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
85+
- extra_postargs)
86+
+ if self.detect_language(src) == 'c++':
87+
+ self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
88+
+ extra_postargs)
89+
+ else:
90+
+ self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
91+
+ extra_postargs)
92+
except DistutilsExecError as msg:
93+
raise CompileError(msg)
94+
95+
diff -r d9893d13c628 Lib/distutils/sysconfig.py
96+
--- a/Lib/distutils/sysconfig.py Sat Apr 06 09:40:02 2013 +0200
97+
+++ b/Lib/distutils/sysconfig.py Sat Apr 27 16:51:50 2013 -0700
98+
@@ -191,10 +191,12 @@
99+
_osx_support.customize_compiler(_config_vars)
100+
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
101+
102+
- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
103+
- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
104+
- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
105+
+ (cc, cxx, opt, cflags, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
106+
+ get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS', 'CCSHARED', 'LDSHARED',
107+
+ 'LDCXXSHARED', 'SO', 'AR', 'ARFLAGS')
108+
109+
+ cflags = ''
110+
+ cxxflags = ''
111+
newcc = None
112+
if 'CC' in os.environ:
113+
cc = os.environ['CC']
114+
@@ -202,19 +204,27 @@
115+
cxx = os.environ['CXX']
116+
if 'LDSHARED' in os.environ:
117+
ldshared = os.environ['LDSHARED']
118+
+ if 'LDCXXSHARED' in os.environ:
119+
+ ldcxxshared = os.environ['LDCXXSHARED']
120+
if 'CPP' in os.environ:
121+
cpp = os.environ['CPP']
122+
else:
123+
cpp = cc + " -E" # not always
124+
if 'LDFLAGS' in os.environ:
125+
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
126+
+ ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
127+
if 'CFLAGS' in os.environ:
128+
- cflags = opt + ' ' + os.environ['CFLAGS']
129+
+ cflags = os.environ['CFLAGS']
130+
ldshared = ldshared + ' ' + os.environ['CFLAGS']
131+
+ if 'CXXFLAGS' in os.environ:
132+
+ cxxflags = os.environ['CXXFLAGS']
133+
+ ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
134+
if 'CPPFLAGS' in os.environ:
135+
cpp = cpp + ' ' + os.environ['CPPFLAGS']
136+
cflags = cflags + ' ' + os.environ['CPPFLAGS']
137+
+ cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
138+
ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
139+
+ ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
140+
if 'AR' in os.environ:
141+
ar = os.environ['AR']
142+
if 'ARFLAGS' in os.environ:
143+
@@ -223,13 +233,17 @@
144+
archiver = ar + ' ' + ar_flags
145+
146+
cc_cmd = cc + ' ' + cflags
147+
+ cxx_cmd = cxx + ' ' + cxxflags
148+
compiler.set_executables(
149+
preprocessor=cpp,
150+
compiler=cc_cmd,
151+
compiler_so=cc_cmd + ' ' + ccshared,
152+
- compiler_cxx=cxx,
153+
+ compiler_cxx=cxx_cmd,
154+
+ compiler_so_cxx=cxx_cmd + ' ' + ccshared,
155+
linker_so=ldshared,
156+
linker_exe=cc,
157+
+ linker_so_cxx=ldcxxshared,
158+
+ linker_exe_cxx=cxx,
159+
archiver=archiver)
160+
161+
compiler.shared_lib_extension = shlib_suffix
162+
diff -r d9893d13c628 Lib/distutils/unixccompiler.py
163+
--- a/Lib/distutils/unixccompiler.py Sat Apr 06 09:40:02 2013 +0200
164+
+++ b/Lib/distutils/unixccompiler.py Sat Apr 27 16:51:50 2013 -0700
165+
@@ -52,14 +52,17 @@
166+
# are pretty generic; they will probably have to be set by an outsider
167+
# (eg. using information discovered by the sysconfig about building
168+
# Python extensions).
169+
- executables = {'preprocessor' : None,
170+
- 'compiler' : ["cc"],
171+
- 'compiler_so' : ["cc"],
172+
- 'compiler_cxx' : ["cc"],
173+
- 'linker_so' : ["cc", "-shared"],
174+
- 'linker_exe' : ["cc"],
175+
- 'archiver' : ["ar", "-cr"],
176+
- 'ranlib' : None,
177+
+ executables = {'preprocessor' : None,
178+
+ 'compiler' : ["cc"],
179+
+ 'compiler_so' : ["cc"],
180+
+ 'compiler_cxx' : ["c++"],
181+
+ 'compiler_so_cxx' : ["c++"],
182+
+ 'linker_so' : ["cc", "-shared"],
183+
+ 'linker_exe' : ["cc"],
184+
+ 'linker_so_cxx' : ["c++", "-shared"],
185+
+ 'linker_exe_cxx' : ["c++"],
186+
+ 'archiver' : ["ar", "-cr"],
187+
+ 'ranlib' : None,
188+
}
189+
190+
if sys.platform[:6] == "darwin":
191+
@@ -108,12 +111,19 @@
192+
193+
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
194+
compiler_so = self.compiler_so
195+
+ compiler_so_cxx = self.compiler_so_cxx
196+
if sys.platform == 'darwin':
197+
compiler_so = _osx_support.compiler_fixup(compiler_so,
198+
cc_args + extra_postargs)
199+
+ compiler_so_cxx = _osx_support.compiler_fixup(compiler_so_cxx,
200+
+ cc_args + extra_postargs)
201+
try:
202+
- self.spawn(compiler_so + cc_args + [src, '-o', obj] +
203+
- extra_postargs)
204+
+ if self.detect_language(src) == 'c++':
205+
+ self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
206+
+ extra_postargs)
207+
+ else:
208+
+ self.spawn(compiler_so + cc_args + [src, '-o', obj] +
209+
+ extra_postargs)
210+
except DistutilsExecError as msg:
211+
raise CompileError(msg)
212+
213+
@@ -171,22 +181,16 @@
214+
ld_args.extend(extra_postargs)
215+
self.mkpath(os.path.dirname(output_filename))
216+
try:
217+
- if target_desc == CCompiler.EXECUTABLE:
218+
- linker = self.linker_exe[:]
219+
+ if target_lang == "c++":
220+
+ if target_desc == CCompiler.EXECUTABLE:
221+
+ linker = self.linker_exe_cxx[:]
222+
+ else:
223+
+ linker = self.linker_so_cxx[:]
224+
else:
225+
- linker = self.linker_so[:]
226+
- if target_lang == "c++" and self.compiler_cxx:
227+
- # skip over environment variable settings if /usr/bin/env
228+
- # is used to set up the linker's environment.
229+
- # This is needed on OSX. Note: this assumes that the
230+
- # normal and C++ compiler have the same environment
231+
- # settings.
232+
- i = 0
233+
- if os.path.basename(linker[0]) == "env":
234+
- i = 1
235+
- while '=' in linker[i]:
236+
- i += 1
237+
- linker[i] = self.compiler_cxx[i]
238+
+ if target_desc == CCompiler.EXECUTABLE:
239+
+ linker = self.linker_exe[:]
240+
+ else:
241+
+ linker = self.linker_so[:]
242+
243+
if sys.platform == 'darwin':
244+
linker = _osx_support.compiler_fixup(linker, ld_args)
245+
diff -r d9893d13c628 Makefile.pre.in
246+
--- a/Makefile.pre.in Sat Apr 06 09:40:02 2013 +0200
247+
+++ b/Makefile.pre.in Sat Apr 27 16:51:50 2013 -0700
248+
@@ -492,7 +492,7 @@
249+
*\ -s*|s*) quiet="-q";; \
250+
*) quiet="";; \
251+
esac; \
252+
- $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
253+
+ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' CFLAGS='$(PY_CFLAGS)' \
254+
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
255+
256+
# Build static library

0 commit comments

Comments
 (0)