From 2b0ecb6f19b1be906a39eac5143d4c40252f0a5a Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Sat, 5 Feb 2022 12:03:25 +0100 Subject: Adapt testing to recursive pkg-config requirements When pkg-config is called with --static, it will recursively collect all Libs and Libs.private which are discovered via Requires and Requires.private. So these libs must be available for linking even when acutally only lib proj uses static linkage. Libs and pkg-config must be provided for the target triplet. --- test/postinstall/c_app/makefile.mak | 6 +++--- test/postinstall/test_autotools.sh | 5 +++-- test/postinstall/test_pkg-config.sh | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/postinstall/c_app/makefile.mak b/test/postinstall/c_app/makefile.mak index 3e29d4b1..01d1c259 100644 --- a/test/postinstall/c_app/makefile.mak +++ b/test/postinstall/c_app/makefile.mak @@ -6,18 +6,18 @@ TESTS = \ test_searchpath.sh \ test_version.sh -override CFLAGS += -g -Wall -Werror $(shell pkg-config proj --cflags) +override CFLAGS += -g -Wall -Werror $(shell ${PKG_CONFIG} proj --cflags) ifeq ($(BUILD_MODE),static) UNAME_S := $(shell uname -s) - _ldflags := $(shell pkg-config proj --libs --static) + _ldflags := $(shell ${PKG_CONFIG} proj --libs --static) ifeq ($(UNAME_S),Linux) # force static linking to libproj _ldflags := $(shell echo $(_ldflags) | sed 's/-lproj/-Wl,-Bstatic -lproj -Wl,-Bdynamic/') endif override LDFLAGS += $(_ldflags) else # default is shared - override LDFLAGS += $(shell pkg-config proj --libs) + override LDFLAGS += $(shell ${PKG_CONFIG} proj --libs) endif all: $(PROGRAM) diff --git a/test/postinstall/test_autotools.sh b/test/postinstall/test_autotools.sh index 28954c4d..c3e0e60b 100755 --- a/test/postinstall/test_autotools.sh +++ b/test/postinstall/test_autotools.sh @@ -12,12 +12,13 @@ main_setup $1 $2 echo "Running post-install tests with autotools/pkg-config (${BUILD_MODE})" if [ ${BUILD_MODE} = shared ]; then - export PKG_CONFIG="pkg-config" + export PKG_CONFIG="${PKG_CONFIG:-pkg-config}" ENABLE_STATIC_PROJ=no else - export PKG_CONFIG="pkg-config --static" + export PKG_CONFIG="${PKG_CONFIG:-pkg-config} --static" ENABLE_STATIC_PROJ=yes fi +echo ,${PKG_CONFIG}, export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig diff --git a/test/postinstall/test_pkg-config.sh b/test/postinstall/test_pkg-config.sh index a9ccabce..d170e189 100755 --- a/test/postinstall/test_pkg-config.sh +++ b/test/postinstall/test_pkg-config.sh @@ -11,6 +11,7 @@ main_setup $1 $2 echo "Running post-install tests with pkg-config (${BUILD_MODE})" +export PKG_CONFIG="${PKG_CONFIG:-pkg-config}" export PKG_CONFIG_PATH=${prefix}/lib/pkgconfig if [ ${BUILD_MODE} = shared ]; then -- cgit v1.2.3