moved examples out of libt2n into libt2n-example
[libt2n] / test-build-install-use
1 #!/bin/bash -x
2 set -o errexit
3 set -o nounset
4
5 # where is the source? (todo: we could checkout from svn)
6
7 LIBT2NSRC="$PWD/../libt2n"
8 LIBT2N_EXAMPLES="$PWD/lib2n-example"
9
10 # general settings
11
12 # todo: safe temp dir creation
13 INSTDIR="/tmp/jens-delme"
14 mkdir "$INSTDIR"
15 INSTPREFIX="/tmp/jens-delme/usr"
16 MAKE="dmake"
17 VERSION="0.1"
18
19 function append() {
20         if [ "x$1" = "x" ]; then
21                 echo "$2"
22         else
23                 echo "$1:$2"
24         fi
25 }
26
27
28 # 1. build and install lib and codegen
29 cd "$LIBT2NSRC"
30 ./configure --prefix="$INSTPREFIX"
31 # todo: at the moment running make dist on clean source does not work
32 $MAKE
33 $MAKE distcheck
34 #$MAKE dist
35 $MAKE install
36
37 echo "OK: library and code generator compiled and installed"
38
39
40 # prepare environment to use installed libt2n and code generator in non-standard directory
41 # temporarily disable nounset
42
43 set +o nounset
44 export PATH=$(append "$PATH" "$INSTPREFIX/bin")
45 export LD_LIBRARY_PATH=$(append "$LD_LIBRARY_PATH" "$INSTPREFIX/lib")
46 export PKG_CONFIG_PATH=$(append "$PKG_CONFIG_PATH" "$INSTPREFIX/lib/pkgconfig")
47 set -o nounset
48
49 # 2. build example-codegen
50 cd "$LIBT2N_EXAMPLES/example-codegen"
51 autoreconf -f -i -M "$INSTDIR/usr/share/aclocal"
52 ./configure --prefix="$INSTPREFIX"
53 # todo: at the moment running make dist on clean source does not work
54 $MAKE
55 $MAKE distcheck
56 $MAKE install
57 echo "OK: example using installed libt2n works"
58
59 # 3. compile client using the installed default lib
60 cd "$EXAMPLE_LIBUSAGE/example-libusage"
61 autoreconf -f -i -M "$INSTDIR/usr/share/aclocal"
62 ./configure --prefix="$INSTPREFIX"
63 $MAKE distcheck
64 echo "OK: example using installed example lib works"