python-cross-compile.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. Ripped from OpenEmbedded
  2. --- Python-2.4c1/Makefile.pre.in
  3. +++ Python-2.4c1/Makefile.pre.in
  4. @@ -162,6 +162,7 @@
  5. PYTHON= python$(EXE)
  6. BUILDPYTHON= python$(BUILDEXE)
  7. +HOSTPYTHON= $(BUILDPYTHON)
  8. # === Definitions added by makesetup ===
  9. @@ -188,7 +189,7 @@
  10. ##########################################################################
  11. # Parser
  12. PGEN= Parser/pgen$(EXE)
  13. -
  14. +HOSTPGEN= $(PGEN)$(EXE)
  15. POBJS= \
  16. Parser/acceler.o \
  17. Parser/grammar1.o \
  18. @@ -320,8 +321,8 @@
  19. # Build the shared modules
  20. sharedmods: $(BUILDPYTHON)
  21. case $$MAKEFLAGS in \
  22. - *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \
  23. - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \
  24. + *-s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py -q build;; \
  25. + *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' $(HOSTPYTHON) -E $(srcdir)/setup.py build;; \
  26. esac
  27. # buildno should really depend on something like LIBRARY_SRC
  28. @@ -442,7 +443,7 @@
  29. $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT)
  30. - -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  31. + -$(HOSTPGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
  32. $(PGEN): $(PGENOBJS)
  33. $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
  34. @@ -718,19 +719,19 @@
  35. done
  36. $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
  37. PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  38. - ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
  39. + $(HOSTPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
  40. -d $(LIBDEST) -f \
  41. -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
  42. PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  43. - ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
  44. + $(HOSTPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
  45. -d $(LIBDEST) -f \
  46. -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST)
  47. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  48. - ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
  49. + $(HOSTPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
  50. -d $(LIBDEST)/site-packages -f \
  51. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  52. -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
  53. - ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
  54. + $(HOSTPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
  55. -d $(LIBDEST)/site-packages -f \
  56. -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
  57. @@ -825,7 +826,7 @@
  58. # Install the dynamically loadable modules
  59. # This goes into $(exec_prefix)
  60. sharedinstall:
  61. - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \
  62. + $(RUNSHARED) $(HOSTPYTHON) -E $(srcdir)/setup.py install \
  63. --prefix=$(prefix) \
  64. --install-scripts=$(BINDIR) \
  65. --install-platlib=$(DESTSHARED) \
  66. --- Python-2.4c1/setup.py
  67. +++ Python-2.4c1/setup.py
  68. @@ -206,6 +206,7 @@
  69. try:
  70. imp.load_dynamic(ext.name, ext_filename)
  71. except ImportError, why:
  72. + return
  73. self.announce('*** WARNING: renaming "%s" since importing it'
  74. ' failed: %s' % (ext.name, why), level=3)
  75. assert not self.inplace
  76. @@ -239,8 +240,6 @@
  77. def detect_modules(self):
  78. # Ensure that /usr/local is always used
  79. - add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
  80. - add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
  81. # Add paths to popular package managers on OS X/darwin
  82. if sys.platform == "darwin":
  83. @@ -260,12 +260,6 @@
  84. add_dir_to_list(self.compiler.library_dirs, '/opt/local/lib')
  85. add_dir_to_list(self.compiler.include_dirs, '/opt/local/include')
  86. - if os.path.normpath(sys.prefix) != '/usr':
  87. - add_dir_to_list(self.compiler.library_dirs,
  88. - sysconfig.get_config_var("LIBDIR"))
  89. - add_dir_to_list(self.compiler.include_dirs,
  90. - sysconfig.get_config_var("INCLUDEDIR"))
  91. -
  92. try:
  93. have_unicode = unicode
  94. except NameError: