package/pkg-python: use _CONFIGURE_OPTS in the build environment
authorRyan Barnett <ryan.barnett@rockwellcollins.com>
Thu, 5 Dec 2019 23:11:02 +0000 (17:11 -0600)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 6 Dec 2019 22:33:56 +0000 (23:33 +0100)
When building host or target python packages, we need to ensure that
the build environment utilize {HOST|TARGET}_CONFIGURE_OPTS. This
ensures that the correct linker and compiler environment variables are
set to compile utilizing either the host or target folders.

It was discovered that when compiling a host-python package, it was
using linking against the build machines library folder instead of the
host folder because LDFLAGS was not properly set and was improperly
detecting whether or not a shared or static library was present in the
host folder.

CC: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/pkg-python.mk

index be1ce071dff06319557540130c3e65622556b6e6..4ded4fde83e1917dcdd6fce15a271650a7f889ef 100644 (file)
@@ -27,9 +27,7 @@ endef
 # Target distutils-based packages
 PKG_PYTHON_DISTUTILS_ENV = \
        PATH=$(BR_PATH) \
-       CC="$(TARGET_CC)" \
-       CFLAGS="$(TARGET_CFLAGS)" \
-       LDFLAGS="$(TARGET_LDFLAGS)" \
+       $(TARGET_CONFIGURE_OPTS) \
        LDSHARED="$(TARGET_CROSS)gcc -shared" \
        PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
        PYTHONNOUSERSITE=1 \
@@ -52,7 +50,8 @@ PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS = \
 # Host distutils-based packages
 HOST_PKG_PYTHON_DISTUTILS_ENV = \
        PATH=$(BR_PATH) \
-       PYTHONNOUSERSITE=1
+       PYTHONNOUSERSITE=1 \
+       $(HOST_CONFIGURE_OPTS)
 
 HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
        --prefix=$(HOST_DIR)
@@ -61,6 +60,7 @@ HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
 PKG_PYTHON_SETUPTOOLS_ENV = \
        _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
        PATH=$(BR_PATH) \
+       $(TARGET_CONFIGURE_OPTS) \
        PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
        PYTHONNOUSERSITE=1 \
        _python_sysroot=$(STAGING_DIR) \
@@ -82,7 +82,8 @@ PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS = \
 # Host setuptools-based packages
 HOST_PKG_PYTHON_SETUPTOOLS_ENV = \
        PATH=$(BR_PATH) \
-       PYTHONNOUSERSITE=1
+       PYTHONNOUSERSITE=1 \
+       $(HOST_CONFIGURE_OPTS)
 
 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
        --prefix=$(HOST_DIR) \