From ab198868f196de1e7ebc36692be4d86c9538c0f4 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Wed, 26 Oct 2016 18:32:44 +0200 Subject: [PATCH] scripts/build.sh: added fix for broken cunit.pc in travis CI environment The pkgconfig specification for libcunit1-dev version 2.1-2 is horribly broken. build.sh (invoked by the travis CI system, see .travis.yml) now runs a new script fix-cunit.sh when TESTS is set to 'yes'. --- scripts/build.sh | 2 +- scripts/fix-cunit.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 scripts/fix-cunit.sh diff --git a/scripts/build.sh b/scripts/build.sh index 5c489be6..ff933a56 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,7 +1,7 @@ #! /bin/sh if test "x$TESTS" = "xyes" -o "x$TESTS" = "xtrue" ; then - WITH_TESTS=--enable-tests + WITH_TESTS="`scripts/fix-cunit.sh` --enable-tests" fi config() { diff --git a/scripts/fix-cunit.sh b/scripts/fix-cunit.sh new file mode 100644 index 00000000..ca2e1365 --- /dev/null +++ b/scripts/fix-cunit.sh @@ -0,0 +1,15 @@ +#! /bin/sh + +# only continue if `pkgconfig cunit` fails +pkg-config cunit && exit 0 + +# Check if the system has a cunit.pc. +# If not, exit with success (the configure script will raise +# a more descriptive error). +CUNIT_PC=`dpkg -L libcunit1-dev 2>/dev/null|grep cunit.pc` +if test "x$CUNIT_PC" != "x"; then + grep -q Version: $CUNIT_PC || (dpkg -l|sed -ne 's/^ii\s\+libcunit1-dev\s\+\([0-9]\+.[0-9]\+-[0-9]\+\).*$/Version: \1/p; T; q'|cat - $CUNIT_PC |sed -e 's/={exec_prefix/=${exec_prefix/' `pwd`/cunit.pc) +fi + +# output location of generated cunit.pc +echo PKG_CONFIG_PATH=`pwd`