| 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" |
| 10 | ./configure --prefix="$INSTPREFIX" |
| 11 | # todo: at the moment running make dist on clean source does not work |
| 12 | $MAKE |
| 13 | $MAKE distcheck |
| 14 | #$MAKE dist |
| 15 | $MAKE install |
| 16 | |
| 17 | echo "OK: library and code generator compiled and installed" |
| 18 | |
| 19 | VERSION="0.1" |
| 20 | TARFILE="libt2n-$VERSION.tar.gz" |
| 21 | cp "$TARFILE" "$INSTDIR" |
| 22 | EXAMPLE_LIBUSAGE="example-libusage" |
| 23 | cp -af "$EXAMPLE_LIBUSAGE" "$INSTDIR" |
| 24 | |
| 25 | # now build example-client using installed libt2n |
| 26 | cd "$INSTDIR" |
| 27 | |
| 28 | function append() { |
| 29 | if [ "x$1" = "x" ]; then |
| 30 | echo "$2" |
| 31 | else |
| 32 | echo "$1:$2" |
| 33 | fi |
| 34 | } |
| 35 | |
| 36 | |
| 37 | # adjust some environment variables |
| 38 | # (this is needed because we installed in non-standard directories) |
| 39 | |
| 40 | # temporarily disable nounset |
| 41 | set +o nounset |
| 42 | export PATH=$(append "$PATH" "$INSTPREFIX/bin") |
| 43 | export LD_LIBRARY_PATH=$(append "$LD_LIBRARY_PATH" "$INSTPREFIX/lib") |
| 44 | export PKG_CONFIG_PATH=$(append "$PKG_CONFIG_PATH" "$INSTPREFIX/lib/pkgconfig") |
| 45 | set -o nounset |
| 46 | |
| 47 | tar xzvf "$TARFILE" |
| 48 | mv "libt2n-$VERSION/example-codegen" . |
| 49 | cd example-codegen |
| 50 | autoreconf -f -i -M "$INSTDIR/usr/share/aclocal" |
| 51 | ./configure --prefix="$INSTPREFIX" |
| 52 | # todo: at the moment running make dist on clean source does not work |
| 53 | $MAKE |
| 54 | $MAKE distcheck |
| 55 | $MAKE install |
| 56 | cd .. |
| 57 | echo "OK: example using installed libt2n works" |
| 58 | |
| 59 | # now compile client using the installed default lib |
| 60 | cd "$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" |