diff options
context:
space:
mode:
-rw-r--r--source/cgit.mk2
-rwxr-xr-xtools/release-build.sh23
2 files changed, 17 insertions, 8 deletions
diff --git a/source/cgit.mk b/source/cgit.mk
index d012349..1e5b5e1 100644
--- a/source/cgit.mk
+++ b/source/cgit.mk
@@ -40,7 +40,7 @@ ifdef NO_LUA
CGIT_CFLAGS += -DNO_LUA
else
ifeq ($(LUA_PKGCONFIG),)
- LUA_PKGCONFIG := $(shell for pc in luajit lua lua5.2 lua5.1; do \
+ LUA_PKGCONFIG := $(shell for pc in luajit lua lua5.4 lua5.3 lua5.2 lua5.1; do \
$(PKG_CONFIG) --exists $$pc 2>/dev/null && echo $$pc && break; \
done)
LUA_MODE := autodetected
diff --git a/tools/release-build.sh b/tools/release-build.sh
index 6dc9045..92aa78b 100755
--- a/tools/release-build.sh
+++ b/tools/release-build.sh
@@ -2,15 +2,24 @@
# Build cgit for a release with Linux hardening flags.
#
# These are ELF and GCC/Clang specific, so this targets a Linux deploy
-# rather than local macOS development, where `make NO_LUA=1` is enough.
-# The flags add a stack protector, fortified libc calls, a position
-# independent executable, and full RELRO. Lua is pinned off here; drop
-# NO_LUA=1 and install the Lua dev package if you use lua filters.
+# rather than local macOS development, where a plain make is enough. The
+# flags add a stack protector, fortified libc calls, a position independent
+# executable, and full RELRO.
#
-# Usage: ./tools/release-build.sh (run from the repository root)
+# By default Lua is pinned off so the binary needs no Lua at runtime. Pass
+# "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)
set -eu
+if [ "${1:-}" = "lua" ]; then
+ LUA=
+else
+ LUA=NO_LUA=1
+fi
+
CFLAGS="-O2 -g -Wall \
-fstack-protector-strong \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 \
@@ -23,5 +32,5 @@ LDFLAGS="-pie \
# A full rebuild so the bundled git objects pick up the same flags.
# cleanall also descends into git/, which plain clean does not.
-make NO_LUA=1 cleanall
-exec make NO_LUA=1 CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
+make $LUA cleanall
+exec make $LUA CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"