Skip to content

Instantly share code, notes, and snippets.

@dankegel
Created October 2, 2013 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dankegel/6788768 to your computer and use it in GitHub Desktop.
Save dankegel/6788768 to your computer and use it in GitHub Desktop.
Hacky patch to make --keep-system-cflags and --keep-system-libs the default, for when you install pkgconf to a different prefix than the compiler, and you have a library in the same nonstandard prefix.
--- pkgconf-0.9.3/main.c.old 2013-10-01 19:48:42.000000000 -0700
+++ pkgconf-0.9.3/main.c 2013-10-01 19:51:24.000000000 -0700
@@ -1,3 +1,5 @@
+#define ALWAYS_KEEP 1
+
/*
* main.c
* main() routine, printer functions
@@ -535,6 +537,9 @@
char *required_module_version = NULL;
want_flags = 0;
+#ifdef ALWAYS_KEEP
+ want_flags = (PKG_KEEP_SYSTEM_CFLAGS|PKG_KEEP_SYSTEM_LIBS);
+#endif
struct pkg_option options[] = {
{ "version", no_argument, &want_flags, PKG_VERSION|PKG_PRINT_ERRORS, },
@@ -563,8 +568,10 @@
{ "libs-only-other", no_argument, &want_flags, PKG_LIBS|PKG_LIBS_ONLY_OTHER|PKG_PRINT_ERRORS, },
{ "uninstalled", no_argument, &want_flags, PKG_UNINSTALLED, },
{ "no-uninstalled", no_argument, &want_flags, PKG_NO_UNINSTALLED, },
+#ifndef ALWAYS_KEEP
{ "keep-system-cflags", no_argument, &want_flags, PKG_KEEP_SYSTEM_CFLAGS, },
{ "keep-system-libs", no_argument, &want_flags, PKG_KEEP_SYSTEM_LIBS, },
+#endif
{ "define-variable", required_argument, NULL, 27, },
{ "exact-version", required_argument, NULL, 28, },
{ "max-version", required_argument, NULL, 29, },
@@ -666,11 +673,13 @@
if ((want_flags & PKG_NO_UNINSTALLED) == PKG_NO_UNINSTALLED || getenv("PKG_CONFIG_DISABLE_UNINSTALLED") != NULL)
global_traverse_flags |= PKGF_NO_UNINSTALLED;
+#ifndef ALWAYS_KEEP
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") != NULL)
want_flags |= PKG_KEEP_SYSTEM_CFLAGS;
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_LIBS") != NULL)
want_flags |= PKG_KEEP_SYSTEM_LIBS;
+#endif
if ((builddir = getenv("PKG_CONFIG_TOP_BUILD_DIR")) != NULL)
pkg_tuple_add_global("pc_top_builddir", builddir);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment