1 From 2f706a2ba92c88f1c8288e34d1937b6ba0e0214c 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
6 The _sysconfigdata.py module contains definitions that are needed when
7 building Python modules. In cross-compilation mode, when building
8 Python extensions for the target, we need to use the _sysconfigdata.py
9 of the target Python while executing the host Python.
11 However until now, the _sysconfigdata.py module was installed in
12 build/lib.<arch>-<version> directory, together with a number of
13 architecture-specific shared objects, which cannot be used with the
16 To solve this problem, this patch moves _sysconfigdata.py to a
17 separate location, build/sysconfigdata.<arch>-<version>/, and only
18 this directory gets added to the PYTHONPATH of the host Python
19 interpreter when building Python modules for the target.
21 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
23 Makefile.pre.in | 12 ++++++++++--
25 2 files changed, 11 insertions(+), 3 deletions(-)
27 diff --git a/Makefile.pre.in b/Makefile.pre.in
28 index 76aef28..58dab28 100644
31 @@ -559,6 +559,9 @@ pybuilddir.txt: $(BUILDPYTHON)
32 rm -f ./pybuilddir.txt ; \
35 + echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
36 + mkdir -p `cat pysysconfigdatadir.txt`
37 + cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
39 # Build the shared modules
40 # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
41 @@ -1197,7 +1200,7 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
45 - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \
46 + @for i in $(srcdir)/Lib/*.py ; \
48 if test -x $$i; then \
49 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
50 @@ -1207,6 +1210,11 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
51 echo $(INSTALL_DATA) $$i $(LIBDEST); \
54 + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
55 + $(DESTDIR)$(LIBDEST)
56 + mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
57 + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
58 + $(DESTDIR)$(LIBDEST)/sysconfigdata
59 @for d in $(LIBSUBDIRS); \
61 a=$(srcdir)/Lib/$$d; \
62 @@ -1533,7 +1541,7 @@ clean: pycremoval
63 find build -name 'fficonfig.h' -exec rm -f {} ';' || true
64 find build -name '*.py' -exec rm -f {} ';' || true
65 find build -name '*.py[co]' -exec rm -f {} ';' || true
66 - -rm -f pybuilddir.txt
67 + -rm -f pybuilddir.txt pysysconfigdatadir.txt
68 -rm -f Lib/lib2to3/*Grammar*.pickle
69 -rm -f Modules/_testembed Modules/_freeze_importlib
71 diff --git a/configure.ac b/configure.ac
72 index a0d0afa..7b491b4 100644
75 @@ -70,7 +70,7 @@ if test "$cross_compiling" = yes; then
76 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
78 AC_MSG_RESULT($interp)
79 - 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
80 + 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
82 elif test "$cross_compiling" = maybe; then
83 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])