check: Test relocatable features

Exercise the ${pcfiledir} and --define-prefix features for allowing
relocation of packages. The --define-prefix test .pc files are put in a
pkgconfig subdirectory since the feature will only be enabled in that
situation.
This commit is contained in:
Dan Nicholson 2013-04-19 05:55:28 -07:00
parent e7238e823f
commit 32427bf2c6
5 changed files with 68 additions and 2 deletions

View file

@ -25,7 +25,8 @@ TESTS = \
check-uninstalled \
check-debug \
check-gtk \
check-tilde
check-tilde \
check-relocatable
EXTRA_DIST = \
$(TESTS) \
@ -92,4 +93,7 @@ EXTRA_DIST = \
gtk/xcb.pc \
gtk/xproto.pc \
gtk/xrender.pc \
tilde.pc
tilde.pc \
pkgconfig/prefixdef.pc \
pkgconfig/prefixdef-expanded.pc \
pcfiledir.pc

29
check/check-relocatable Normal file
View file

@ -0,0 +1,29 @@
#! /bin/sh
set -e
. ${srcdir}/common
# Test if pcfiledir metadata variable is substituted correctly
RESULT="-I${srcdir}/include -L${srcdir}/lib -lfoo"
run_test --cflags --libs pcfiledir
# Test prefix redefinition for .pc files in pkgconfig directory. Try .pc
# files with both unexpanded and expanded variables. Use the absolute
# directory for the search path so that pkg-config can strip enough
# components of the file directory to be useful.
PKG_CONFIG_LIBDIR="${abs_srcdir}/pkgconfig"
for pkg in prefixdef prefixdef-expanded; do
# Typical redefinition
RESULT="-I${abs_top_srcdir}/include -L${abs_top_srcdir}/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} -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

11
check/pcfiledir.pc Normal file
View file

@ -0,0 +1,11 @@
prefix=${pcfiledir}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: pcfiledir relocation test
Description: Test pkg-config pcfiledir metadata variable
Version: 1.0.0
Requires:
Libs: -L${libdir} -lfoo
Cflags: -I${includedir}

View file

@ -0,0 +1,11 @@
prefix=/reloc
exec_prefix=/reloc
libdir=/reloc/lib
includedir=/reloc/include
Name: Prefix redefinition with expanded variables test
Description: Test magic prefix redefinition when variables expanded
Version: 1.0.0
Requires:
Libs: -L${libdir} -lfoo
Cflags: -I${includedir}

View file

@ -0,0 +1,11 @@
prefix=/reloc
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: Prefix redefinition test
Description: Test pkg-config magic prefix redefinition
Version: 1.0.0
Requires:
Libs: -L${libdir} -lfoo
Cflags: -I${includedir}