2
1

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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 0ef0d4ddd3f2261e381f22061a9a451dfbb1dc9e 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. ---
  19. Makefile.pre.in | 12 ++++++++++--
  20. configure.ac | 2 +-
  21. 2 files changed, 11 insertions(+), 3 deletions(-)
  22. diff --git a/Makefile.pre.in b/Makefile.pre.in
  23. index e288964..5367df7 100644
  24. --- a/Makefile.pre.in
  25. +++ b/Makefile.pre.in
  26. @@ -529,6 +529,9 @@ pybuilddir.txt: $(BUILDPYTHON)
  27. rm -f ./pybuilddir.txt ; \
  28. exit 1 ; \
  29. fi
  30. + echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
  31. + mkdir -p `cat pysysconfigdatadir.txt`
  32. + cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
  33. # This is shared by the math and cmath modules
  34. Modules/_math.o: Modules/_math.c Modules/_math.h
  35. @@ -1080,7 +1083,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  36. else true; \
  37. fi; \
  38. done
  39. - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  40. + @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
  41. do \
  42. if test -x $$i; then \
  43. $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
  44. @@ -1090,6 +1093,11 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  45. echo $(INSTALL_DATA) $$i $(LIBDEST); \
  46. fi; \
  47. done
  48. + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
  49. + $(DESTDIR)$(LIBDEST)
  50. + mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
  51. + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
  52. + $(DESTDIR)$(LIBDEST)/sysconfigdata
  53. @for d in $(LIBSUBDIRS); \
  54. do \
  55. a=$(srcdir)/Lib/$$d; \
  56. @@ -1418,7 +1426,7 @@ distclean: clobber
  57. Modules/Setup Modules/Setup.local Modules/Setup.config \
  58. Modules/ld_so_aix Modules/python.exp Misc/python.pc
  59. -rm -f python*-gdb.py
  60. - -rm -f pybuilddir.txt
  61. + -rm -f pybuilddir.txt pysysconfigdatadir.txt
  62. # Issue #28258: set LC_ALL to avoid issues with Estonian locale.
  63. # Expansion is performed here by shell (spawned by make) itself before
  64. # arguments are passed to find. So LC_ALL=C must be set as a separate
  65. diff --git a/configure.ac b/configure.ac
  66. index 1273465..5f89797 100644
  67. --- a/configure.ac
  68. +++ b/configure.ac
  69. @@ -33,7 +33,7 @@ if test "$cross_compiling" = yes; then
  70. AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
  71. fi
  72. AC_MSG_RESULT($interp)
  73. - 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
  74. + 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
  75. fi
  76. # Used to comment out stuff for rebuilding generated files
  77. GENERATED_COMMENT='#'
  78. --
  79. 2.7.4