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

Rémi Denis-Courmont remi at remlab.net
Fri Jan 31 14:25:00 CET 2020


Le vendredi 31 janvier 2020, 14:00:27 EET Steve Lhomme a écrit :
> On 2020-01-31 12:23, Rémi Denis-Courmont wrote:
> > Hi,
> > 
> > Why is this not handled in the same manner and location as the other
> > cross-tools?
> 
> If you mean this kind of thing:
> ifneq ($(findstring $(origin PKG_CONFIG),undefined default),)
> PKG_CONFIG := $(HOST)-pkg-config
> endif
> 
> The problem is that these commands are never checked and assumed to
> exist. That would change what we use now as allowing fallback to normal
> pkg-config. I'm not sure it's the case for all the cross compilation we do.
> 
> I could use something like this:
> ifneq ($(findstring $(origin PKG_CONFIG),undefined default),)

I don't think GNU/make provides a default for PKG_CONFIG, so ?= should be 
enough here. But I don't see any reason to test pkg-config in bootstrap over 
make. The original idea was to minimize causes for rerunning configure.

> ifeq ($(which $(HOST)-pkg-config >/dev/null 2>&1 || echo FAIL),)
> PKG_CONFIG := $(HOST)-pkg-config
> else
> PKG_CONFIG := pkg-config
> endif
> endif
> 
> > Le 31 janvier 2020 10:57:29 GMT+02:00, Steve Lhomme <robux4 at ycbcr.xyz> a
> > 
> > écrit :
> >     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)" \
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list