From: Peter Seiderer <ps.report@gmx.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] pkgconf: fix incorrect variable-directory sysroot prefixing
Date: Tue, 3 Nov 2015 19:57:03 +0100 [thread overview]
Message-ID: <20151103195703.76aa56ea@gmx.net> (raw)
In-Reply-To: <1446501424-26609-1-git-send-email-gustavo@zacarias.com.ar>
Hello Gustavo,
On Mon, 2 Nov 2015 18:57:04 -0300, Gustavo Zacarias <gustavo@zacarias.com.ar> wrote:
> 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.
>
> Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
> ---
> ...-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
>
> diff --git a/package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch b/package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch
> new file mode 100644
> index 0000000..bac9f62
> --- /dev/null
> +++ b/package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch
> @@ -0,0 +1,58 @@
> +From abc7a780f2a52a1aa3ee288e17140b817b545cc3 Mon Sep 17 00:00:00 2001
> +From: Gustavo Zacarias <gustavo@zacarias.com.ar>
> +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 <gustavo@zacarias.com.ar>
> +---
> + 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
> +
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...
Tested-by: Peter Seiderer <ps.report@gmx.net>
Regards,
Peter
next prev parent reply other threads:[~2015-11-03 18:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-02 21:57 [Buildroot] [PATCH v2] pkgconf: fix incorrect variable-directory sysroot prefixing Gustavo Zacarias
2015-11-03 18:57 ` Peter Seiderer [this message]
2015-11-04 17:36 ` Yann E. MORIN
2015-11-06 12:37 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151103195703.76aa56ea@gmx.net \
--to=ps.report@gmx.net \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox