1 From aa6bbc09e68426592faf722630fe92b6ede75bc8 Mon Sep 17 00:00:00 2001
2 From: Gustavo Zacarias <gustavo@zacarias.com.ar>
3 Date: Mon, 2 Nov 2015 18:38:00 -0300
4 Subject: [PATCH] Fix all-variables sysroot prefix problem
6 According to the pkg-config specifications (or rather documentation)
7 only the -L/-I directory entries should be sysroot-prefixed.
9 We also need to prefix the mapdir/sdkdir variables since they're used by
10 xorg and expected that way.
12 Also allow prefixing for includedir and libdir since in some silly cases
13 the directories may be requested barebones via pkg-config
14 --variable=includedir libfool for example.
16 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
18 Added pkgdatadir to the list of to-be-prefixed variables.
20 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
22 main.c | 19 ++++++++++++++-----
23 1 file changed, 14 insertions(+), 5 deletions(-)
25 diff --git a/main.c b/main.c
26 index 6947126..ce5e18f 100644
29 @@ -313,9 +313,13 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags)
30 memset(req->buf, 0, sizeof(req->buf));
32 if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) &&
33 - (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))))
34 - strlcat(req->buf, sysroot_dir, sizeof(req->buf));
36 + (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) &&
37 + (!strcmp(req->variable, "includedir") || \
38 + !strcmp(req->variable, "libdir") || \
39 + !strcmp(req->variable, "mapdir") || \
40 + !strcmp(req->variable, "pkgdatadir") || \
41 + !strcmp(req->variable, "sdkdir")))
42 + strlcat(req->buf, sysroot_dir, sizeof(req->buf));
43 strlcat(req->buf, var, sizeof(req->buf));
46 @@ -323,8 +327,13 @@ print_variable(pkg_t *pkg, void *data, unsigned int flags)
47 strlcat(req->buf, " ", sizeof(req->buf));
49 if (*var == '/' && (flags & PKGF_MUNGE_SYSROOT_PREFIX) &&
50 - (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))))
51 - strlcat(req->buf, sysroot_dir, sizeof(req->buf));
52 + (sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))) &&
53 + (!strcmp(req->variable, "includedir") || \
54 + !strcmp(req->variable, "libdir") || \
55 + !strcmp(req->variable, "mapdir") || \
56 + !strcmp(req->variable, "pkgdatadir") || \
57 + !strcmp(req->variable, "sdkdir")))
58 + strlcat(req->buf, sysroot_dir, sizeof(req->buf));
60 strlcat(req->buf, var, sizeof(req->buf));