slackbuilds_ponce/network/suphp/suphp.SlackBuild

96 lines
2.7 KiB
Text
Raw Normal View History

2010-05-11 15:01:36 +02:00
#!/bin/sh
# Slackware build script for suPHP
# Written by Menno E. Duursma <druiloor@zonnet.nl>
PRGNAM=suphp
VERSION=0.6.3
2010-05-11 15:01:36 +02:00
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
2010-05-11 15:01:36 +02:00
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp
# The stock Apache on Slackware runs httpd under system
# user/group account 'apache'. If you happen to use some
# other account change the directives below
HTTPD_USER=${HTTPD_USER:-apache}
HTTPD_GROUP=${HTTPD_GROUP:-apache}
2010-05-11 15:01:36 +02:00
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
2010-05-11 15:01:36 +02:00
fi
set -e # Exit on most errors
2010-05-11 15:01:36 +02:00
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
2010-05-11 15:01:36 +02:00
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Apply a patch to have it globally honor the suPHP_Engine directive
patch -p0 --verbose < $CWD/suphp-$VERSION-vhosts.patch
2010-05-11 15:01:36 +02:00
# Default to secure settings, as any of the configuration options
# can be overwritten in the config-file /etc/httpd/suphp.conf anyway
2010-05-11 15:01:36 +02:00
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--with-apr=/usr/bin/apr-1-config \
--with-apxs=/usr/sbin/apxs \
--sysconfdir=/etc/httpd \
2010-05-11 15:01:36 +02:00
--with-apache-user=$HTTPD_USER \
--with-logfile=/var/log/httpd/suphp_log \
--enable-static=no \
--build=$ARCH-slackware-linux \
--host=$ARCH-slackware-linux
2010-05-11 15:01:36 +02:00
make
make install DESTDIR=$PKG
2010-05-11 15:01:36 +02:00
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
2010-05-11 15:01:36 +02:00
)
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
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
2010-05-11 15:01:36 +02:00
mkdir -p $PKG/etc/httpd
sed s/'webserver_user=apache'/"webserver_user=$HTTPD_USER"/g \
$CWD/suphp.conf >> $PKG/etc/httpd/suphp.conf.new
2010-05-11 15:01:36 +02:00
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
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