open-plc-utils: new package
[buildroot-gz.git] / package / python / 004-sysconfigdata-install-location.patch
bloba72db1ae790953f5e105234419ba488a4848a9b9
1 Change the install location of _sysconfigdata.py
3 The _sysconfigdata.py module contains definitions that are needed when
4 building Python modules. In cross-compilation mode, when building
5 Python extensions for the target, we need to use the _sysconfigdata.py
6 of the target Python while executing the host Python.
8 However until now, the _sysconfigdata.py module was installed in
9 build/lib.<arch>-<version> directory, together with a number of
10 architecture-specific shared objects, which cannot be used with the
11 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.
18 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
20 Index: b/Makefile.pre.in
21 ===================================================================
22 --- a/Makefile.pre.in
23 +++ b/Makefile.pre.in
24 @@ -462,6 +462,9 @@
25 rm -f ./pybuilddir.txt ; \
26 exit 1 ; \
28 + echo `cat pybuilddir.txt`/sysconfigdata > pysysconfigdatadir.txt
29 + mkdir -p `cat pysysconfigdatadir.txt`
30 + cp `cat pybuilddir.txt`/_sysconfigdata.py `cat pysysconfigdatadir.txt`
32 # Build the shared modules
33 # Under GNU make, MAKEFLAGS are sorted and normalized; the 's' for
34 @@ -1002,7 +1005,7 @@
35 else true; \
36 fi; \
37 done
38 - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
39 + @for i in $(srcdir)/Lib/*.py $(srcdir)/Lib/*.doc $(srcdir)/Lib/*.egg-info ; \
40 do \
41 if test -x $$i; then \
42 $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \
43 @@ -1012,6 +1015,11 @@
44 echo $(INSTALL_DATA) $$i $(LIBDEST); \
45 fi; \
46 done
47 + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
48 + $(DESTDIR)$(LIBDEST)
49 + mkdir -p $(DESTDIR)$(LIBDEST)/sysconfigdata
50 + $(INSTALL_DATA) `cat pysysconfigdatadir.txt`/_sysconfigdata.py \
51 + $(DESTDIR)$(LIBDEST)/sysconfigdata
52 @for d in $(LIBSUBDIRS); \
53 do \
54 a=$(srcdir)/Lib/$$d; \
55 @@ -1337,7 +1345,7 @@
56 Modules/Setup Modules/Setup.local Modules/Setup.config \
57 Modules/ld_so_aix Modules/python.exp Misc/python.pc
58 -rm -f python*-gdb.py
59 - -rm -f pybuilddir.txt
60 + -rm -f pybuilddir.txt pysysconfigdatadir.txt
61 find $(srcdir)/[a-zA-Z]* '(' -name '*.fdc' -o -name '*~' \
62 -o -name '[@,#]*' -o -name '*.old' \
63 -o -name '*.orig' -o -name '*.rej' \
64 Index: b/configure.ac
65 ===================================================================
66 --- a/configure.ac
67 +++ b/configure.ac
68 @@ -33,7 +33,7 @@
69 AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
71 AC_MSG_RESULT($interp)
72 - 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/plat-$(MACHDEP) '$interp
73 + 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/plat-$(MACHDEP) '$interp
75 elif test "$cross_compiling" = maybe; then
76 AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])