summaryrefslogtreecommitdiffstats
path: root/package/pkgconf/0001-Fix-all-variables-sysroot-prefix-problem.patch
blob: bac9f6208bfcecea7d9270921274fc4540c4cccc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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

OpenPOWER on IntegriCloud