summaryrefslogtreecommitdiffstats
path: root/src/pkgconf-1-fixes.patch
blob: 9ed65e551809ac200d314c4fb10b92f9aebeeda1 (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
This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 15 Jun 2017 21:05:31 +1000
Subject: [PATCH] main: support undocumented PKG_CONFIG_SYSTEM_INCLUDE_PATH and
 PKG_CONFIG_SYSTEM_LIBRARY_PATH environment variables.

Backported from:
https://github.com/pkgconf/pkgconf/commit/7e6fa325eb668c3462981a16fb4c36270832e00f

See:
https://github.com/mxe/mxe/pull/1785

diff --git a/main.c b/main.c
index 1111111..2222222 100644
--- a/main.c
+++ b/main.c
@@ -56,16 +56,27 @@ static char *sysroot_dir = NULL;
 
 FILE *error_msgout = NULL;
 
+static char *
+fallback_getenv(const char *envname, const char *fallback)
+{
+	const char *data = getenv(envname);
+
+	if (data == NULL)
+		data = fallback;
+
+	return strdup(data);
+}
+
 static bool
 fragment_has_system_dir(pkg_fragment_t *frag)
 {
 	switch (frag->type)
 	{
 	case 'L':
-		if ((want_flags & PKG_KEEP_SYSTEM_CFLAGS) == 0 && !strcasecmp(SYSTEM_LIBDIR, frag->data))
+		if ((want_flags & PKG_KEEP_SYSTEM_CFLAGS) == 0 && !strcasecmp(fallback_getenv("PKG_CONFIG_SYSTEM_LIBRARY_PATH", SYSTEM_LIBDIR), frag->data))
 			return true;
 	case 'I':
-		if ((want_flags & PKG_KEEP_SYSTEM_LIBS) == 0 && !strcasecmp(SYSTEM_INCLUDEDIR, frag->data))
+		if ((want_flags & PKG_KEEP_SYSTEM_LIBS) == 0 && !strcasecmp(fallback_getenv("PKG_CONFIG_SYSTEM_INCLUDE_PATH", SYSTEM_INCLUDEDIR), frag->data))
 			return true;
 	default:
 		break;