2
1

python-004-sysconfigdata-install-location.patch 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. Change the install location of _sysconfigdata.py
  2. The _sysconfigdata.py module contains definitions that are needed when
  3. building Python modules. In cross-compilation mode, when building
  4. Python extensions for the target, we need to use the _sysconfigdata.py
  5. of the target Python while executing the host Python.
  6. However until now, the _sysconfigdata.py module was installed in
  7. build/lib.<arch>-<version> directory, together with a number of
  8. architecture-specific shared objects, which cannot be used with the
  9. host Python.
  10. To solve this problem, this patch moves _sysconfigdata.py to a
  11. separate location, build/sysconfigdata.<arch>-<version>/, and only
  12. this directory gets added to the PYTHONPATH of the host Python
  13. interpreter when building Python modules for the target.
  14. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  15. Index: b/Makefile.pre.in
  16. ===================================================================
  17. --- a/Makefile.pre.in
  18. +++ b/Makefile.pre.in
  19. @@ -449,6 +449,9 @@
  20. # sys.path fixup -- see Modules/getpath.c.
  21. pybuilddir.txt: $(BUILDPYTHON)
  22. $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars
  23. + echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
  24. + mkdir -p `cat pysysconfigdatadir.txt`
  25. + cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
  26. # Build the shared modules
  27. # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
  28. @@ -965,7 +968,7 @@
  29. else true; \
  30. fi; \
  31. done
  32. - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  33. + @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  34. do \
  35. if test -x $$i; then \
  36. $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
  37. @@ -975,6 +978,11 @@
  38. echo $(INSTALL_DATA) $$i $(LIBDEST); \
  39. fi; \
  40. done
  41. + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
  42. + $(DESTDIR)$(LIBDEST)
  43. + mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
  44. + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
  45. + $(DESTDIR)$(LIBDEST)/sysconfigdata
  46. @for d in $(LIBSUBDIRS); \
  47. do \
  48. a=$(srcdir)/Lib/$$d; \
  49. @@ -1299,7 +1307,7 @@
  50. Modules/Setup Modules/Setup.local Modules/Setup.config \
  51. Modules/ld_so_aix Modules/python.exp Misc/python.pc
  52. -rm -f python*-gdb.py
  53. - -rm -f pybuilddir.txt
  54. + -rm -f pybuilddir.txt pysysconfigdatadir.txt
  55. find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
  56. -o -name '[@,#]*' -o -name '*.old' \
  57. -o -name '*.orig' -o -name '*.rej' \
  58. Index: b/configure.ac
  59. ===================================================================
  60. --- a/configure.ac
  61. +++ b/configure.ac
  62. @@ -30,7 +30,7 @@
  63. AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
  64. fi
  65. AC_MSG_RESULT($interp)
  66. - PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
  67. + PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pysysconfigdatadir.txt && echo $(abs_builddir)/`cat pysysconfigdatadir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
  68. fi
  69. elif test "$cross_compiling" = maybe; then
  70. AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])