2
1

003-sysconfigdata-install-location.patch 3.1 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. @@ -559,6 +559,9 @@
  20. rm -f ./pybuilddir.txt ; \
  21. exit 1 ; \
  22. fi
  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. @@ -1197,7 +1200,7 @@
  29. else true; \
  30. fi; \
  31. done
  32. - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \
  33. + @for i in $(srcdir)/Lib/*.py ; \
  34. do \
  35. if test -x $$i; then \
  36. $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
  37. @@ -1207,6 +1210,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. @@ -1533,7 +1541,7 @@
  50. find build -name 'fficonfig.h' -exec rm -f {} ';' || true
  51. find build -name '*.py' -exec rm -f {} ';' || true
  52. find build -name '*.py[co]' -exec rm -f {} ';' || true
  53. - -rm -f pybuilddir.txt
  54. + -rm -f pybuilddir.txt pysysconfigdatadir.txt
  55. -rm -f Lib/lib2to3/*Grammar*.pickle
  56. -rm -f Modules/_testembed Modules/_freeze_importlib
  57. Index: b/configure.ac
  58. ===================================================================
  59. --- a/configure.ac
  60. +++ b/configure.ac
  61. @@ -70,7 +70,7 @@
  62. AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
  63. fi
  64. AC_MSG_RESULT($interp)
  65. - 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/$(PLATDIR) '$interp
  66. + 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/$(PLATDIR) '$interp
  67. fi
  68. elif test "$cross_compiling" = maybe; then
  69. AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])