pkgconf: fix incorrect variable-directory sysroot prefixing
PATCH v2 1/1 pkgconf: fix incorrect variable-directory sysroot prefixing
According to the pkg-config documents ("specification") when sysroot-prefixing is enabled via PKG_CONFIG_SYSROOT_DIR this should only be applied to -I/-L directories (includes, library directories), and not to all of the other variables that can specify a directory.
However xorg uses mapdir/sdkdir in a similar fashion in what could be considered an abuse of the spec, hence needs to be prefixed as well. And what's more, it also uses includedir in a nonstandard fashion just requesting the value via 'pkg-config --variable=includedir libfoo' which doesn't pass the standard prefixing rules for the --cflags and --libs invocation.
This patch makes pkgconf behave in the pkg-config specified way with the added exception for the includedir, libdir, mapdir and sdkdir variables which are prefixed.
--- ...-Fix-all-variables-sysroot-prefix-problem.patch | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch
package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch new file +58 -0
@@ -0,0 +1,58 @@ +From abc7a780f2a52a1aa3ee288e17140b817b545cc3 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias <[email protected]> +Date: Mon, 2 Nov 2015 18:38:00 -0300 +Subject: [PATCH] Fix all-variables sysroot prefix problem + +According to the pkg-config specifications (or rather documentation) +only the -L/-I directory entries should be sysroot-prefixed. + +We also need to prefix the mapdir/sdkdir variables since they're used by +xorg and expected that way. + +Also allow prefixing for includedir and libdir since in some silly cases +the directories may be requested barebones via pkg-config +--variable=includedir libfool for example. + +Signed-off-by: Gustavo Zacarias <[email protected]> +--- + main.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/main.c b/main.c +index 6947126..52d16c2 100644 +--- a/main.c ++++ b/main.c +@@ -313,9 +313,12 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags) + memset(req->buf, 0, sizeof(req->buf)); + + if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) && +- (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir)))) +- strlcat(req->buf, sysroot_dir, sizeof(req->buf)); +- ++ (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) && ++ (!strcmp(req->variable, "includedir") || \ ++ !strcmp(req->variable, "libdir") || \ ++ !strcmp(req->variable, "mapdir") || \ ++ !strcmp(req->variable, "sdkdir"))) ++ strlcat(req->buf, sysroot_dir, sizeof(req->buf)); + strlcat(req->buf, var, sizeof(req->buf)); + return; + } +@@ -323,8 +326,12 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags) + strlcat(req->buf, " ", sizeof(req->buf)); + + if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) && +- (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir)))) +- strlcat(req->buf, sysroot_dir, sizeof(req->buf)); ++ (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) && ++ (!strcmp(req->variable, "includedir") || \ ++ !strcmp(req->variable, "libdir") || \ ++ !strcmp(req->variable, "mapdir") || \ ++ !strcmp(req->variable, "sdkdir"))) ++ strlcat(req->buf, sysroot_dir, sizeof(req->buf)); + + strlcat(req->buf, var, sizeof(req->buf)); + } +-- +2.4.10 +
Signature · 1 line
2.4.10
PATCH v2 1/1 pkgconf: fix incorrect variable-directory sysroot prefixing
Hello Gustavo,
Quoted 76 lines · Gustavo Zacarias
According to the pkg-config documents ("specification") when sysroot-prefixing is enabled via
PKG_CONFIG_SYSROOT_DIRthis should only be applied to -I/-L directories (includes, library directories), and not to all of the other variables that can specify a directory.However xorg uses mapdir/sdkdir in a similar fashion in what could be considered an abuse of the spec, hence needs to be prefixed as well. And what's more, it also uses includedir in a nonstandard fashion just requesting the value via 'pkg-config --variable=includedir libfoo' which doesn't pass the standard prefixing rules for the --cflags and --libs invocation.
This patch makes pkgconf behave in the pkg-config specified way with the added exception for the includedir, libdir, mapdir and sdkdir variables which are prefixed.
Signed-off-by Gustavo Zacarias <[email protected]>--- ...-Fix-all-variables-sysroot-prefix-problem.patch | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patchpackage/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch new file +48
-0@@ -0,0 +1,58 @@ +From abc7a780f2a52a1aa3ee288e17140b817b545cc3 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias <[email protected]> +Date: Mon, 2 Nov 2015 18:38:00 -0300 +Subject: [PATCH] Fix all-variables sysroot prefix problem + +According to the pkg-config specifications (or rather documentation) +only the -L/-I directory entries should be sysroot-prefixed. + +We also need to prefix the mapdir/sdkdir variables since they're used by +xorg and expected that way. + +Also allow prefixing for includedir and libdir since in some silly cases +the directories may be requested barebones via pkg-config +--variable=includedir libfool for example. + +Signed-off-by: Gustavo Zacarias <[email protected]> +--- + main.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/main.c b/main.c +index 6947126..52d16c2 100644 +--- a/main.c ++++ b/main.c +@@ -313,9 +313,12 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags) + memset(req->buf, 0, sizeof(req->buf)); + + if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) && +- (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir)))) +- strlcat(req->buf, sysroot_dir, sizeof(req->buf)); +- ++ (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) && ++ (!strcmp(req->variable, "includedir") || \ ++ !strcmp(req->variable, "libdir") || \ ++ !strcmp(req->variable, "mapdir") || \ ++ !strcmp(req->variable, "sdkdir"))) ++ strlcat(req->buf, sysroot_dir, sizeof(req->buf)); + strlcat(req->buf, var, sizeof(req->buf)); + return; + } +@@ -323,8 +326,12 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags) + strlcat(req->buf, " ", sizeof(req->buf)); + + if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) && +- (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir)))) +- strlcat(req->buf, sysroot_dir, sizeof(req->buf)); ++ (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) && ++ (!strcmp(req->variable, "includedir") || \
package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch line 58
Quoted 10 lines
package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch new file +10
-0++ !strcmp(req->variable, "libdir") || \ ++ !strcmp(req->variable, "mapdir") || \ ++ !strcmp(req->variable, "sdkdir"))) ++ strlcat(req->buf, sysroot_dir, sizeof(req->buf)); + + strlcat(req->buf, var, sizeof(req->buf)); + } +-- +2.4.10 +
Still works for my (simple) lib4vl/qt/moc case, './host/usr/bin/pkg-config --variable=moc_location QtCore' (same for uic/rcc) returns the correct value...
Regards,
Peter
PATCH v2 1/1 pkgconf: fix incorrect variable-directory sysroot prefixing
In reply to Gustavo ZacariasGustavo, All,
On 2015-11-02 18:57 -0300, Gustavo Zacarias spake thusly:
Quoted 12 lines
According to the pkg-config documents ("specification") when sysroot-prefixing is enabled via
PKG_CONFIG_SYSROOT_DIRthis should only be applied to -I/-L directories (includes, library directories), and not to all of the other variables that can specify a directory.However xorg uses mapdir/sdkdir in a similar fashion in what could be considered an abuse of the spec, hence needs to be prefixed as well. And what's more, it also uses includedir in a nonstandard fashion just requesting the value via 'pkg-config --variable=includedir libfoo' which doesn't pass the standard prefixing rules for the --cflags and --libs invocation.
Quoted 5 lines
This patch makes pkgconf behave in the pkg-config specified way with the added exception for the includedir, libdir, mapdir and sdkdir variables which are prefixed.
Signed-off-by Gustavo Zacarias <[email protected]>
Thanks! :-)
Regards,
Yann E. MORIN.
Quoted 76 lines
--- ...-Fix-all-variables-sysroot-prefix-problem.patch | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patchpackage/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch new file +58
-0@@ -0,0 +1,58 @@ +From abc7a780f2a52a1aa3ee288e17140b817b545cc3 Mon Sep 17 00:00:00 2001 +From: Gustavo Zacarias <[email protected]> +Date: Mon, 2 Nov 2015 18:38:00 -0300 +Subject: [PATCH] Fix all-variables sysroot prefix problem + +According to the pkg-config specifications (or rather documentation) +only the -L/-I directory entries should be sysroot-prefixed. + +We also need to prefix the mapdir/sdkdir variables since they're used by +xorg and expected that way. + +Also allow prefixing for includedir and libdir since in some silly cases +the directories may be requested barebones via pkg-config +--variable=includedir libfool for example. + +Signed-off-by: Gustavo Zacarias <[email protected]> +--- + main.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/main.c b/main.c +index 6947126..52d16c2 100644 +--- a/main.c ++++ b/main.c +@@ -313,9 +313,12 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags) + memset(req->buf, 0, sizeof(req->buf)); + + if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) && +- (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir)))) +- strlcat(req->buf, sysroot_dir, sizeof(req->buf)); +- ++ (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) && ++ (!strcmp(req->variable, "includedir") || \ ++ !strcmp(req->variable, "libdir") || \ ++ !strcmp(req->variable, "mapdir") || \ ++ !strcmp(req->variable, "sdkdir"))) ++ strlcat(req->buf, sysroot_dir, sizeof(req->buf)); + strlcat(req->buf, var, sizeof(req->buf)); + return; + } +@@ -323,8 +326,12 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags) + strlcat(req->buf, " ", sizeof(req->buf)); + + if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) && +- (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir)))) +- strlcat(req->buf, sysroot_dir, sizeof(req->buf)); ++ (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) && ++ (!strcmp(req->variable, "includedir") || \ ++ !strcmp(req->variable, "libdir") || \ ++ !strcmp(req->variable, "mapdir") || \ ++ !strcmp(req->variable, "sdkdir"))) ++ strlcat(req->buf, sysroot_dir, sizeof(req->buf)); + + strlcat(req->buf, var, sizeof(req->buf)); + } +-- +2.4.10 +Signature · 6 lines
2.4.10 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
Thomas Petazzoni
AppliedPATCH v2 1/1 pkgconf: fix incorrect variable-directory sysroot prefixing
In reply to Gustavo ZacariasDear Gustavo Zacarias,
Quoted 16 lines · Gustavo Zacarias
According to the pkg-config documents ("specification") when sysroot-prefixing is enabled via
PKG_CONFIG_SYSROOT_DIRthis should only be applied to -I/-L directories (includes, library directories), and not to all of the other variables that can specify a directory.However xorg uses mapdir/sdkdir in a similar fashion in what could be considered an abuse of the spec, hence needs to be prefixed as well. And what's more, it also uses includedir in a nonstandard fashion just requesting the value via 'pkg-config --variable=includedir libfoo' which doesn't pass the standard prefixing rules for the --cflags and --libs invocation.
This patch makes pkgconf behave in the pkg-config specified way with the added exception for the includedir, libdir, mapdir and sdkdir variables which are prefixed.
Quoted 5 lines
Signed-off-by Gustavo Zacarias <[email protected]>--- ...-Fix-all-variables-sysroot-prefix-problem.patch | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch
Applied, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com