0003-Change-the-install-location-of-_sysconfigdata.py.patch 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From e3f3c454ec4992a2283640cef0a35da5a05fb399 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 7 Mar 2017 22:17:59 +0100
  4. Subject: [PATCH] Change the install location of _sysconfigdata.py
  5. The _sysconfigdata.py module contains definitions that are needed when
  6. building Python modules. In cross-compilation mode, when building
  7. Python extensions for the target, we need to use the _sysconfigdata.py
  8. of the target Python while executing the host Python.
  9. However until now, the _sysconfigdata.py module was installed in
  10. build/lib.<arch>-<version> directory, together with a number of
  11. architecture-specific shared objects, which cannot be used with the
  12. host Python.
  13. To solve this problem, this patch moves _sysconfigdata.py to a
  14. separate location, build/sysconfigdata.<arch>-<version>/, and only
  15. this directory gets added to the PYTHONPATH of the host Python
  16. interpreter when building Python modules for the target.
  17. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  18. [Peter: update for 2.7.16]
  19. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  20. ---
  21. Makefile.pre.in | 12 ++++++++++--
  22. configure.ac | 2 +-
  23. 2 files changed, 11 insertions(+), 3 deletions(-)
  24. diff --git a/Makefile.pre.in b/Makefile.pre.in
  25. index 9297e7fc89..49d3c0926f 100644
  26. --- a/Makefile.pre.in
  27. +++ b/Makefile.pre.in
  28. @@ -509,6 +509,9 @@ pybuilddir.txt: $(BUILDPYTHON)
  29. rm -f ./pybuilddir.txt ; \
  30. exit 1 ; \
  31. fi
  32. + echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
  33. + mkdir -p `cat pysysconfigdatadir.txt`
  34. + cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
  35. # This is shared by the math and cmath modules
  36. Modules/_math.o: Modules/_math.c Modules/_math.h
  37. @@ -1091,7 +1094,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  38. else true; \
  39. fi; \
  40. done
  41. - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  42. + @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  43. do \
  44. if test -x $$i; then \
  45. $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
  46. @@ -1101,6 +1104,11 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  47. echo $(INSTALL_DATA) $$i $(LIBDEST); \
  48. fi; \
  49. done
  50. + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
  51. + $(DESTDIR)$(LIBDEST)
  52. + mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
  53. + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
  54. + $(DESTDIR)$(LIBDEST)/sysconfigdata
  55. @for d in $(LIBSUBDIRS); \
  56. do \
  57. a=$(srcdir)/Lib/$$d; \
  58. @@ -1426,7 +1434,7 @@ distclean: clobber
  59. Modules/Setup Modules/Setup.local Modules/Setup.config \
  60. Modules/ld_so_aix Modules/python.exp Misc/python.pc
  61. -rm -f python*-gdb.py
  62. - -rm -f pybuilddir.txt
  63. + -rm -f pybuilddir.txt pysysconfigdatadir.txt
  64. # Issue #28258: set LC_ALL to avoid issues with Estonian locale.
  65. # Expansion is performed here by shell (spawned by make) itself before
  66. # arguments are passed to find. So LC_ALL=C must be set as a separate
  67. diff --git a/configure.ac b/configure.ac
  68. index aecf6066e8..7143172b98 100644
  69. --- a/configure.ac
  70. +++ b/configure.ac
  71. @@ -36,7 +36,7 @@ if test "$cross_compiling" = yes; then
  72. AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
  73. fi
  74. AC_MSG_RESULT($interp)
  75. - 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
  76. + 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
  77. fi
  78. elif test "$cross_compiling" = maybe; then
  79. AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
  80. --
  81. 2.11.0