syncevolution/src/syncevo/installcheck-local.sh
Patrick Ohly df81ccba65 packaging: another fix for installcheck-local
When the installation is in the standard location, pkg-config won't
print -I and -L options. The "redirect into DESTDIR via sed" trick
depended on that, meaning that the files were not found during the
nightly build.

Now -I and -L for the DESTDIR dirs is added explicitly. LD_LIBRARY_PATH
also has to be set, for libsmltk to be found.
2009-10-15 14:44:50 +02:00

52 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
#
# usage: PKG_CONFIG_PATH=... installcheck-local.sh <path to syncevo header files> <DESTDIR>
set -ex
TMPFILE=`mktemp`
TMPFILE_CXX=`mktemp`.cxx
TMPFILE_O=`mktemp`.o
rmtmp () {
rm -f $TMPFILE $TMPFILE_CXX $TMPFILE_O
}
trap rmtmp EXIT
# check that c++ works, whatever it is
cat >$TMPFILE_CXX <<EOF
#include <iostream>
int main(int argc, char **argv)
{
std::cout << "hello world\n";
return 0;
}
EOF
for CXX in "c++ -Wall -Werror" "g++ -Wall -Werror" "c++" "g++" ""; do
if [ ! "$CXX" ]; then
echo "no usable compiler, skipping tests"
exit 0
fi
if $CXX $TMPFILE_CXX -o $TMPFILE; then
break
fi
done
for header in `cd $1 && echo *`; do
cat >$TMPFILE_CXX <<EOF
#include <syncevo/$header>
int main(int argc, char **argv)
{
return 0;
}
EOF
# header must be usable stand-alone
$CXX "-I$2" $TMPFILE_CXX -c -o $TMPFILE_O
done
# link once to check that the libs are found
pkg-config --libs syncevolution
env LD_LIBRARY_PATH=$3:$LD_LIBRARY_PATH $CXX -v $TMPFILE_O -o $TMPFILE "-L$3" `pkg-config --libs syncevolution`