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
|
2010-05-11 22:25:46 +02:00
|
|
|
VERSION=0.6.3
|
2010-05-11 15:01:36 +02:00
|
|
|
ARCH=${ARCH:-i486}
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2010-05-11 22:25:46 +02:00
|
|
|
|
2010-05-11 19:46:03 +02:00
|
|
|
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
|
|
|
|
|
2010-05-11 22:25:46 +02:00
|
|
|
# The stock Apache on Slackware runs httpd under system
|
2010-05-11 19:46:03 +02:00
|
|
|
# user/group account 'apache'. If you happen to use some
|
2010-05-11 22:25:46 +02:00
|
|
|
# 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"
|
2010-05-11 22:25:46 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-11 15:01:36 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-11 22:25:46 +02:00
|
|
|
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
|
2010-05-11 22:25:46 +02:00
|
|
|
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 .
|
|
|
|
|
2010-05-11 22:25:46 +02:00
|
|
|
# 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
|
|
|
|
2010-05-11 22:25:46 +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 \
|
2010-05-11 19:46:03 +02:00
|
|
|
--sysconfdir=/etc/httpd \
|
2010-05-11 15:01:36 +02:00
|
|
|
--with-apache-user=$HTTPD_USER \
|
2010-05-11 22:25:46 +02:00
|
|
|
--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
|
2010-05-11 22:25:46 +02:00
|
|
|
make install DESTDIR=$PKG
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
( cd $PKG
|
2010-05-11 22:25:46 +02:00
|
|
|
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
|
2010-05-11 22:25:46 +02:00
|
|
|
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
|
2010-05-11 15:01:36 +02:00
|
|
|
|
2010-05-11 19:46:03 +02:00
|
|
|
mkdir -p $PKG/etc/httpd
|
2010-05-11 22:25:46 +02:00
|
|
|
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
|
|
|
|
|