From 3a68797fe5615ed12797597b28dd2cbf4dbcf2af Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 17 Oct 2019 12:53:04 +0100 Subject: [PATCH] 002-xcompile.patch --- setup.py | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index 8a1279d..8e2b536 100644 --- a/setup.py +++ b/setup.py @@ -593,16 +593,19 @@ class PyBuildExt(build_ext): os.unlink(tmpfile) def detect_modules(self): - # Ensure that /usr/local is always used, but the local build - # directories (i.e. '.' and 'Include') must be first. See issue - # 10520. - if not cross_compiling: - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') + try: + modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split() + except KeyError: + modules_include_dirs = ['/usr/include'] + try: + modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split() + except KeyError: + modules_lib_dirs = ['/usr/lib'] self.add_multiarch_paths() - # only change this for cross builds for 3.3, issues on Mageia - if cross_compiling: - self.add_gcc_paths() + for dir in modules_include_dirs: + add_dir_to_list(self.compiler.include_dirs, dir) + for dir in modules_lib_dirs: + add_dir_to_list(self.compiler.library_dirs, dir) # Add paths specified in the environment variables LDFLAGS and # CPPFLAGS for header and library files. @@ -638,18 +641,6 @@ class PyBuildExt(build_ext): for directory in reversed(options.dirs): add_dir_to_list(dir_list, directory) - if (not cross_compiling and - os.path.normpath(sys.base_prefix) != '/usr' and - not sysconfig.get_config_var('PYTHONFRAMEWORK')): - # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework - # (PYTHONFRAMEWORK is set) to avoid # linking problems when - # building a framework with different architectures than - # the one that is currently installed (issue #7473) - add_dir_to_list(self.compiler.library_dirs, - sysconfig.get_config_var("LIBDIR")) - add_dir_to_list(self.compiler.include_dirs, - sysconfig.get_config_var("INCLUDEDIR")) - system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib'] system_include_dirs = ['/usr/include'] # lib_dirs and inc_dirs are used to search for files; -- 2.7.4