diff mbox series

pkg-config-native,librsvg-native: fix EXTRA_NATIVE_PKGCONFIG_PATH

Message ID 20250319161327.2701095-1-peter@berginkonsult.se
State New
Headers show
Series pkg-config-native,librsvg-native: fix EXTRA_NATIVE_PKGCONFIG_PATH | expand

Commit Message

Peter Bergin March 19, 2025, 4:13 p.m. UTC
When building librsvg-native the variable PKG_CONFIG_PATH
was incorrect in the bitbake environment but handled correct due
to the pkg-config-native wrapper. Commit [1] and [2]
introduced some inconsistens of EXTRA_NATIVE_PKGCONFIG_PATH
where it was prepended in pkg-config-native wrappers but
appended in native.bbclass.

  meta/classes-recipe/native.bbclass:
    PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"

This commit will try to resolve this to always append the
EXTRA_NATIVE_PKGCONFIG_PATH. It is tested by building
librsvg-native and also checking bitbake environment
before and after.

[1] https://git.openembedded.org/openembedded-core/commit?id=2bc050146d47b14d890a1b0db2b55f9057a08b65
[2] https://git.openembedded.org/openembedded-core/commit?id=ae4824f4f6234884a245bce314d6305ad8eb982d

Signed-off-by: Peter Bergin <peter@berginkonsult.se>
Cc: Alexander Kanavin <alex@linutronix.de>
---
 meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in     | 2 +-
 meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in | 2 +-
 meta/recipes-gnome/librsvg/librsvg_2.59.2.bb                   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

Alexander Kanavin March 19, 2025, 5:17 p.m. UTC | #1
On Wed, 19 Mar 2025 at 17:14, Peter Bergin via lists.openembedded.org
<peter=berginkonsult.se@lists.openembedded.org> wrote:
> This commit will try to resolve this to always append the
> EXTRA_NATIVE_PKGCONFIG_PATH. It is tested by building
> librsvg-native and also checking bitbake environment
> before and after.

Changes like this make me a bit nervous. Querying pkg-config is *very*
sensitive to the correct order of paths in variables, and things can
easily break when rearranging that.

Does target librsvg build ok as well? If so, this can perhaps go on
the autobuilder.

Alex
Peter Bergin March 19, 2025, 9:45 p.m. UTC | #2
On 2025-03-19 18:17, Alexander Kanavin wrote:
> On Wed, 19 Mar 2025 at 17:14, Peter Bergin via lists.openembedded.org
> <peter=berginkonsult.se@lists.openembedded.org> wrote:
>> This commit will try to resolve this to always append the
>> EXTRA_NATIVE_PKGCONFIG_PATH. It is tested by building
>> librsvg-native and also checking bitbake environment
>> before and after.
> Changes like this make me a bit nervous. Querying pkg-config is *very*
> sensitive to the correct order of paths in variables, and things can
> easily break when rearranging that.
>
> Does target librsvg build ok as well? If so, this can perhaps go on
> the autobuilder.

Yes, librsvg builds as well and shall not be affected as the changes is 
only for native. I get more nervous about having badly formed paths 
among the variables. ;-) I hope we can let the autobuilder mangle this 
to get a verdict. I applied it to my big customer project with a lot of 
native packages (on scarthgap) and have not seen any regression there. I 
also searched for the usage of EXTRA_NATIVE_PKGCONFIG_PATH among my 
layers and only found two librsvg and ibus-native (meta-gnome).

Before:

/work/yocto/poky/build/aarch64$ bitbake librsvg-native -e | grep 
'PKG_CONFIG_PATH='
export 
PKG_CONFIG_PATH="/work/yocto/poky/build/aarch64/tmp/work/x86_64-linux/librsvg-native/2.59.2/recipe-sysroot-native/usr/lib/pkgconfig:/work/yocto/poky/build/aarch64/tmp/work/x86_64-linux/librsvg-native/2.59.2/recipe-sysroot-native/usr/share/*pkgconfig/work*/yocto/poky/build/aarch64/tmp/work/x86_64-linux/librsvg-native/2.59.2/build/meson-uninstalled*:*"

With patch:

/work/yocto/poky/build/aarch64$ bitbake librsvg-native -e | grep 
'PKG_CONFIG_PATH='
export 
PKG_CONFIG_PATH="/work/yocto/poky/build/aarch64/tmp/work/x86_64-linux/librsvg-native/2.59.2/recipe-sysroot-native/usr/lib/pkgconfig:/work/yocto/poky/build/aarch64/tmp/work/x86_64-linux/librsvg-native/2.59.2/recipe-sysroot-native/usr/share/*pkgconfig:/work*/yocto/poky/build/aarch64/tmp/work/x86_64-linux/librsvg-native/2.59.2/build/meson-uninstalled"

Best regards,
/Peter
diff mbox series

Patch

diff --git a/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in b/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in
index fd5ab6b1fa..0d736fe4d4 100644
--- a/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in
+++ b/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in
@@ -1,6 +1,6 @@ 
 #! /bin/sh
 
-PKG_CONFIG_PATH="$EXTRA_NATIVE_PKGCONFIG_PATH@PATH_NATIVE@"
+PKG_CONFIG_PATH="@PATH_NATIVE@$EXTRA_NATIVE_PKGCONFIG_PATH"
 unset PKG_CONFIG_SYSROOT_DIR
 
 pkg-config "$@"
diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in
index d4bb4f8c06..8addefbb80 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig/pkg-config-native.in
@@ -1,6 +1,6 @@ 
 #! /bin/sh
 
-export PKG_CONFIG_PATH="$EXTRA_NATIVE_PKGCONFIG_PATH@PATH_NATIVE@"
+export PKG_CONFIG_PATH="@PATH_NATIVE@$EXTRA_NATIVE_PKGCONFIG_PATH"
 export PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
 unset PKG_CONFIG_SYSROOT_DIR
 
diff --git a/meta/recipes-gnome/librsvg/librsvg_2.59.2.bb b/meta/recipes-gnome/librsvg/librsvg_2.59.2.bb
index 7718f2bb48..983fc75eed 100644
--- a/meta/recipes-gnome/librsvg/librsvg_2.59.2.bb
+++ b/meta/recipes-gnome/librsvg/librsvg_2.59.2.bb
@@ -34,7 +34,7 @@  UPSTREAM_CHECK_REGEX = "librsvg-(?P<pver>\d+\.\d+\.(?!9\d+)\d+)"
 # for cargo to be happy
 BASEDEPENDS:append = " cargo-native"
 
-export EXTRA_NATIVE_PKGCONFIG_PATH = "${B}/meson-uninstalled:"
+export EXTRA_NATIVE_PKGCONFIG_PATH = ":${B}/meson-uninstalled"
 export RUST_BACKTRACE = "full"
 export RUSTFLAGS