Files
MINGW-packages/mingw-w64-python2/0505-add-build-sysroot-config-option.patch
Ray Donnelly d81e579c18 python 2(+3): patches for dirsep as / and sysconfig
0530-msys-mingw-prefer-unix-sep-if-MSYSTEM.patch
0535-msys-cygwin-semi-native-build-sysconfig.patch

Add a bug-fix from Arch Linux mingw-w64-python 2.7.6
for a memory stomp.

Fix python{3.3m}-config.sh to return correct values.

Tidy up the PKGBUILD files.
2014-01-29 02:08:31 +00:00

134 lines
6.4 KiB
Diff

diff -urN a/configure.ac b/configure.ac
--- a/configure.ac 2014-01-22 20:57:41.675786705 +0000
+++ b/configure.ac 2014-01-22 20:57:42.169127693 +0000
@@ -559,6 +559,17 @@
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
+# There are certain cases where we don't want build machine's
+# sysroot folders (/usr/include, /usr/lib, /usr/lib64 etc) to
+# be used. An example of where this is needed is if running
+# on a 64bit machine via linux32 running a 32bit targetting GCC.
+# Without this, 64bit libs will cause the linker to fail.
+# This also prevents add_multiarch_paths from being called.
+# You can specify this multiple times to add more prefixes.
+AC_MSG_CHECKING(for --with-build-sysroot)
+AC_ARG_WITH([build-sysroot],
+AS_HELP_STRING([--with-build-sysroot], [Select sysroot and ignore multilibs, even when not cross-compiling]))
+
# checks for alternative programs
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
diff -urN a/setup.py b/setup.py
--- a/setup.py 2014-01-22 20:57:41.675786705 +0000
+++ b/setup.py 2014-01-22 20:57:42.169127693 +0000
@@ -33,6 +33,16 @@
# Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
+with_build_sysroot_args = [arg.split('=')[-1] for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
+ if ('--with-build-sysroot' in arg)]
+
+if len(with_build_sysroot_args):
+ with_build_sysroot_specified = True
+ with_build_sysroots = [arg.replace("'",'') for arg in with_build_sysroot_args]
+else:
+ with_build_sysroot_specified = False
+ with_build_sysroots = ['/usr']
+
# This global variable is used to hold the list of modules to be disabled.
disabled_module_list = []
@@ -406,10 +416,11 @@
os.unlink(tmpfile)
if multiarch_path_component != '':
- add_dir_to_list(self.compiler.library_dirs,
- '/usr/lib/' + multiarch_path_component)
- add_dir_to_list(self.compiler.include_dirs,
- '/usr/include/' + multiarch_path_component)
+ for sysroot in with_build_sysroots:
+ add_dir_to_list(self.compiler.library_dirs,
+ sysroot + '/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ sysroot + '/include/' + multiarch_path_component)
return
if not find_executable('dpkg-architecture'):
@@ -427,10 +438,11 @@
if ret >> 8 == 0:
with open(tmpfile) as fp:
multiarch_path_component = fp.readline().strip()
- add_dir_to_list(self.compiler.library_dirs,
- '/usr/lib/' + multiarch_path_component)
- add_dir_to_list(self.compiler.include_dirs,
- '/usr/include/' + multiarch_path_component)
+ for sysroot in with_build_sysroots:
+ add_dir_to_list(self.compiler.library_dirs,
+ sysroot + '/lib/' + multiarch_path_component)
+ add_dir_to_list(self.compiler.include_dirs,
+ sysroot + '/include/' + multiarch_path_component)
finally:
os.unlink(tmpfile)
@@ -468,7 +480,7 @@
def detect_modules(self):
# Ensure that /usr/local is always used
- if not cross_compiling:
+ if not cross_compiling and not with_build_sysroot_specified:
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
if cross_compiling:
@@ -533,7 +545,9 @@
# be assumed that no additional -I,-L directives are needed.
inc_dirs = self.compiler.include_dirs[:]
lib_dirs = self.compiler.library_dirs[:]
- if not cross_compiling:
+ # This bit was already questionable when I got here. I've
+ # disabled it when a build sysroot has been specified.
+ if not cross_compiling and not with_build_sysroot_specified:
if not (sys.version.find('GCC') and host_platform in ['mingw', 'win32']):
for d in (
'/usr/include',
@@ -819,11 +833,11 @@
elif curses_library:
readline_libs.append(curses_library)
elif self.compiler.find_library_file(lib_dirs +
- ['/usr/lib/termcap'],
+ [sr + '/lib/termcap' for sr in with_build_sysroots],
'termcap'):
readline_libs.append('termcap')
exts.append( Extension('readline', ['readline.c'],
- library_dirs=['/usr/lib/termcap'],
+ library_dirs=[sr + '/lib/termcap' for sr in with_build_sysroots],
extra_link_args=readline_extra_link_args,
libraries=readline_libs) )
else:
@@ -850,20 +864,20 @@
libraries=_socket_libs) )
# Detect SSL support for the socket module (via _ssl)
search_for_ssl_incs_in = [
- '/usr/local/ssl/include',
- '/usr/contrib/ssl/include/'
+ sr + sslinc for sr in with_build_sysroots
+ for sslinc in ('/local/ssl/include', '/contrib/ssl/include')
]
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
search_for_ssl_incs_in
)
if ssl_incs is not None:
krb5_h = find_file('krb5.h', inc_dirs,
- ['/usr/kerberos/include'])
+ [sr + '/kerberos/include' for sr in with_build_sysroots])
if krb5_h:
ssl_incs += krb5_h
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
+ [sr + ssllib for sr in with_build_sysroots
+ for ssllib in ('/local/ssl/lib', '/contrib/ssl/lib')
] )
if (ssl_incs is not None and