dep-libtomcrypt/demos/ltc
Steffen Jaeckel 88dcebdbf5 Rework demos building and installation
* add `ltc` wrapper script for installed demos
* rework demos/CMakeLists.txt and add some more bells and whistles
* prefix installed demos with `ltc-`

Currently this makes the standard makefiles and CMake results diverge, but
we can fix that later if required.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-05 17:23:12 +01:00

34 lines
567 B
Bash
Executable file

#!/bin/sh
RELDIR="/$0"
RELDIR="${RELDIR%/*}"
RELDIR="${RELDIR:-.}"
RELDIR="${RELDIR##/}/"
BINDIR=`cd "$RELDIR"; pwd`
err_out() {
err=$1
shift
echo $* >&2
exit $err
}
usage() {
cat >&$(($1 + 1)) << EOF
Available commands are:
`ls -1 $BINDIR/ltc-* | sed "s@$BINDIR/ltc-@ @g"`
help
EOF
exit $1
}
[ $# -gt 0 ] || usage 1
TOOL="$1"
shift
[ "$TOOL" == "help" ] || [ "$TOOL" == "--help" ] || [ "$TOOL" == "-h" ] && usage 0
test -x "$BINDIR/ltc-$TOOL" || err_out 1 "Unknown command: $TOOL"
[ $# -gt 0 ] && "$BINDIR/ltc-$TOOL" "$@" || "$BINDIR/ltc-$TOOL"