patch-setup_py 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. --- Python-3.3.2.orig/setup.py 2013-05-15 18:33:00.000000000 +0200
  2. +++ Python-3.3.2/setup.py 2013-10-27 13:54:34.000000000 +0100
  3. @@ -80,7 +80,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. @@ -90,7 +90,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. @@ -99,7 +99,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. @@ -113,7 +113,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. @@ -122,7 +122,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. @@ -135,7 +135,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. @@ -168,6 +168,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. @@ -444,7 +445,8 @@ class PyBuildExt(build_ext):
  53. # only change this for cross builds for 3.3, issues on Mageia
  54. if cross_compiling:
  55. self.add_gcc_paths()
  56. - self.add_multiarch_paths()
  57. + if not cross_compiling:
  58. + self.add_multiarch_paths()
  59. # Add paths specified in the environment variables LDFLAGS and
  60. # CPPFLAGS for header and library files.
  61. @@ -481,7 +483,8 @@ class PyBuildExt(build_ext):
  62. add_dir_to_list(dir_list, directory)
  63. if os.path.normpath(sys.base_prefix) != '/usr' \
  64. - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
  65. + and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
  66. + and not cross_compiling:
  67. # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
  68. # (PYTHONFRAMEWORK is set) to avoid # linking problems when
  69. # building a framework with different architectures than
  70. @@ -494,6 +497,9 @@ class PyBuildExt(build_ext):
  71. # lib_dirs and inc_dirs are used to search for files;
  72. # if a file is found in one of those directories, it can
  73. # be assumed that no additional -I,-L directives are needed.
  74. + if cross_compiling:
  75. + add_dir_to_list(self.compiler.library_dirs,
  76. + sysconfig.get_config_var('srcdir'))
  77. if not cross_compiling:
  78. lib_dirs = self.compiler.library_dirs + [
  79. '/lib64', '/usr/lib64',
  80. @@ -520,23 +526,26 @@ class PyBuildExt(build_ext):
  81. if host_platform == 'hp-ux11':
  82. lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
  83. - if host_platform == 'darwin':
  84. - # This should work on any unixy platform ;-)
  85. - # If the user has bothered specifying additional -I and -L flags
  86. - # in OPT and LDFLAGS we might as well use them here.
  87. - #
  88. - # NOTE: using shlex.split would technically be more correct, but
  89. - # also gives a bootstrap problem. Let's hope nobody uses
  90. - # directories with whitespace in the name to store libraries.
  91. - cflags, ldflags = sysconfig.get_config_vars(
  92. - 'CFLAGS', 'LDFLAGS')
  93. - for item in cflags.split():
  94. - if item.startswith('-I'):
  95. - inc_dirs.append(item[2:])
  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.
  99. + #
  100. + # NOTE: using shlex.split would technically be more correct, but
  101. + # also gives a bootstrap problem. Let's hope nobody uses
  102. + # directories with whitespace in the name to store libraries.
  103. + cppflags, cflags, ldflags = sysconfig.get_config_vars(
  104. + 'CPPFLAGS', 'CFLAGS', 'LDFLAGS')
  105. + for item in cppflags.split():
  106. + if item.startswith('-I'):
  107. + inc_dirs.append(item[2:])
  108. - for item in ldflags.split():
  109. - if item.startswith('-L'):
  110. - lib_dirs.append(item[2:])
  111. + for item in cflags.split():
  112. + if item.startswith('-I'):
  113. + inc_dirs.append(item[2:])
  114. +
  115. + for item in ldflags.split():
  116. + if item.startswith('-L'):
  117. + lib_dirs.append(item[2:])
  118. # Check for MacOS X, which doesn't need libm.a at all
  119. math_libs = ['m']
  120. @@ -1355,7 +1364,7 @@ class PyBuildExt(build_ext):
  121. # Gustavo Niemeyer's bz2 module.
  122. if (self.compiler.find_library_file(lib_dirs, 'bz2')):
  123. - if host_platform == "darwin":
  124. + if host_platform == "darwin" and not cross_compiling:
  125. bz2_extra_link_args = ('-Wl,-search_paths_first',)
  126. else:
  127. bz2_extra_link_args = ()