network/bozohttpd: Build with lua 5.4.

Signed-off-by: B. Watson <urchlay@slackware.uk>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2024-10-17 04:41:01 -04:00 committed by Willy Sudiarto Raharjo
parent 133969fd1c
commit d449d68d51
No known key found for this signature in database
GPG key ID: 3F617144D7238786
2 changed files with 18 additions and 34 deletions

View file

@ -19,18 +19,13 @@ that aren't included can't be exploited). See the file defines.default
for details on how to do this. By default, all features are enabled
(except maybe lua; see below).
Optional dependency: lua52 or lua53.
Optional dependency: lua.
bozohttpd can be built with support for dynamic content using Lua. This
isn't needed for running CGI scripts that happen to be written in Lua.
It's for embedding a Lua interpreter in bozohttpd, in the style of
Apache's mod_php or mod_perl. As of bozohttpd-20181125, lua 5.1.x
(aka SBo's lua package) is no longer supported. You can set LUA in the
environment if the default isn't what you want:
LUA=yes - the default (autodetect; use highest version found, or none).
LUA=5.2 - use lua52, or fail if not found.
LUA=5.3 - use lua53, or fail if not found.
LUA=no - disable lua support, even if lua52 and/or lua53 are installed.
bozohttpd can be built with support for dynamic content using
Lua. This isn't needed for running CGI scripts that happen to be
written in Lua. It's for embedding a Lua interpreter in bozohttpd,
in the style of Apache's mod_php or mod_perl. If lua is installed, it
will be autodetected. If you want to build without it, export LUA=no
in the environment.
Without Lua support, the -L option to bozohttpd will not work.

View file

@ -24,6 +24,7 @@
# Now maintained by B. Watson <urchlay@slackware.uk>.
# 20241017 bkw: BUILD=2, update for lua's 5.4 update.
# 20240206 bkw: Update for v20240126.
# 20230103 bkw: Update for v20220517.
# 20210911 bkw: Update for v20210227.
@ -53,7 +54,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=bozohttpd
VERSION=${VERSION:-20240126}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -108,35 +109,24 @@ sed -i '/^CRYPTOLIBS/s,$, -lcrypt,' Makefile.boot
# doesn't disable it. I've tested this with the printenv.lua script
# and it seems to work fine.
# 20181203 bkw: bozohttpd-20170201 was the last version that worked
# with lua 5.1 (SBo's lua build). Starting with 20181125, at least
# lua 5.2 is required (5.3 also works). This is more complex than I'd
# like it to be, but it does work.
LUA="${LUA:-yes}"
# 20241017 bkw: now that SBo's lua is v5.4, the logic here got a lot
# simpler.
LUA="${LUA:-yes}"
case "$LUA" in
# LUA=yes: autodetect
yes) if lua5.3 -v &> /dev/null; then
LUA=5.3
elif lua5.2 -v &> /dev/null; then
LUA=5.2
yes) if [ "$( lua -v | cut -d' ' -f2 | cut -d. -f1,2 )" = "5.4" ]; then
LUA=5.4
else
LUA=no
fi
;;
# LUA=<version>: use that version, or die
5.2|5.3) if ! lua$LUA -v &> /dev/null; then
echo "!!! lua v$LUA support requested, but lua${LUA/./} not installed" 2>&1
exit 1
fi
;;
# LUA=no: accept and do nothing
no) ;;
# Anything else is a fail
*) echo "Invalid LUA value '$LUA'. Supported values are: yes no 5.2 5.3" 2>&1
*) echo "Invalid LUA value '$LUA'. Supported values are: yes no" 2>&1
exit 1
;;
esac
@ -144,14 +134,13 @@ esac
# 20220207 bkw: due to 15.0's newer gcc, non-lua and lua 5.2 builds
# were failing (and I didn't notice right away because I keep lua 5.3
# installed).
sed -i '1i#include <stdint.h>' $PRGNAM.c
#sed -i '1i#include <stdint.h>' $PRGNAM.c
echo "=== LUA='$LUA'"
if [ "$LUA" != "no" ] && lua$LUA -v &>/dev/null; then
LUAOPT="-I/usr/include/lua$LUA"
if [ "$LUA" != "no" ]; then
WITHLUA="with lua $LUA"
EXTRADOC="printenv.lua"
sed -i '/^CRYPTOLIBS/s,$, -llua'"$LUA"',' Makefile.boot
sed -i '/^CRYPTOLIBS/s,$, -llua,' Makefile.boot
sed -i 's,/usr/libexec/httpd,bozohttpd,' printenv.lua
else
LUAOPT="-DNO_LUA_SUPPORT"