mxe/src/pkgconf-1-fixes.patch

51 lines
1.5 KiB
Diff
Raw Permalink Normal View History

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 1/1] 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;