0002-Change-the-install-location-of-_sysconfigdata.py.patch 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 4ac038d30ec71b3f223ac7c91613856dd82b6347 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 23 Dec 2015 11:29:04 +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 823def3..4d2a061 100644
  24. --- a/Makefile.pre.in
  25. +++ b/Makefile.pre.in
  26. @@ -585,6 +585,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. # Build the shared modules
  34. # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
  35. @@ -1235,7 +1238,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; \
  40. + @for i in $(srcdir)/Lib/*.py ; \
  41. do \
  42. if test -x $$i; then \
  43. $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
  44. @@ -1245,6 +1248,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. @@ -1580,7 +1588,7 @@ clean: pycremoval
  57. find build -name 'fficonfig.h' -exec rm -f {} ';' || true
  58. find build -name '*.py' -exec rm -f {} ';' || true
  59. find build -name '*.py[co]' -exec rm -f {} ';' || true
  60. - -rm -f pybuilddir.txt
  61. + -rm -f pybuilddir.txt pysysconfigdatadir.txt
  62. -rm -f Lib/lib2to3/*Grammar*.pickle
  63. -rm -f Programs/_testembed Programs/_freeze_importlib
  64. -rm -rf build
  65. diff --git a/configure.ac b/configure.ac
  66. index 694293e..76b70a0 100644
  67. --- a/configure.ac
  68. +++ b/configure.ac
  69. @@ -70,7 +70,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. elif test "$cross_compiling" = maybe; then
  77. AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
  78. --
  79. 2.6.4