moved examples out of libt2n into libt2n-example
[libt2n] / test-build-install-use
... / ...
CommitLineData
1#!/bin/bash -x
2set -o errexit
3set -o nounset
4
5# where is the source? (todo: we could checkout from svn)
6
7LIBT2NSRC="$PWD/../libt2n"
8LIBT2N_EXAMPLES="$PWD/lib2n-example"
9
10# general settings
11
12# todo: safe temp dir creation
13INSTDIR="/tmp/jens-delme"
14mkdir "$INSTDIR"
15INSTPREFIX="/tmp/jens-delme/usr"
16MAKE="dmake"
17VERSION="0.1"
18
19function 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
29cd "$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
37echo "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
43set +o nounset
44export PATH=$(append "$PATH" "$INSTPREFIX/bin")
45export LD_LIBRARY_PATH=$(append "$LD_LIBRARY_PATH" "$INSTPREFIX/lib")
46export PKG_CONFIG_PATH=$(append "$PKG_CONFIG_PATH" "$INSTPREFIX/lib/pkgconfig")
47set -o nounset
48
49# 2. build example-codegen
50cd "$LIBT2N_EXAMPLES/example-codegen"
51autoreconf -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
57echo "OK: example using installed libt2n works"
58
59# 3. compile client using the installed default lib
60cd "$EXAMPLE_LIBUSAGE/example-libusage"
61autoreconf -f -i -M "$INSTDIR/usr/share/aclocal"
62./configure --prefix="$INSTPREFIX"
63$MAKE distcheck
64echo "OK: example using installed example lib works"