15c0ddfab7bc6207468deee249838d909d1d384a
[libt2n] / test-build-install-use
1 #!/bin/bash -x
2 set -o errexit
3 set -o nounset
4
5 # todo: safe temp dir creation
6 INSTDIR="/tmp/jens-delme"
7 mkdir "$INSTDIR"
8 INSTPREFIX="/tmp/jens-delme/usr"
9 MAKE="dmake -d"
10 ./configure --prefix="$INSTPREFIX"
11 $MAKE dist
12 $MAKE install
13
14 VERSION="0.1"
15 TARFILE="libt2n-$VERSION.tar.gz"
16 cp "$TARFILE" "$INSTDIR"
17
18 # now build example-client using installed libt2n
19 cd "$INSTDIR"
20
21 function append() {
22         if [ "x$1" = "x" ]; then
23                 echo "$2"
24         else
25                 echo "$1:$2"
26         fi
27 }
28
29
30 # adjust some environment variables
31 # (this is needed because we installed in non-standard directories)
32
33 # temporarily disable nounset
34 set +o nounset
35 export PATH=$(append "$PATH" "$INSTPREFIX/bin")
36 export LD_LIBRARY_PATH=$(append "$LD_LIBRARY_PATH" "$INSTPREFIX/lib")
37 export PKG_CONFIG_PATH=$(append "$PKG_CONFIG_PATH" "$INSTPREFIX/lib/pkgconfig")
38 set -o nounset
39
40 tar xzvf "$TARFILE"
41 mv "libt2n-$VERSION/example-codegen" .
42 cd example-codegen
43 autoreconf -f -i -M "$INSTDIR/usr/share/aclocal"
44 ./configure
45 # todo: at the moment running make dist on clean source does not work
46 $MAKE
47 $MAKE distcheck