patch-setup_py 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. --- Python-2.7.9.orig/setup.py 2014-12-10 17:00:01.000000000 +0100
  2. +++ Python-2.7.9/setup.py 2015-04-11 08:37:49.609444500 +0200
  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. if os.path.join(sysroot, p[1:]) == dirname:
  39. return [ ]
  40. @@ -129,7 +129,7 @@ def find_library_file(compiler, libname,
  41. # Ensure path doesn't end with path separator
  42. p = p.rstrip(os.sep)
  43. - if host_platform == 'darwin' and is_macosx_sdk_path(p):
  44. + if host_platform == 'darwin' and is_macosx_sdk_path(p) and not cross_compiling:
  45. if os.path.join(sysroot, p[1:]) == dirname:
  46. return [ p ]
  47. @@ -162,6 +162,7 @@ class PyBuildExt(build_ext):
  48. def build_extensions(self):
  49. + self.compiler.library_dirs = []
  50. # Detect which modules should be compiled
  51. missing = self.detect_modules()
  52. @@ -283,6 +284,7 @@ class PyBuildExt(build_ext):
  53. def build_extension(self, ext):
  54. +
  55. if ext.name == '_ctypes':
  56. if not self.configure_ctypes(ext):
  57. return
  58. @@ -444,7 +446,8 @@ class PyBuildExt(build_ext):
  59. add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  60. if cross_compiling:
  61. self.add_gcc_paths()
  62. - self.add_multiarch_paths()
  63. + if not cross_compiling:
  64. + self.add_multiarch_paths()
  65. # Add paths specified in the environment variables LDFLAGS and
  66. # CPPFLAGS for header and library files.
  67. @@ -481,7 +484,8 @@ class PyBuildExt(build_ext):
  68. add_dir_to_list(dir_list, directory)
  69. if os.path.normpath(sys.prefix) != '/usr' \
  70. - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
  71. + and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
  72. + and not cross_compiling:
  73. # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
  74. # (PYTHONFRAMEWORK is set) to avoid # linking problems when
  75. # building a framework with different architectures than
  76. @@ -499,8 +503,13 @@ class PyBuildExt(build_ext):
  77. # lib_dirs and inc_dirs are used to search for files;
  78. # if a file is found in one of those directories, it can
  79. # be assumed that no additional -I,-L directives are needed.
  80. + if cross_compiling:
  81. + add_dir_to_list(self.compiler.library_dirs,
  82. + sysconfig.get_config_var('srcdir'))
  83. +
  84. inc_dirs = self.compiler.include_dirs[:]
  85. lib_dirs = self.compiler.library_dirs[:]
  86. +
  87. if not cross_compiling:
  88. for d in (
  89. '/usr/include',
  90. @@ -534,7 +543,7 @@ class PyBuildExt(build_ext):
  91. if host_platform == 'hp-ux11':
  92. lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  93. - if host_platform == 'darwin':
  94. + if host_platform == 'darwin' and not cross_compiling:
  95. # This should work on any unixy platform ;-)
  96. # If the user has bothered specifying additional -I and -L flags
  97. # in OPT and LDFLAGS we might as well use them here.