1
0
Fork 0
mirror of https://github.com/eosswedenorg/antelope-keygen synced 2026-07-03 11:53:41 +02:00

build.sh: switch to "getopt" command and handle "--disable-threads" and "--force-ansi" long options.

This commit is contained in:
Henrik Hautakoski 2020-01-28 12:54:07 +01:00
parent 693c7aa069
commit 826ad10ce9

View file

@ -4,24 +4,41 @@ mkdir build 2> /dev/null
pushd build > /dev/null pushd build > /dev/null
function usage() { function usage() {
echo "Usage: ${0##*/} [ -h ] [ -t Debug|Release|RelWithDebInfo|MinSizeRel ]" echo "Usage: ${0##*/} [ -h ] [ -t Debug|Release|RelWithDebInfo|MinSizeRel ] [ --disable-threads ] [ --force-ansi ]"
exit 1 exit 1
} }
ARGS="" options=$(getopt -n "${0##*/}" -o ht: --long disable-threads --long force-ansi -- "$@")
while getopts ":h?t:" opt; do
case "${opt}" in [ $? -eq 0 ] || usage
t) ARGS="${ARGS} -DCMAKE_BUILD_TYPE=${OPTARG}" ;;
h) usage ;; eval set -- "$options"
:) echo "Error: -${OPTARG} requires a value"
exit 1 ARGS=""
while true; do
case "${1}" in
-t)
shift
[[ ! "$1" =~ ^(Debug|Release|RelWithDebInfo|MinSizeRel)$ ]] && {
echo "Incorrect type '$1' provided"
usage
}
ARGS="${ARGS} -DCMAKE_BUILD_TYPE=${1}"
;;
--disable-threads)
ARGS="${ARGS} -DUSE_THREADS=OFF" ;;
--force-ansi)
ARGS="${ARGS} -DFORCE_ANSI=ON" ;;
-h) usage ;;
--) shift
break
;; ;;
esac esac
shift
done done
shift $((OPTIND-1))
cmake $ARGS $@ .. echo cmake $ARGS ..
make -B make -B
popd > /dev/null popd > /dev/null