diff options
Diffstat (limited to 'network/bozohttpd/bozohttpd.SlackBuild')
-rw-r--r-- | network/bozohttpd/bozohttpd.SlackBuild | 81 |
1 files changed, 68 insertions, 13 deletions
diff --git a/network/bozohttpd/bozohttpd.SlackBuild b/network/bozohttpd/bozohttpd.SlackBuild index 2d3ba76729..efe8bdbadf 100644 --- a/network/bozohttpd/bozohttpd.SlackBuild +++ b/network/bozohttpd/bozohttpd.SlackBuild @@ -24,6 +24,13 @@ # Now maintained by B. Watson <yalhcru@gmail.com>. +# 20181203 bkw: +# - Update for v20181125. +# - Lua-5.1 (plain lua build) is no longer supported. Add a mess o' logic +# to autodetect lua52 or lua53, and allow the user to override it. +# - When built with lua support, add lua version number to slack-desc. +# - Allow users to selectively disable unneeded features, see defines.default. + # 20180629 bkw: # - Take over maintenance. # - Move binary to /usr/sbin (to match the section 8 man page). But @@ -37,8 +44,8 @@ # - Simplify script a bit. PRGNAM=bozohttpd -VERSION=${VERSION:-20170201} -BUILD=${BUILD:-2} +VERSION=${VERSION:-20181125} +BUILD=${BUILD:-1} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then @@ -77,11 +84,8 @@ rm -rf $PRGNAM-$VERSION tar xjvf $CWD/$PRGNAM-$VERSION.tar.bz2 cd $PRGNAM-$VERSION chown -R root:root . -find -L . \ - \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ - -o -perm 511 \) -exec chmod 755 {} \+ -o \ - \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ - -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+ +find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ + \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ # 20180629 bkw: Note to self: Ignore Makefile. It's BSD-specific. # In theory maybe it could be massaged into working with bmake or @@ -94,18 +98,68 @@ sed -i '/^CRYPTOLIBS/s,$, -lcrypt,' Makefile.boot # 20180629 bkw: support lua (-L option) if lua is installed and user # doesn't disable it. I've tested this with the printenv.lua script # and it seems to work fine. -if [ "${LUA:-yes}" = "yes" ] && lua -v &>/dev/null; then - LUAOPT="" - WITHLUA="with" + +# 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}" + +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 + 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 + exit 1 + ;; +esac + +echo "=== LUA='$LUA'" +if [ "$LUA" != "no" ] && lua$LUA -v &>/dev/null; then + LUAOPT="-I/usr/include/lua$LUA" + WITHLUA="with lua $LUA" EXTRADOC="printenv.lua" - sed -i '/^CRYPTOLIBS/s,$, -llua,' Makefile.boot + sed -i '/^CRYPTOLIBS/s,$, -llua'"$LUA"',' Makefile.boot sed -i 's,/usr/libexec/httpd,bozohttpd,' printenv.lua else LUAOPT="-DNO_LUA_SUPPORT" - WITHLUA="without" + WITHLUA="without lua" EXTRADOC="" fi +# 20181203 bkw: Support local compile options, to selectively disable +# unneeded features. +if [ -e "$CWD/defines.local" ]; then + DEFFILE=$CWD/defines.local +elif [ -e $CWD/defines.default ]; then + DEFFILE=$CWD/defines.default +fi + +if [ -n "$DEFFILE" ]; then + DEFINES="$( echo $( sed 's,#.*$,,' "$DEFFILE" ) )" + echo "=== using defines from $DEFFILE: '$DEFINES'" +else + DEFINES="-DDO_HTPASSWD" +fi + # 20180629 bkw: The man page was written for NetBSD, where I guess # bozohttpd is installed as "httpd". On Slackware this is Apache. The # man page shows example commands referring to "httpd", which will @@ -133,7 +187,7 @@ patch -p1 < $CWD/fix_warnings.diff # Fix build (from Arch Linux' AUR). sed -i 's/d_namlen/d_reclen/g' bozohttpd.c -make -f Makefile.boot OPT="$SLKCFLAGS -Wall" LOCAL_CFLAGS="-DDO_HTPASSWD $LUAOPT" +make -f Makefile.boot OPT="$SLKCFLAGS -Wall" LOCAL_CFLAGS="$DEFINES $LUAOPT" mkdir -p $PKG/usr/bin $PKG/usr/sbin $PKG/usr/man/man8 install -s -m755 $PRGNAM $PKG/usr/sbin @@ -143,6 +197,7 @@ gzip -9c < $PRGNAM.8 > $PKG/usr/man/man8/$PRGNAM.8.gz mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a CHANGES $EXTRADOC $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +[ -n "$DEFFILE" ] && cat "$DEFFILE" > $PKG/usr/doc/$PRGNAM-$VERSION/defines.local mkdir -p $PKG/install sed "s,@WITHLUA@,$WITHLUA," $CWD/slack-desc > $PKG/install/slack-desc |