#!/bin/sh # @(#) compile apache 2.2, mod_perl, embperl, php5 # (c) 2007..2009 by Dirk Jagdmann APACHEVER=2.2.11 MODPERLVER=2.0.4 EMBPERLVER=2.3.0 PHPVER=5.2.10 APACHEPREFIX=/usr/local/apache-$APACHEVER # /opt/apache APACHEDOWN=ftp://ftp.oregonstate.edu/pub/apache/httpd MODPERLDOWN=http://perl.apache.org/dist EMBPERLDOWN=ftp://ftp.dev.ecos.de/pub/perl/embperl/ PHPDOWN=http://de2.php.net/get APXS=$APACHEPREFIX/bin/apxs APACHEOPT="--with-mpm=prefork --enable-mods-shared=most --disable-imagemap --enable-deflate --enable-expires --enable-headers --enable-info --enable-rewrite --enable-mods-shared --enable-speling --enable-ssl --enable-unique-id --enable-usertrack --enable-vhost-alias --enable-v4-mapped" MODPERLOPT= EMBPERLOPT= PHPOPT="--with-zlib --with-bz2 --enable-dba --with-db4 --enable-exif --enable-ftp -with-openssl" CFLAGS=-O2 ############################################################################## export CFLAGS APACHE=httpd-$APACHEVER MODPERL=mod_perl-$MODPERLVER EMBPERL=Embperl-$EMBPERLVER PHP=php-$PHPVER APACHEFILE=$APACHE.tar.gz MODPERLFILE=$MODPERL.tar.gz EMBPERLFILE=$EMBPERL.tar.gz PHPFILE=$PHP.tar.bz2 function clean() { rm -rf $MODPERL rm -rf $APACHE rm -rf $EMBPERL rm -rf $PHP } function distclean() { clean rm -f $MODPERLFILE rm -f $APACHEFILE rm -f $EMBPERLFILE rm -f $EMBPERLPATCH rm -f $PHPFILE } function download { echo downloading... if [ ! -f $APACHEFILE ] then wget $APACHEDOWN/$APACHEFILE if [ ! -f $APACHEFILE ] then echo could not download $APACHEFILE exit 1 fi fi if [ ! -f $MODPERLFILE ] then wget $MODPERLDOWN/$MODPERLFILE if [ ! -f $MODPERLFILE ] then echo could not download $MODPERLFILE exit 1 fi fi if [ ! -f $EMBPERLFILE ] then wget $EMBPERLDOWN/$EMBPERLFILE if [ ! -f $EMBPERLFILE ] then echo could not download $EMBPERLFILE exit 1 fi fi if [ ! -f $PHPFILE ] then wget $PHPDOWN/$PHPFILE/from/this/mirror if [ ! -f $PHPFILE ] then echo could not download $PHPFILE exit 1 fi fi } function extract { echo extracting... if [ ! -d $APACHE ] then if ! tar xfz $APACHEFILE then echo could not extract $APACHEFILE exit 1 fi fi if [ ! -d $MODPERL ] then if ! tar xfz $MODPERLFILE then echo could not extract $MODPERLFILE exit 1 fi fi if [ ! -d $EMBPERL ] then if ! tar xfz $EMBPERLFILE then echo could not extract $EMBPERLFILE exit 1 fi fi if [ ! -d $PHP ] then if ! tar xfj $PHPFILE then echo could not extract $PHPFILE exit 1 fi fi } function applypatch { if [ ! -z "$EMBPERLPATCH" ] then echo patching embperl if [ ! -f "$EMBPERLPATCH" ] then wget $EMBPERLPATCHDOWN fi cd $EMBPERL if [ ! -f buildembperl.patched ] then zcat ../$EMBPERLPATCH | patch -p1 touch buildembperl.patched fi cd .. fi } function build { # applypatch ##### Apache echo configuring apache cd $APACHE if [ ! -f build.configure ] then if ! ./configure \ --prefix=$APACHEPREFIX \ $APACHEOPT then echo could not configure apache exit 1 fi touch build.configure fi echo make apache if [ ! -f build.make ] then if ! make then echo could not make apache exit 1 fi touch build.make fi #echo make certificate apache #if [ ! -f build.cert ] #then if ! make certificate # then echo could not make certificate # exit 1 # fi # touch build.cert #fi echo make install apache if [ ! -f build.install ] then if ! make install then echo could not make install apache exit 1 fi touch build.install fi cd .. #### modperl echo configuring modperl cd $MODPERL if [ ! -f build.configure ] then if ! perl Makefile.PL MP_APXS=$APXS $MODPERLOPT # EVERYTHING=1 then echo could not configure modperl exit 1 fi touch build.configure fi echo make modperl if [ ! -f build.make ] then if ! make then echo could not make modperl exit 1 fi touch build.make fi #echo test modperl #if [ ! -f build.test ] #then if ! make test # then echo could not test modperl # exit 1 # fi # touch build.test #fi echo make install modperl if [ ! -f build.install ] then if ! make install then echo could not make install modperl exit 1 fi touch build.install fi cd .. ### PHP cd $PHP if [ ! -f build.config ] ; then echo config PHP if ! ./configure --with-apxs2=$APXS $PHPOPT then echo could not configure php exit 1 fi touch build.config fi if [ ! -f build.make ] ; then echo make PHP if ! make then echo could not make php exit 1 fi touch build.make fi if [ ! -f build.install ] ; then echo install PHP if ! make install then echo could not make install php exit 1 fi touch build.install fi cd .. #### embperl echo configuring embperl cd $EMBPERL if [ ! -f build.config ] then if ! perl Makefile.PL then echo could not configure embperl exit 1 fi touch build.config fi echo make embperl if [ ! -f build.make ] then if ! make then echo could not make embperl exit 1 fi touch build.make fi echo installing embperl if [ ! -f build.install ] then if ! make install then echo could not make install embperl exit 1 fi touch build.install fi cd .. } # parse arguments if [ "$1" = "clean" ] then clean exit 0 elif [ "$1" = "distclean" ] then distclean exit 0 elif [ "$1" = "download" ] then download exit 0 elif [ "$1" = "extract" ] then download extract exit 0 else download extract build echo finished fi