]> xenbits.xensource.com Git - libvirt.git/commitdiff
ci: Fix handling of $PKG_CONFIG_LIBDIR
authorAndrea Bolognani <abologna@redhat.com>
Mon, 24 Feb 2020 13:59:20 +0000 (14:59 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Mon, 24 Feb 2020 14:40:55 +0000 (15:40 +0100)
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 <abologna@redhat.com>
ci/Makefile

index 03799924b430cc27d92fdb48e68a43ee62aa8d2c..577b130d2f790330dcbb975808fb0a0d6e5a0bb4 100644 (file)
@@ -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)" \