mirror of
https://github.com/godotengine/buildroot.git
synced 2026-01-02 21:48:20 +03:00
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>
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user