From 058b30b3822f2235667677b21f2908727a873d2e Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Mon, 24 Feb 2020 14:59:20 +0100 Subject: [PATCH] ci: Fix handling of $PKG_CONFIG_LIBDIR There are two environment variables that are baked into our cross-compilation container images at build time, $CONFIGURE_OPTS and $PKG_CONFIG_LIBDIR: the former contain the options necessary to convince configure to perform a cross build rather than a native one, and the latter is necessary so that pkg-config will locate the .pc files for MinGW libraries. Container images that are not intended for cross-compilation will not have either one defined. The problem is that, while an empty $CONFIGURE_OPTS is completely harmless, setting $PKG_CONFIG_LIBDIR to an emtpy value will result in pkg-config not looking in its default search path, thus not finding any library, and subsequently breaking native builds. To work around this issue, only pass $PKG_CONFIG_LIBDIR to sudo when the value is set in the calling environment. Fixes: 71517ae4db35c4dcc6c358d60d3a6d5da0615d39 Signed-off-by: Andrea Bolognani --- ci/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci/Makefile b/ci/Makefile index 03799924b4..577b130d2f 100644 --- a/ci/Makefile +++ b/ci/Makefile @@ -216,12 +216,15 @@ ci-run-command@%: ci-prepare-tree $(CI_ENGINE) run $(CI_ENGINE_ARGS) $(CI_IMAGE_PREFIX)$*$(CI_IMAGE_TAG) \ /bin/bash -c ' \ $(CI_USER_HOME)/prepare || exit 1; \ + if test "$$PKG_CONFIG_LIBDIR"; then \ + pkgconfig_env="PKG_CONFIG_LIBDIR=$$PKG_CONFIG_LIBDIR"; \ + fi; \ sudo \ --login \ --user="#$(CI_UID)" \ --group="#$(CI_GID)" \ CONFIGURE_OPTS="$$CONFIGURE_OPTS" \ - PKG_CONFIG_LIBDIR="$$PKG_CONFIG_LIBDIR" \ + $$pkgconfig_env \ CI_CONT_SRCDIR="$(CI_CONT_SRCDIR)" \ CI_CONT_BUILDDIR="$(CI_CONT_BUILDDIR)" \ CI_SMP="$(CI_SMP)" \ -- GitLab