[vlc-devel] [PATCH v2 3/5] contrib: detect the pkg-config variant to use when cross-compiling

Steve Lhomme robux4 at ycbcr.xyz
Thu Mar 19 17:02:29 CET 2020


On 2020-03-19 16:34, Alexandre Janniaux wrote:
> Hi,
> 
> On Wed, Mar 18, 2020 at 09:46:14AM +0100, Steve Lhomme wrote:
>> 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.
>> ---
>>   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 555d96a4b42..bff9cd82413 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
> 
> The PKG_CONFIG assignment above is missing an additional ?= right?
> Otherwise there is no point in putting a ?= above.

No in the former case the HOST-pkg-config is tested but the user is 
allowed to change the value.
In the latter case we force the PKG_CONFIG_LIBDIR and so we don't want 
to use whatever the user provided that might mess with what we're doing.


More information about the vlc-devel mailing list