[vlc-devel] [PATCH] contrib: detect the pkg-config variant to use

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 31 09:57:29 CET 2020


And use it for all contribs detection and building.

The PKG_CONFIG is not written in the Makefile and can be overriden in config.mak
---
 contrib/bootstrap    | 17 +++++++++++++++++
 contrib/src/main.mak |  6 ++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/contrib/bootstrap b/contrib/bootstrap
index 5ed5f6f25d3..4472837e27b 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -160,6 +160,22 @@ then
 	PREFIX="${PREFIX%/}"
 fi
 
+printf "Using pkg-config...      "
+PKG_CONFIG=`which pkg-config`
+PKG_CONFIG_PROG="$HOST-pkg-config"
+if test -z "`which $PKG_CONFIG_PROG`"
+then
+	PKG_CONFIG_PROG="pkg-config"
+	if test -z "`which $PKG_CONFIG_PROG`"
+	then
+		PKG_CONFIG_PROG=""
+	fi
+fi
+if test -n "$PKG_CONFIG_PROG"
+then
+	echo "$PKG_CONFIG_PROG"
+fi
+
 #
 # Prepare files
 #
@@ -171,6 +187,7 @@ cat >&3 << EOF
 # Any change will be overwritten if ../bootstrap is run again.
 BUILD := $BUILD
 HOST := $HOST
+PKG_CONFIG := $PKG_CONFIG_PROG
 PKGS_DISABLE := $PKGS_DISABLE
 PKGS_ENABLE := $PKGS_ENABLE
 EOF
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 275188ee18c..3d6a9de41a8 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -224,7 +224,6 @@ 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.
@@ -315,7 +314,8 @@ endif
 HOSTTOOLS := \
 	CC="$(CC)" CXX="$(CXX)" LD="$(LD)" \
 	AR="$(AR)" CCAS="$(CCAS)" RANLIB="$(RANLIB)" STRIP="$(STRIP)" \
-	PATH="$(PREFIX)/bin:$(PATH)"
+	PATH="$(PREFIX)/bin:$(PATH)" \
+	PKG_CONFIG="$(PKG_CONFIG)"
 
 HOSTVARS_MESON := $(HOSTTOOLS) \
 	CPPFLAGS="$(CPPFLAGS)" \
@@ -608,7 +608,6 @@ endif
 ifdef HAVE_CROSS_COMPILE
 	echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> $@
 	echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> $@
-	echo "set(PKG_CONFIG_EXECUTABLE $(PKG_CONFIG))" >> $@
 endif
 
 MESON_SYSTEM_NAME =
@@ -634,7 +633,6 @@ endif
 crossfile.meson: $(SRC)/gen-meson-crossfile.py
 	$(HOSTVARS_MESON) \
 	WINDRES="$(WINDRES)" \
-	PKG_CONFIG="$(PKG_CONFIG)" \
 	HOST_SYSTEM="$(MESON_SYSTEM_NAME)" \
 	HOST_ARCH="$(subst i386,x86,$(ARCH))" \
 	HOST="$(HOST)" \
-- 
2.17.1



More information about the vlc-devel mailing list