[OpenWrt-Devel] [PATCHv3] tools/pkg-config: Replace with pkgconf

Andre Heider a.heider at gmail.com
Wed Nov 27 06:26:39 EST 2019


On 27/11/2019 11:49, Petr Štetiar wrote:
> Rosen Penev <rosenp at gmail.com> [2019-11-25 14:44:18]:
> 
> Hi,
> 
> you're trying to do a lot of things in one patch, making it hard to review,
> please split it up.
> 
> 1. switch to pkgconf
> 2. shell check fix
> 3. meson fix
> 
>> -ifeq ($(HOST_OS),Darwin)
>> -HOST_LDFLAGS += -framework CoreFoundation -framework Carbon
>> -endif
> 
> So it compiles and works on macOS just fine? You can ask Kevin (ldir) on IRC
> to build test this for you.
> 
>> diff --git a/tools/pkgconf/files/pkg-config b/tools/pkgconf/files/pkg-config
>> new file mode 100755
>> index 0000000000..6579a14f86
>> --- /dev/null
>> +++ b/tools/pkgconf/files/pkg-config
> 
> What has happened with the old pkg-config? Have you forget to `git mv/git add`?
> 
>> @@ -0,0 +1,6 @@
>> +#!/bin/sh
>> +
>> +"$(dirname "$0")/pkg-config.real" \
> 
> This change was suggested by shellcheck? Why is this change needed? This needs
> to go into separate commit with a proper description.
> 
>> diff --git a/tools/pkgconf/patches/0001-f-pkgconf-meson.patch b/tools/pkgconf/patches/0001-f-pkgconf-meson.patch
>> new file mode 100644
>> index 0000000000..3ed47adc95
>> --- /dev/null
>> +++ b/tools/pkgconf/patches/0001-f-pkgconf-meson.patch
>> @@ -0,0 +1,31 @@
>> +From 05ef58532b75c36fc19eb9d2d1fe4c46195706bf Mon Sep 17 00:00:00 2001
>> +From: Andre Heider <a.heider at gmail.com>
>> +Date: Mon, 25 Nov 2019 09:36:47 +0100
>> +Subject: [PATCH] f pkgconf/meson
> 
> This patch needs a better name and better explanation, description. This is
> some upstream backport or whats the origin of this patch?

That was just a quick & dirty patch from me to get it working, that's 
why it lacks any sort of explanation ;)

If I read that right Rosen accidentally added my openwrt patch to the 
patches/ folder, and not the pkgconf patch within ;) The "f" at the 
start tried to imply that it should be "fixup"'ed on rebase, but that 
obviously didn't work out :D

> 
>> +---
>> + tools/pkgconf/patches/meson.patch | 12 ++++++++++++
>> + 1 file changed, 12 insertions(+)
>> + create mode 100644 tools/pkgconf/patches/meson.patch
>> +
>> +diff --git a/tools/pkgconf/patches/meson.patch b/tools/pkgconf/patches/meson.patch
>> +new file mode 100644
>> +index 0000000000..e0a2946f32
>> +--- /dev/null
>> ++++ b/tools/pkgconf/patches/meson.patch
>> +@@ -0,0 +1,12 @@
>> ++diff -ur pkgconf-1.6.3-orig/cli/main.c pkgconf-1.6.3/cli/main.c
>> ++--- pkgconf-1.6.3-orig/cli/main.c	2019-07-12 13:53:12.000000000 +0200
>> +++++ pkgconf-1.6.3/cli/main.c	2019-11-25 09:32:53.512784479 +0100
>> ++@@ -1002,7 +1002,7 @@
>> ++
>> ++ 	if ((want_flags & PKG_VERSION) == PKG_VERSION)
>> ++ 	{
>> ++-		if (argc > 2)
>> +++		if (0 && argc > 2)
> 
> Uh?
> 
> It's just me or this seems like a hack, something which should be fixed in
> meson instead? I would prefer to have a patch which is accepted upstream.
> pkgconf is maintained, right?

What openwrt does it wrap pkg-config/pkgconf in a shell script to add 
additional arguments for cross compiling (those --define-variable 
above). That wrapper is then passed to build systems as pkg-config.

Now meson probes pkg-config with the --version argument to see if it's a 
working binary or whatever. pkgconf then sees --version with additional 
arguments and decides to be "smart" and does something completely 
different than just printing its version. That in return errors out, 
meson thinks pkg-config is unusable and the whole build fails.

The patch gets rid of that "smart" part, which makes meson and the 
wrapped pkgconf play together.

The original pkg-config doesn't have this issue.

There's a bug report here:
https://todo.sr.ht/~kaniini/pkgconf/6

I didn't pursue upstreaming it because it looks like merge request at 
github are ignored and I didn't feel like signing up at upstreams own page.

Hope that helps,
Andre

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list