#!/bin/bash ## ## change these variables to the appropriate location/version etc ## BASE=${HOME}/build/apache/src APACHE_VERSION=1.3.29 MOD_SSL_VERSION=2.8.16-1.3.29 MOD_PERL_VERSION=1.29 SSL_BASE=/usr/local APACHE_PREFIX=/usr/local/apache ## leave the install dir commented or empty for the standard /usr/local... #APACHE_INSTALL_DIR=${HOME}/build/apache/pkg #PERL_INSTALL_DIR=${HOME}/build/apache/pkg/perl CERT_FILE=${HOME}/build/apache/tusk.cert LDFLAGS=-R/usr/local/lib ## ## a help section so next time I can remember how to use this script ## if [ $1 == "--help" ] then echo "build_apache [--help] [--install]" echo "Before using this script you need to download Apache (1.3.x)" echo "with corresponding mod_perl and mod_ssl and stick all three tar" echo "files into a directory. You also need an existing ssl certificate" echo "in an available directory. Perl, tar, gcc, sudo, Openssl and Perl" echo "packages URI and libwww-perl should already be installed for best" echo "results." echo "" echo "Once that's complete, edit build_apache and change the variables" echo "to the appropriate locations/versions." echo "" echo "This script last worked with gcc 3.3.2 using gnu make. If the" echo "script doesn't work for you . . . fix it." echo "" echo "Mike Kruckenberg kruckenberg.com>" exit fi ## ## first we do some checking to determine if everything is available ## echo "first a few checks to make sure we've got everything" if test ! -d $BASE then echo "can't find base dir: $BASE" exit fi for tarfile in apache_$APACHE_VERSION mod_ssl-$MOD_SSL_VERSION mod_perl-$MOD_PERL_VERSION; do if test ! -f $BASE/$tarfile.tar.gz then echo "can't find $BASE/$tarfile.tar.gz" exit fi done if test ! -f $CERT_FILE then echo "can't find SSL certificate: $CERT_FILE" exit fi if [ $1 = "--install" ] then INSTALL=yes echo "we are installing once compiling and testing is complete" else INSTALL=no echo "we are *NOT* installing, just compiling at testing" fi cd $BASE echo "entering "`pwd` ## ## remove existing directories and untar packages ## for package in apache_$APACHE_VERSION mod_ssl-$MOD_SSL_VERSION mod_perl-$MOD_PERL_VERSION; do if test -d $BASE/$tarfile then echo "removing existing $package dir" rm -fR $package fi echo "untarring $package.tar.gz" tar -xzf $package.tar.gz done ## ## configure mod_ssl ## cd mod_ssl-$MOD_SSL_VERSION echo "entering "`pwd` ./configure \ --with-apache=../apache_$APACHE_VERSION \ --with-ssl=$SSL_BASE ## ## configure mod_perl, have it do the make for apache and mod_perl ## cd ../mod_perl-$MOD_PERL_VERSION echo "entering "`pwd` /usr/bin/perl Makefile.PL \ DO_HTTPD=1 \ EVERYTHING=1 \ APACHE_SRC=../apache_$APACHE_VERSION/src \ USE_APACI=1 \ SSL_BASE=$SSL_BASE \ APACHE_PREFIX=$APACHE_PREFIX \ APACI_ARGS='--enable-module=ssl,--enable-module=rewrite' \ LIB=$PERL_INSTALL_DIR \ INSTALLBIN=$PERL_INSTALL_DIR \ INSTALLSCRIPT=$PERL_INSTALL_DIR \ installman1dir=$PERL_INSTALL_DIR \ INSTALLMAN3DIR=$PERL_INSTALL_DIR make ## ## install the certificate ## cd ../apache_$APACHE_VERSION echo "entering "`pwd` make certificate TYPE=existing CRT=$CRT_FILE ## ## install apache (mod_ssl and mod_perl enabled) and mod_perl Perl modules ## cd ../mod_perl-$MOD_PERL_VERSION echo "entering "`pwd` make test if [ $INSTALL = "yes" ] then echo "here we go (installing) . . . " make install root=$APACHE_INSTALL_DIR fi exit