##################
#
# You will need the following perl modules installed first:
#
# MIME::Base64
# URI
# HTML::Parser
# Digest::MD5
# Bundle::libnet
# LWP
#
##########################################################
#
# Sources:
#
# Apache....: ftp://apache.mirrors.pair.com/httpd/apache_1.3.28.tar.gz
# PHP.......: http://fi.php.net/distributions/php-4.3.3.tar.gz
# MM........: ftp://ftp.ossp.org/pkg/lib/mm/mm-1.3.0.tar.gz
# mod-ssl...: http://www.modssl.org/source/mod_ssl-2.8.15-1.3.28.tar.gz
# mod-perl..: http://perl.apache.org/dist/mod_perl-1.29.tar.gz
#
#############################################################################
APACHE=apache_1.3.28
APURL=ftp://apache.mirrors.pair.com/httpd/$APACHE.tar.gz
# Prefix where Apache is going to be installed
AP_PREFIX=/usr/local/apache
MM=mm-1.3.0
MMURL=ftp://ftp.ossp.org/pkg/lib/mm/$MM.tar.gz
PHP=php-4.3.3
PHPURL=http://fi.php.net/distributions/php-4.3.3.tar.gz
MODSSL=mod_ssl-2.8.15-1.3.28
MODSSLURL=http://www.modssl.org/source/$MODSSL.tar.gz
MODPERL=mod_perl-1.29
MODPERLURL=http://www.ibiblio.org/pub/mirrors/apache/perl/$MODPERL.tar.gz
##########################################################
#
# Startup stuff
#
##########################################################
# Directory of tarballs
THISDIR=`pwd`
WORKROOT=/tmp/apache
WORKDIR=$WORKROOT/work
MD5FILE=$THISDIR/source.md5
source functions
wherebe MD5SUM md5sum
wherebe TAR tar
wherebe GUNZIP gunzip
wherebe GREP grep
wherebe WGET wget
wherebe MKDIR mkdir
wherebe RM rm
wherebe MAKE make
wherebe PERL perl
wherebe SUDO sudo
echo ""
if [ ! -d $WORKROOT ]; then
echo "FATAL ERROR: WORKROOT ($WORKROOT) did not exist, exiting now.."
echo ""
echo "Please make sure to set the WORKROOT value properly in the script The other"
echo "necessary directories will be created automagically if they do not already"
echo "exist. All of the building will be done inside the directory you set here."
echo ""
exit
fi
if [ ! -d $WORKDIR ]; then
echo " ERROR: WORKDIR ($WORKDIR) did not exist.. creating now."
echo ""
$MKDIR $WORKDIR
fi
##########################################################
#
# Fetch, unpack, and test everything
#
##########################################################
URLS=($MMURL $MODSSLURL $APURL $PHPURL $MODPERLURL)
BINS=($MM $MODSSL $APACHE $PHP $MODPERL)
for b in ${BINS[@]}; do
if [ ! -f $WORKROOT/$b.tar.gz ]; then
for u in ${URLS[@]}; do
echo " Source not found. fetching from $u..";
$WGET -c -q --progress=dot $u;
done;
else
md5check $b.tar.gz
fi
done
echo ""
##########################################################
#
# Shared Memory Allocation
#
##########################################################
cd $WORKDIR/$MM
if [ -f $WORKDIR/$MM/config.status ]; then
make distclean
fi
./configure --disable-shared
make
make test
sudo make install
##########################################################
#
# mod_ssl
#
##########################################################
cd $WORKDIR/$MODSSL
if [ -f $WORKDIR/$MM/config.status ]; then
make distclean
fi
./configure \
--with-apache=../$APACHE \
--with-ssl=/usr \
--with-mm=../$MM \
--enable-shared=ssl
##########################################################
#
# Apache
#
##########################################################
cd $WORKDIR/$APACHE
if [ -f $WORKDIR/$APACHE/config.status ]; then
make distclean
fi
# Fix for building on Linux, which has no ndbm.h
$PERL -pi -e 's,ndbm.h,gdbm-ndbm.h,g' $WORKDIR/$APACHE/src/modules/standard/mod_rewrite.h
SSL_BASE=/usr\
LIBS=-lpthread \
EAPI_MM=../$MM \
./configure \
--prefix=$AP_PREFIX \
--enable-module=ssl \
--enable-module=env \
--enable-shared=env \
--enable-module=log_config \
--enable-shared=log_config \
--enable-module=log_agent \
--enable-shared=log_agent \
--enable-module=log_referer \
--enable-shared=log_referer \
--enable-module=mime \
--enable-shared=mime \
--enable-module=negotiation \
--enable-shared=negotiation \
--enable-module=status \
--enable-shared=status \
--enable-module=info \
--enable-shared=info \
--enable-module=include \
--enable-shared=include \
--enable-module=autoindex \
--enable-shared=autoindex \
--enable-module=dir \
--enable-shared=dir \
--enable-module=cgi \
--enable-shared=cgi \
--enable-module=asis \
--enable-shared=asis \
--enable-module=imap \
--enable-shared=imap \
--enable-module=actions \
--enable-shared=actions \
--enable-module=userdir \
--enable-shared=userdir \
--enable-module=alias \
--enable-shared=alias \
--enable-module=rewrite \
--enable-shared=rewrite \
--enable-module=access \
--enable-shared=access \
--enable-module=auth \
--enable-shared=auth \
--enable-module=auth_anon \
--enable-shared=auth_anon \
--enable-module=auth_db \
--enable-shared=auth_db \
--enable-module=digest \
--enable-shared=digest \
--enable-module=proxy \
--enable-shared=proxy \
--enable-module=expires \
--enable-shared=expires \
--enable-module=headers \
--enable-shared=headers \
--enable-module=usertrack \
--enable-shared=usertrack \
--enable-module=setenvif \
--enable-shared=setenvif \
--enable-shared=ssl \
--enable-rule=SHARED_CORE \
--enable-rule=SHARED_CHAIN \
--enable-module=so
make
make test
# just use the defaults for now
# make certificate
sudo make install
##########################################################
#
# compile php as DSO
#
##########################################################
cd $WORKDIR/$PHP
if [ -f $WORKDIR/$PHP/config.status ]; then
make distclean
fi
./configure \
--with-apxs=$AP_PREFIX/bin/apxs \
--disable-debug \
--enable-apc \
--enable-bcmath \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-inline-optimization \
--enable-libgcc \
--enable-magic-quotes \
--enable-memory-limit \
--enable-mysql \
--enable-sysvshm \
--enable-track-vars \
--enable-trans-sid \
--enable-wddx \
--with-calendar=shared \
--with-freetype-dir=/usr \
--with-gd=/usr \
--with-gettext=/usr \
--with-imap=/usr \
--with-jpeg-dir=/usr \
--with-kerberos \
--with-mysql=/usr \
--with-openssl=/usr \
--with-png-dir=/usr \
--with-t1lib=/usr \
--with-ttf \
--with-zlib \
--with-zlib-dir=/usr
make
# make test
sudo make install
cp php.ini-dist /usr/local/lib/php.ini
##########################################################
#
# compile mod_perl DSO
#
##########################################################
cd $WORKDIR/$MODPERL
if [ -f $WORKDIR/$MODPERL/Makefile ]; then
make distclean
fi
perl Makefile.PL \
USE_APXS=1 \
WITH_APXS=$AP_PREFIX/bin/apxs \
EVERYTHING=1
make
sudo make install
####
md5check() {
MD5_TMP=`$GREP $1 ${MD5FILE}`
BINDESC=`echo $MD5_TMP | awk '{print $2}'`
echo -n " Testing $1 for corruption... "
if [ ! -z "$MD5SUM" ]; then
if [ ! -z "$MD5_TMP" ]; then
echo "$MD5_TMP" | awk '{print $1, "", $2}' | $MD5SUM -c
fi
fi
if [ ! -z "$MD5_TMP" ]; then
$GUNZIP -t $1 &>/dev/null
if [ $? -eq 1 ]; then
echo " MD5 check failed, corrupt!"
else
echo -n " MD5 check passed.. "
fi
fi
echo -n "unpacking.. "
$TAR zxvf $1 -C $WORKDIR &>/dev/null
echo "done!"
}
wherebe() {
echo -n "Checking for $2..."
test -x $2 && export "$1"="$2"
test -x /bin/$2 && export "$1"="/bin/$2"
test -x /sbin/$2 && export "$1"="/sbin/$2"
test -x /usr/bin/$2 && export "$1"="/usr/bin/$2"
test -x /usr/sbin/$2 && export "$1"="/usr/sbin/$2"
test -x /usr/local/bin/$2 && export "$1"="/usr/local/bin/$2"
test -x /usr/local/sbin/$2 && export "$1"="/usr/local/sbin/$2"
test -x $LOCAL_PATH/bin/$2 && export "$1"="$LOCAL_PATH/bin/$2"
if [ `echo echo '$'$1'' | /bin/sh` ]; then
echo "`echo echo '$'$1'' | /bin/sh`"
else
echo " FAILED"
if [ $3 ]; then
echo " -required external resourced missing"
exit 1
else
echo
fi
exit
fi
}
pause() {
COUNT=$1
for i in `seq 0 $COUNT`; do
sleep 1;
echo -n ".";
done;
echo ""
}
##
##
2cdece7b4881d541e072de6a2b65db77 apache_1.3.28.tar.gz
fe3fede4115354155fc6185522f7c6b2 php-4.3.3.tar.gz
4bf43697983bf585905ee9a14b00dc32 mm-1.3.0.tar.gz
0f37d6efd51128f696000d73624f5aff mod_ssl-2.8.15-1.3.28.tar.gz
1491931790509b9af06fc037d02b0e7a mod_perl-1.29.tar.gz