aboutsummaryrefslogtreecommitdiff
path: root/network/suphp/suphp.SlackBuild
diff options
context:
space:
mode:
Diffstat (limited to 'network/suphp/suphp.SlackBuild')
-rw-r--r--network/suphp/suphp.SlackBuild96
1 files changed, 96 insertions, 0 deletions
diff --git a/network/suphp/suphp.SlackBuild b/network/suphp/suphp.SlackBuild
new file mode 100644
index 0000000000000..e2072d42b2320
--- /dev/null
+++ b/network/suphp/suphp.SlackBuild
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# Slackware build script for suPHP
+
+# Written by Menno E. Duursma <druiloor@zonnet.nl>
+
+# Exit on most errors
+set -e
+
+PRGNAM=suphp
+VERSION=0.6.2
+ARCH=${ARCH:-i486}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+CWD=`pwd`
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp
+
+# The stock Apache on Slackware runs httpd onder system
+# user/group account 'nobody'. If you happen to use some
+# other account (which should improve security) change below
+# and make sure /etc/apache/suphp.conf matches
+HTTPD_USER=nobody
+HTTPD_GROUP=nobody
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar -xzvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+chmod -R u+w,go+r-w,a-s .
+
+# Apply patch to have it globally honor the suPHP_Engine directive
+cat $CWD/suphp-0.6.2-vhosts.patch | patch -p0 --verbose
+
+# Default to secure settings, as any of the configuretion options
+# can be overwritten in the config-file /etc/apache/suphp.conf anyways
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --with-apr=/usr/bin/apr-1-config \
+ --with-apxs=/usr/sbin/apxs \
+ --sysconfdir=/etc/apache \
+ --with-apache-user=$HTTPD_USER \
+ --with-logfile=/var/log/apache/suphp_log
+
+# Compile the application and install it into the $PKG directory
+make
+make install-strip DESTDIR=$PKG
+
+# The above misses Apache module
+( cd $PKG
+ strip --strip-unneeded usr/libexec/apache/mod_suphp.so
+)
+
+# Copy program documentation into the package
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a AUTHORS COPYING ChangeLog doc/* $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# Add a sample configuration file
+mkdir -p $PKG/etc/apache
+cat $CWD/suphp.conf \
+ | tr 'webserver_user=nobody' "webserver_user=$HTTPD_USER" \
+ >> $PKG/etc/apache/suphp.conf.new
+
+# Copy the slack-desc (and a custom doinst.sh if necessary) into ./install
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+# Make sure the access permissions on target host are such that
+# only the group Apache runs as has access to it
+echo "chgrp $HTTPD_GROUP usr/sbin/suphp" >> $PKG/install/doinst.sh
+echo "chmod 4750 usr/sbin/suphp" >> $PKG/install/doinst.sh
+
+# Make the package; be sure to leave it in $OUTPUT
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
+
+# Clean up the extra stuff
+if [ "$1" = "--cleanup" ]; then
+ rm -rf $TMP/$PRGNAM-$VERSION
+ rm -rf $PKG
+fi
+