pkgconf --variable path expansion with PKG_CONFIG_SYSROOT_DIR #205

Closed
opened 2021-01-05 00:26:51 +00:00 by floppym · 0 comments
floppym commented 2021-01-05 00:26:51 +00:00 (Migrated from github.com)

On Gentoo Linux, we have a tool called that is used to create cross-compiler environments. crossdev installs a script cross-pkg-config which sets a number of environment variables (including PKG_CONFIG_SYSROOT_DIR) and then calls the real pkg-config.

pkgconf's behavior regarding sysroot causes some problems for us for packages that build against udev and/or systemd. These projects install pc files that define variables like udevdir=/lib/udev and systemdsystemunitdir=/lib/systemd/system. These paths are referenced by other packages to determine where udev rules and systemd units should be installed.

pkgconf prefixes the paths with the sysroot value, which results in the files being installed in the wrong place.

Staging path with pkgconfig (freedesktop):

$DESTDIR/lib/systemd/system/foo.serice

Staging path with pkgconf:

$DESTDIR/$PKG_CONFIG_SYSROOT_DIR/lib/systemd/system/foo.service

Our package manager then copies the files to the appropriate root directory. With pkgconf, this causes the path to be double-prefixed with sysroot.

Long story short, we would really like a way to have PKG_CONFIG_SYSROOT_DIR apply to cflags and libs, but not to variables which are used to determine install locations.

This behavior was discussed in #69, and the following was proposed:

If you have a specific use-case for the freedesktop behaviour, we could add a runtime option to force non-munged output with PKG_CONFIG_SYSROOT_DIR.

I hope my explanation above serves as a suitable use case.

On Gentoo Linux, we have a tool called that is used to create cross-compiler environments. crossdev installs a script [cross-pkg-config](https://gitweb.gentoo.org/proj/crossdev.git/tree/wrappers/cross-pkg-config) which sets a number of environment variables (including `PKG_CONFIG_SYSROOT_DIR`) and then calls the real pkg-config. pkgconf's behavior regarding sysroot causes some problems for us for packages that build against udev and/or systemd. These projects install pc files that define variables like `udevdir=/lib/udev` and `systemdsystemunitdir=/lib/systemd/system`. These paths are referenced by other packages to determine where udev rules and systemd units should be installed. pkgconf prefixes the paths with the sysroot value, which results in the files being installed in the wrong place. Staging path with pkgconfig (freedesktop): ``` $DESTDIR/lib/systemd/system/foo.serice ``` Staging path with pkgconf: ``` $DESTDIR/$PKG_CONFIG_SYSROOT_DIR/lib/systemd/system/foo.service ``` Our package manager then copies the files to the appropriate root directory. With pkgconf, this causes the path to be double-prefixed with sysroot. Long story short, we would really like a way to have PKG_CONFIG_SYSROOT_DIR apply to cflags and libs, but not to variables which are used to determine install locations. This behavior was discussed in #69, and the following was proposed: > If you have a specific use-case for the freedesktop behaviour, we could add a runtime option to force non-munged output with PKG_CONFIG_SYSROOT_DIR. I hope my explanation above serves as a suitable use case.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#205
There is no content yet.