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