libpkgconf: pkg: do not override pc_sysrootdir when emulating pkgconf 1.x

In pkgconf 1.x, we unconditionally prepend PKG_CONFIG_SYSROOT_DIR if
it is not already present.  Emulate this by not overriding pc_sysrootdir
in cases where the .pc file is outside the sysroot.

Signed-off-by: Ariadne Conill <ariadne@ariadne.space>
This commit is contained in:
Ariadne Conill 2025-12-20 14:39:33 -08:00
parent dc0805a3ad
commit c8bfa9fee0

View File

@ -649,7 +649,8 @@ pkgconf_pkg_new_from_path(pkgconf_client_t *client, const char *filename, unsign
* package.
* See https://github.com/pkgconf/pkgconf/issues/213
*/
if (client->sysroot_dir && strncmp(pkg->pc_filedir, client->sysroot_dir, strlen(client->sysroot_dir)))
if (client->sysroot_dir != NULL && strncmp(pkg->pc_filedir, client->sysroot_dir, strlen(client->sysroot_dir)) &&
!(client->flags & PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES))
pkgconf_tuple_add(client, &pkg->vars, "pc_sysrootdir", "", false, pkg->flags);
/* make module id */