patch-setup_py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. --- Python-2.7.5.orig/setup.py 2013-05-12 05:32:54.000000000 +0200
  2. +++ Python-2.7.5/setup.py 2014-02-03 17:07:52.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. 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. @@ -281,6 +282,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. @@ -437,10 +439,12 @@ class PyBuildExt(build_ext):
  59. def detect_modules(self):
  60. # Ensure that /usr/local is always used
  61. - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
  62. - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  63. + if not cross_compiling:
  64. + add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
  65. + add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  66. self.add_gcc_paths()
  67. - self.add_multiarch_paths()
  68. + if not cross_compiling:
  69. + self.add_multiarch_paths()
  70. # Add paths specified in the environment variables LDFLAGS and
  71. # CPPFLAGS for header and library files.
  72. @@ -477,7 +481,8 @@ class PyBuildExt(build_ext):
  73. add_dir_to_list(dir_list, directory)
  74. if os.path.normpath(sys.prefix) != '/usr' \
  75. - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
  76. + and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
  77. + and not cross_compiling:
  78. # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
  79. # (PYTHONFRAMEWORK is set) to avoid # linking problems when
  80. # building a framework with different architectures than
  81. @@ -495,8 +500,13 @@ class PyBuildExt(build_ext):
  82. # lib_dirs and inc_dirs are used to search for files;
  83. # if a file is found in one of those directories, it can
  84. # be assumed that no additional -I,-L directives are needed.
  85. + if cross_compiling:
  86. + add_dir_to_list(self.compiler.library_dirs,
  87. + sysconfig.get_config_var('srcdir'))
  88. +
  89. inc_dirs = self.compiler.include_dirs[:]
  90. lib_dirs = self.compiler.library_dirs[:]
  91. +
  92. if not cross_compiling:
  93. for d in (
  94. '/usr/include',
  95. @@ -530,7 +540,7 @@ class PyBuildExt(build_ext):
  96. if host_platform == 'hp-ux11':
  97. lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  98. - if host_platform == 'darwin':
  99. + if host_platform == 'darwin' and not cross_compiling:
  100. # This should work on any unixy platform ;-)
  101. # If the user has bothered specifying additional -I and -L flags
  102. # in OPT and LDFLAGS we might as well use them here.