diff --git a/check/check-relocatable b/check/check-relocatable index 40c2c88..14d1264 100755 --- a/check/check-relocatable +++ b/check/check-relocatable @@ -51,3 +51,22 @@ done RESULT="-I/some/path/include -L/some/path/lib -lfoo" run_test --define-prefix --cflags --libs empty-prefix run_test --dont-define-prefix --cflags --libs empty-prefix + +# Test prefix redefinition for .pc files when the pkgconfig directory is in +# ..../lib/arch/ as Debian and Ubuntu and their derivatives do. +PKG_CONFIG_LIBDIR="${abs_srcdir}/lib/arch/pkgconfig" +for pkg in prefixdef prefixdef-expanded; do + # Typical redefinition + RESULT="-I${abs_top_srcdir}/check/include -L${abs_top_srcdir}/check/lib -lfoo" + run_test --define-prefix --cflags --libs $pkg + + RESULT="-I/reloc/include -L/reloc/lib -lfoo" + run_test --dont-define-prefix --cflags --libs $pkg + + # Non-standard redefinition + RESULT="-I/reloc/include -L${abs_top_srcdir}/check -lfoo" + run_test --define-prefix --prefix-variable=libdir --cflags --libs $pkg + + RESULT="-I/reloc/include -L/reloc/lib -lfoo" + run_test --dont-define-prefix --cflags --libs $pkg +done diff --git a/check/lib/arch/pkgconfig b/check/lib/arch/pkgconfig new file mode 120000 index 0000000..3d8642d --- /dev/null +++ b/check/lib/arch/pkgconfig @@ -0,0 +1 @@ +../../pkgconfig \ No newline at end of file diff --git a/parse.c b/parse.c index 6e9907c..cba1b43 100644 --- a/parse.c +++ b/parse.c @@ -1021,6 +1021,14 @@ parse_line (Package *pkg, const char *untrimmed, const char *path, q = g_path_get_dirname (pkg->pcfiledir); prefix = g_path_get_dirname (q); g_free (q); + + /* Debian/Ubuntu use ..../lib/x86_64-linux-gnu/pkg-config */ + if (g_str_has_suffix (prefix, "/lib")) + { + q = prefix; + prefix = g_path_get_dirname (q); + g_free (q); + } /* Turn backslashes into slashes or * g_shell_parse_argv() will eat them when ${prefix}