patch-setup_py 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. --- Python-2.7.13.orig/setup.py 2016-12-17 21:05:07.000000000 +0100
  2. +++ Python-2.7.13/setup.py 2017-03-16 19:45:12.000000000 +0100
  3. @@ -74,7 +74,7 @@ def find_file(filename, std_dirs, paths)
  4. 'paths' is a list of additional locations to check; if the file is
  5. found in one of them, the resulting list will contain the directory.
  6. """
  7. - if host_platform == 'darwin':
  8. + if host_platform == 'darwin' and not cross_compiling:
  9. # Honor the MacOSX SDK setting when one was specified.
  10. # An SDK is a directory with the same structure as a real
  11. # system, but with only header files and libraries.
  12. @@ -84,7 +84,7 @@ def find_file(filename, std_dirs, paths)
  13. for dir in std_dirs:
  14. f = os.path.join(dir, filename)
  15. - if host_platform == 'darwin' and is_macosx_sdk_path(dir):
  16. + if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
  17. f = os.path.join(sysroot, dir[1:], filename)
  18. if os.path.exists(f): return []
  19. @@ -93,7 +93,7 @@ def find_file(filename, std_dirs, paths)
  20. for dir in paths:
  21. f = os.path.join(dir, filename)
  22. - if host_platform == 'darwin' and is_macosx_sdk_path(dir):
  23. + if host_platform == 'darwin' and is_macosx_sdk_path(dir) and not cross_compiling:
  24. f = os.path.join(sysroot, dir[1:], filename)
  25. if os.path.exists(f):
  26. @@ -107,7 +107,7 @@ def find_library_file(compiler, libname,
  27. if result is None:
  28. return None
  29. - if host_platform == 'darwin':
  30. + if host_platform == 'darwin' and not cross_compiling:
  31. sysroot = macosx_sdk_root()
  32. # Check whether the found file is in one of the standard directories
  33. @@ -116,7 +116,7 @@ def find_library_file(compiler, libname,
  34. # Ensure path doesn't end with path separator
  35. p = p.rstrip(os.sep)
  36. - if host_platform == 'darwin' and is_macosx_sdk_path(p):
  37. + if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
  38. # Note that, as of Xcode 7, Apple SDKs may contain textual stub
  39. # libraries with .tbd extensions rather than the normal .dylib
  40. # shared libraries installed in /. The Apple compiler tool
  41. @@ -145,7 +145,7 @@ def find_library_file(compiler, libname,
  42. # Ensure path doesn't end with path separator
  43. p = p.rstrip(os.sep)
  44. - if host_platform == 'darwin' and is_macosx_sdk_path(p):
  45. + if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
  46. if os.path.join(sysroot, p[1:]) == dirname:
  47. return [ p ]
  48. @@ -178,6 +178,7 @@ class PyBuildExt(build_ext):
  49. def build_extensions(self):
  50. + self.compiler.library_dirs = []
  51. # Detect which modules should be compiled
  52. missing = self.detect_modules()
  53. @@ -299,6 +300,7 @@ class PyBuildExt(build_ext):
  54. def build_extension(self, ext):
  55. +
  56. if ext.name == '_ctypes':
  57. if not self.configure_ctypes(ext):
  58. return
  59. @@ -460,7 +462,8 @@ class PyBuildExt(build_ext):
  60. add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  61. if cross_compiling:
  62. self.add_gcc_paths()
  63. - self.add_multiarch_paths()
  64. + if not cross_compiling:
  65. + self.add_multiarch_paths()
  66. # Add paths specified in the environment variables LDFLAGS and
  67. # CPPFLAGS for header and library files.
  68. @@ -497,7 +500,8 @@ class PyBuildExt(build_ext):
  69. add_dir_to_list(dir_list, directory)
  70. if os.path.normpath(sys.prefix) != '/usr' \
  71. - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
  72. + and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
  73. + and not cross_compiling:
  74. # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
  75. # (PYTHONFRAMEWORK is set) to avoid # linking problems when
  76. # building a framework with different architectures than
  77. @@ -515,8 +519,13 @@ class PyBuildExt(build_ext):
  78. # lib_dirs and inc_dirs are used to search for files;
  79. # if a file is found in one of those directories, it can
  80. # be assumed that no additional -I,-L directives are needed.
  81. + if cross_compiling:
  82. + add_dir_to_list(self.compiler.library_dirs,
  83. + sysconfig.get_config_var('srcdir'))
  84. +
  85. inc_dirs = self.compiler.include_dirs[:]
  86. lib_dirs = self.compiler.library_dirs[:]
  87. +
  88. if not cross_compiling:
  89. for d in (
  90. '/usr/include',
  91. @@ -550,7 +559,7 @@ class PyBuildExt(build_ext):
  92. if host_platform == 'hp-ux11':
  93. lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  94. - if host_platform == 'darwin':
  95. + if host_platform == 'darwin' and not cross_compiling:
  96. # This should work on any unixy platform ;-)
  97. # If the user has bothered specifying additional -I and -L flags
  98. # in OPT and LDFLAGS we might as well use them here.