python3-002-no-host-headers-libs.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. Do not look at host headers/libraries in cross-compile mode
  2. When we are cross-compiling, setup.py should never look in /usr or
  3. /usr/local to find headers or libraries. A later patch adds a
  4. mechanism to tell setup.py to look in a specific directory for headers
  5. and libraries.
  6. Patch first written by Thomas Petazzoni
  7. <thomas.petazzoni@free-electrons.com> for python2.7, and then ported
  8. to python3.3 by Maxime Ripard <maxime.ripard@free-electrons.com>
  9. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
  10. ---
  11. setup.py | 23 +++++------------------
  12. 1 file changed, 5 insertions(+), 18 deletions(-)
  13. Index: Python-3.3.0/setup.py
  14. ===================================================================
  15. --- Python-3.3.0.orig/setup.py
  16. +++ Python-3.3.0/setup.py
  17. @@ -447,10 +447,8 @@
  18. if not cross_compiling:
  19. add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
  20. add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  21. - # only change this for cross builds for 3.3, issues on Mageia
  22. - if cross_compiling:
  23. self.add_gcc_paths()
  24. - self.add_multiarch_paths()
  25. + self.add_multiarch_paths()
  26. # Add paths specified in the environment variables LDFLAGS and
  27. # CPPFLAGS for header and library files.
  28. @@ -458,10 +456,7 @@
  29. # directly since an inconsistently reproducible issue comes up where
  30. # the environment variable is not set even though the value were passed
  31. # into configure and stored in the Makefile (issue found on OS X 10.3).
  32. - for env_var, arg_name, dir_list in (
  33. - ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
  34. - ('LDFLAGS', '-L', self.compiler.library_dirs),
  35. - ('CPPFLAGS', '-I', self.compiler.include_dirs)):
  36. + for env_var, arg_name, dir_list in ():
  37. env_val = sysconfig.get_config_var(env_var)
  38. if env_val:
  39. # To prevent optparse from raising an exception about any
  40. @@ -486,17 +481,6 @@
  41. for directory in reversed(options.dirs):
  42. add_dir_to_list(dir_list, directory)
  43. - if os.path.normpath(sys.base_prefix) != '/usr' \
  44. - and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
  45. - # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
  46. - # (PYTHONFRAMEWORK is set) to avoid # linking problems when
  47. - # building a framework with different architectures than
  48. - # the one that is currently installed (issue #7473)
  49. - add_dir_to_list(self.compiler.library_dirs,
  50. - sysconfig.get_config_var("LIBDIR"))
  51. - add_dir_to_list(self.compiler.include_dirs,
  52. - sysconfig.get_config_var("INCLUDEDIR"))
  53. -
  54. # lib_dirs and inc_dirs are used to search for files;
  55. # if a file is found in one of those directories, it can
  56. # be assumed that no additional -I,-L directives are needed.
  57. @@ -506,6 +490,9 @@
  58. '/lib', '/usr/lib',
  59. ]
  60. inc_dirs = self.compiler.include_dirs + ['/usr/include']
  61. + else:
  62. + lib_dirs = self.compiler.library_dirs
  63. + inc_dirs = self.compiler.include_dirs
  64. exts = []
  65. missing = []