moved examples out of libt2n into libt2n-example
[libt2n] / test-build-install-use
CommitLineData
ad17f523
JT
1#!/bin/bash -x
2set -o errexit
3set -o nounset
4
2e525d6f
JT
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
ad17f523
JT
12# todo: safe temp dir creation
13INSTDIR="/tmp/jens-delme"
14mkdir "$INSTDIR"
15INSTPREFIX="/tmp/jens-delme/usr"
7f435356 16MAKE="dmake"
ad17f523 17VERSION="0.1"
ad17f523
JT
18
19function append() {
20 if [ "x$1" = "x" ]; then
21 echo "$2"
22 else
23 echo "$1:$2"
24 fi
25}
26
27
2e525d6f
JT
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"
ad17f523 38
2e525d6f
JT
39
40# prepare environment to use installed libt2n and code generator in non-standard directory
ad17f523 41# temporarily disable nounset
2e525d6f 42
ad17f523
JT
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
2e525d6f
JT
49# 2. build example-codegen
50cd "$LIBT2N_EXAMPLES/example-codegen"
ad17f523 51autoreconf -f -i -M "$INSTDIR/usr/share/aclocal"
7f435356 52./configure --prefix="$INSTPREFIX"
ad17f523
JT
53# todo: at the moment running make dist on clean source does not work
54$MAKE
55$MAKE distcheck
7f435356 56$MAKE install
7f435356
JT
57echo "OK: example using installed libt2n works"
58
2e525d6f
JT
59# 3. compile client using the installed default lib
60cd "$EXAMPLE_LIBUSAGE/example-libusage"
7f435356
JT
61autoreconf -f -i -M "$INSTDIR/usr/share/aclocal"
62./configure --prefix="$INSTPREFIX"
63$MAKE distcheck
53b891ed 64echo "OK: example using installed example lib works"