diff options
context:
space:
mode:
Diffstat (limited to 'tools/release-build.sh')
-rwxr-xr-xtools/release-build.sh26
1 file changed, 19 insertions, 7 deletions
diff --git a/tools/release-build.sh b/tools/release-build.sh
index ee6b501..cfab7a2 100755
--- a/tools/release-build.sh
+++ b/tools/release-build.sh
@@ -10,15 +10,27 @@
# "lua" as the first argument to link the lua: filter backend instead, which
# needs a Lua dev package installed.
#
-# Usage: ./tools/release-build.sh [lua] (run from the repository root)
+# Usage: ./tools/release-build.sh [lua]
set -eu
-if [ "${1:-}" = "lua" ]; then
- LUA=
-else
- LUA=NO_LUA=1
+# The argument is checked rather than assumed, since anything unrecognised
+# would otherwise fall through to a quiet Lua-less build that looks like it
+# worked.
+if [ "$#" -gt 1 ]; then
+ echo "usage: $0 [lua]" >&2
+ exit 2
fi
+case "${1:-}" in
+"") set -- NO_LUA=1 ;;
+lua) set -- ;;
+*) echo "$0: unknown argument \"$1\", expected \"lua\" or nothing" >&2
+ exit 2 ;;
+esac
+
+# Every make target below is written relative to the repository root, so go
+# there rather than requiring the caller to.
+cd "$(dirname "$0")/.."
CFLAGS="-O2 -g -Wall \
-fstack-protector-strong \
@@ -31,6 +43,6 @@ LDFLAGS="-pie \
-Wl,-z,noexecstack"
# A full rebuild so the bundled git objects pick up the same flags.
-# cleanall also descends into git/, which plain clean does not.
+# cleanall also descends into vendor/git, which plain clean does not.
make cleanall
-exec make $LUA CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
+exec make "$@" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"