From mboxrd@z Thu Jan 1 00:00:00 1970 From: aduskett at gmail.com Date: Mon, 21 Oct 2019 13:04:37 -0700 Subject: [Buildroot] [PATCH v14 4/5] package/pkg-meson.mk: set Python sysconfigdata In-Reply-To: <20191021200438.97453-1-aduskett@gmail.com> References: <20191021200438.97453-1-aduskett@gmail.com> Message-ID: <20191021200438.97453-5-aduskett@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net From: Adam Duskett meson has support for Python dependencies, to e.g. build Python modules. It parses Python's sysconfig module to find the appropriate configuration variables. However, the sysconfig module is the one for the host, _not_ for the target. Therefore, wrong values may be set. Many of them get overridden anyway by the cross-compilation.conf. One particular one that is problematic is that it uses the python-XXX.pc pkg-config file for the host instead of the target, because it explicitly sets the PKG_CONFIG_LIBDIR found in sysconfig. Use the same trick as for python package: pass PYTHONPATH, PYTHONNOUSERSITE and _PYTHON_SYSCONFIGDATA_NAME in the environment to point to staging instead of host. This ensures the sysconfig from the target is used instead of the one from the host. An alternative would be to patch meson to not use the PKG_CONFIG_LIBDIR from sysconfig. However, it is likely that other problems will pop up at some point because of using the wrong sysconfig. Note that this approach will still break things when meson needs to build something for the host during a target build. Signed-off-by: Adam Duskett --- Changes v1 -> v14: - Add this patch to the series. package/pkg-meson.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 184a22a44a..b6360fb738 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -84,6 +84,9 @@ define $(2)_CONFIGURE_CMDS ) \ package/meson/cross-compilation.conf.in \ > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf + _PYTHON_SYSCONFIGDATA_NAME="$$(if $$(BR2_PACKAGE_PYTHON3),$$(PKG_PYTHON_SYSCONFIGDATA_NAME),_sysconfigdata)" \ + PYTHONPATH="$$(if $$(BR2_PACKAGE_PYTHON3),$$(PYTHON3_PATH),$$(PYTHON_PATH))" \ + PYTHONNOUSERSITE=1 \ PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \ --prefix=/usr \ --libdir=lib \ -- 2.21.0