From a2904672616780a6fc5b5cf1705bb1a7fd5c8e9b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 3 May 2012 19:44:44 +0000 Subject: [PATCH] main: filter out system dirs --- main.c | 21 +++++++++++++++++++++ tests/run.sh | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 8a72c48..2ea9672 100644 --- a/main.c +++ b/main.c @@ -55,9 +55,30 @@ static char *required_pkgconfig_version = NULL; static char *required_module_version = NULL; static char *want_variable = NULL; +static bool +fragment_has_system_dir(pkg_fragment_t *frag) +{ + switch (frag->type) + { + case 'L': + if (!strcasecmp(LIBDIR, frag->data)) + return true; + case 'I': + if (!strcasecmp(INCLUDEDIR, frag->data)) + return true; + default: + break; + } + + return false; +} + static void print_fragment(pkg_fragment_t *frag) { + if (fragment_has_system_dir(frag)) + return; + if (frag->type) printf("-%c%s ", frag->type, frag->data); else diff --git a/tests/run.sh b/tests/run.sh index 09fa001..134f8b8 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -60,7 +60,7 @@ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs bar" \ run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --libs --cflags baz" \ '-lbaz' '-fPIC' '-I/usr/include/foo' run_test "PKG_CONFIG_PATH=${selfdir}/lib1 ${1} --static --libs baz" \ - '-L/usr/lib -lfoo -L/usr/lib -lbaz -L/usr/lib -lzee' + '-lfoo' '-lbaz' '-lzee' if [ ${failed} -gt 0 ]; then echo "${failed} of ${done} tests failed. See output for details." >&2