diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2013-12-22 18:02:10 +0100 |
---|---|---|
committer | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2013-12-26 23:31:32 +0100 |
commit | b07b9d181ddea2282d8f6018b2f8b808439f67ca (patch) | |
tree | 50e8cc8f925ea511dd616acb1b27faf9f99b888f /package/python/python.mk | |
parent | d9ddd28bb1247f4b9e2ee6557c27f8739cc58d14 (diff) |
python: fix invalid library paths leaking into the build, and other improvements
This commit improves the cross-compilation patches we have on top of
Python, to fix the problem of host library paths leaking into the
build of target modules, as seen at:
http://autobuild.buildroot.org/results/fcc/fccd7e08cd9d4713eb4208097dd48c5ab25749bc/build-end.log
http://autobuild.buildroot.org/results/0bd/0bda780bf4b759b12edec26ac20b88cde617db4d/build-end.log
To do so, it ensures that the right python2.7/config/Makefile is used
when building target modules, and adjusts at runtime the paths read
from this Makefile if we are cross-compiling.
In addition, it installs the pgen program into the host directory, and
points the target python build to use python and pgen from $(HOST_DIR)
instead of from the host python source directory, which looks cleaner.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/python/python.mk')
-rw-r--r-- | package/python/python.mk | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/package/python/python.mk b/package/python/python.mk index 6a6aaaccb..bc42e8f14 100644 --- a/package/python/python.mk +++ b/package/python/python.mk @@ -51,6 +51,12 @@ PYTHON_DEPENDENCIES = host-python libffi HOST_PYTHON_DEPENDENCIES = host-expat host-zlib +define HOST_PYTHON_INSTALL_PGEN + $(INSTALL) -m0755 -D $(@D)/Parser/pgen $(HOST_DIR)/usr/bin/python-pgen +endef + +HOST_PYTHON_POST_INSTALL_HOOKS += HOST_PYTHON_INSTALL_PGEN + PYTHON_INSTALL_STAGING = YES ifeq ($(BR2_PACKAGE_PYTHON_READLINE),y) @@ -113,10 +119,15 @@ PYTHON_DEPENDENCIES += openssl endif PYTHON_CONF_ENV += \ - PYTHON_FOR_BUILD=$(HOST_PYTHON_DIR)/python \ - PGEN_FOR_BUILD=$(HOST_PYTHON_DIR)/Parser/pgen \ + PYTHON_FOR_BUILD=$(HOST_DIR)/usr/bin/python \ + PGEN_FOR_BUILD=$(HOST_DIR)/usr/bin/python-pgen \ ac_cv_have_long_long_format=yes +PYTHON_MAKE_ENV += \ + _python_sysroot=$(STAGING_DIR) \ + PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \ + PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" + PYTHON_CONF_OPT += \ --without-cxx-main \ --without-doc-strings \ @@ -129,19 +140,6 @@ PYTHON_CONF_OPT += \ --disable-nis \ --disable-dbm -PYTHON_MAKE_ENV = \ - PYTHON_MODULES_INCLUDE=$(STAGING_DIR)/usr/include \ - PYTHON_MODULES_LIB="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib" - -# python distutils adds -L$LIBDIR when linking binary extensions, causing -# trouble for cross compilation -define PYTHON_FIXUP_LIBDIR - $(SED) 's|^LIBDIR=.*|LIBDIR= $(STAGING_DIR)/usr/lib|' \ - $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/config/Makefile -endef - -PYTHON_POST_INSTALL_STAGING_HOOKS += PYTHON_FIXUP_LIBDIR - # # Remove useless files. In the config/ directory, only the Makefile # and the pyconfig.h files are needed at runtime. |