[vlc-commits] contrib: detect the pkg-config variant to use when cross-compiling
Steve Lhomme
git at videolan.org
Thu Mar 19 17:04:45 CET 2020
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 31 09:55:55 2020 +0100| [ee22d240ef3055a972b3716b8a02028d6c20ce7f] | committer: Steve Lhomme
contrib: detect the pkg-config variant to use when cross-compiling
And use it for all contribs detection and building.
on Debian, the x86_64-w64-mingw32-pkg-config may exist and run but give an
error when actually trying to find a package because the package architecture
doesn't exist for that target. So we have to test it thoroughly.
If we revert to pkg-config when cross-compiling we also force the
PKG_CONFIG_LIBDIR, otherwise we leave it untouched as the system/environment may
provide more that we know.
Both /usr/$(HOST)/lib/pkgconfig and /usr/lib/$(HOST)/pkgconfig variants exist,
at least on Debian.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ee22d240ef3055a972b3716b8a02028d6c20ce7f
---
contrib/src/main.mak | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 555d96a4b4..bff9cd8241 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -82,6 +82,7 @@ RANLIB ?= ranlib
STRIP ?= strip
WIDL ?= widl
WINDRES ?= windres
+PKG_CONFIG ?= pkg-config
else
ifneq ($(findstring $(origin CC),undefined default),)
CC := $(HOST)-gcc
@@ -99,6 +100,22 @@ RANLIB ?= $(HOST)-ranlib
STRIP ?= $(HOST)-strip
WIDL ?= $(HOST)-widl
WINDRES ?= $(HOST)-windres
+
+# On Debian x86_64-w64-mingw32-pkg-config exists, runs but returns an error when checking packages
+ifeq ($(shell unset PKG_CONFIG_LIBDIR; $(HOST)-pkg-config --version 1>/dev/null 2>/dev/null || echo FAIL),)
+PKG_CONFIG ?= $(HOST)-pkg-config
+else
+# Use the regular pkg-config and set some PKG_CONFIG_LIBDIR ourselves
+PKG_CONFIG = pkg-config
+ifeq ($(findstring $(origin PKG_CONFIG_LIBDIR),undefined),)
+# an extra PKG_CONFIG_LIBDIR was provided, use it prioritarily
+PKG_CONFIG_LIBDIR := $(PKG_CONFIG_LIBDIR):/usr/$(HOST)/lib/pkgconfig:/usr/lib/$(HOST)/pkgconfig
+else
+PKG_CONFIG_LIBDIR := /usr/$(HOST)/lib/pkgconfig:/usr/lib/$(HOST)/pkgconfig
+endif
+export PKG_CONFIG_LIBDIR
+endif
+
endif
ifdef HAVE_ANDROID
@@ -208,13 +225,10 @@ export ACLOCAL_AMFLAGS
# Tools #
#########
-PKG_CONFIG ?= pkg-config
ifdef HAVE_CROSS_COMPILE
# This inhibits .pc file from within the cross-compilation toolchain sysroot.
# Hopefully, nobody ever needs that.
PKG_CONFIG_PATH := /usr/share/pkgconfig
-PKG_CONFIG_LIBDIR := /usr/$(HOST)/lib/pkgconfig:/usr/lib/$(HOST)/pkgconfig
-export PKG_CONFIG_LIBDIR
endif
PKG_CONFIG_PATH := $(PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)
ifeq ($(findstring mingw32,$(BUILD)),mingw32)
More information about the vlc-commits
mailing list