mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-05-09 05:58:23 +02:00
Don't override empty prefix setting
If the original prefix setting is empty, skip prepending the redefined prefix to other variables. This works the same as if the pc file doesn't have a prefix variable at all. https://bugs.freedesktop.org/show_bug.cgi?id=97453-empty
This commit is contained in:
parent
091722179b
commit
bbbdab4c60
4 changed files with 19 additions and 0 deletions
|
|
@ -99,6 +99,7 @@ EXTRA_DIST = \
|
|||
gtk/xproto.pc \
|
||||
gtk/xrender.pc \
|
||||
tilde.pc \
|
||||
pkgconfig/empty-prefix.pc \
|
||||
pkgconfig/prefixdef.pc \
|
||||
pkgconfig/prefixdef-expanded.pc \
|
||||
pcfiledir.pc \
|
||||
|
|
|
|||
|
|
@ -44,3 +44,10 @@ for pkg in prefixdef prefixdef-expanded; do
|
|||
RESULT="-I/reloc/include -L/reloc/lib -lfoo"
|
||||
run_test --dont-define-prefix --cflags --libs $pkg
|
||||
done
|
||||
|
||||
# Test prefix redefinition for .pc files with an empty prefix. In this
|
||||
# case, there should be no prefix adjustment to the other variables. The
|
||||
# result should be the same regardless of prefix redefinition.
|
||||
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
|
||||
|
|
|
|||
10
check/pkgconfig/empty-prefix.pc
Normal file
10
check/pkgconfig/empty-prefix.pc
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
prefix=
|
||||
libdir=/some/path/lib
|
||||
includedir=/some/path/include
|
||||
|
||||
Name: Empty prefix redefinition test
|
||||
Description: Test pkg-config empty prefix redefinition
|
||||
Version: 1.0.0
|
||||
Requires:
|
||||
Libs: -L${libdir} -lfoo
|
||||
Cflags: -I${includedir}
|
||||
1
parse.c
1
parse.c
|
|
@ -1046,6 +1046,7 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
|
|||
}
|
||||
else if (define_prefix &&
|
||||
pkg->orig_prefix != NULL &&
|
||||
*(pkg->orig_prefix) != '\0' &&
|
||||
strncmp (p, pkg->orig_prefix, strlen (pkg->orig_prefix)) == 0 &&
|
||||
G_IS_DIR_SEPARATOR (p[strlen (pkg->orig_prefix)]))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue