#!/bin/bash ################## # _._ # /_ _`. (c) 2005, David A. Desrosiers # (.(.)| hacker at gnu dash designs dot com # |\_/'| # )____`\ Apache All-in-One Builder # //_V _\ \ # (( | `(_) If you find this useful, please drop me # / \> ' / \ an email, or send me bug reports if you find # \ \.__./ / problems with it. I accept PayPal too! =-) # `-' `-' # ################## # # License # ################## # # This script is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free # Software Foundation; either version 2 of the License, or (at your option) # any later version. # # This script is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., 59 # Temple Place # - Suite 330, Boston, MA 02111-1307, USA. # ################### # # TODO: # # Last update: Sat Oct 18 19:13:53 EDT 2003 # ################## # # 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.33.tar.gz # PHP.......: http://us2.php.net/distributions/php-4.3.10.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.16-1.3.29.tar.gz # mod-perl..: http://perl.apache.org/dist/mod_perl-1.29.tar.gz # ############################################################################# APACHE=apache_1.3.33 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.10 PHPURL=http://us2.php.net/distributions/$PHP.tar.gz MODSSL=mod_ssl-2.8.22-1.3.33 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 # Yes, I'm sure I could compress this into a function also, but # "It Works(tm)", patches are welcome. ########################################################## # # Startup stuff # ########################################################## # Directory of tarballs THISDIR=`pwd` WORKROOT=/var/build/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 ./configure --disable-shared # make && make test && make install make -j2 || exit make install ########################################################## # # mod_ssl # ########################################################## cd $WORKDIR/$MODSSL ./configure \ --with-apache=../$APACHE \ --with-ssl=/usr \ --with-mm=../$MM \ --enable-shared=ssl ########################################################## # # Apache # ########################################################## cd $WORKDIR/$APACHE # --enable-module=auth_db \ # --enable-shared=auth_db \ # Aplinger support # cat ../../aplinger.diff | patch -p1 # cp ../../lingerd-0.94/apache-1.3/ap_lingerd.c $WORKDIR/$APACHE/src/main/ # cp ../../lingerd-0.94/li_config.h $WORKDIR/$APACHE/src/main/ # My backported PreserveProxyHost patch from Apache 2.x # cat ../../PreserveProxyHost.diff | patch -p1 $PERL -pi -e 's,ndbm.h,gdbm-ndbm.h,g' $WORKDIR/$APACHE/src/modules/standard/mod_rewrite.h $PERL -pi -e 's,HARD_SERVER_LIMIT 256,HARD_SERVER_LIMIT 1024,g' $WORKDIR/$APACHE/src/include/httpd.h SSL_BASE=/usr \ INCLUDES=-I/usr \ LIBS=-lpthread \ LDFLAGS=-L/usr/lib \ EAPI_MM=../$MM \ CFLAGS="-g -O3 -mcpu=k6" \ ./configure \ --prefix=$AP_PREFIX \ --enable-suexec \ --suexec-caller=nobody \ --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=speling \ --enable-shared=speling \ --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 || exit make -j2 || exit make install # make certificate && make install ########################################################## # # compile php as DSO # ########################################################## cd $WORKDIR/$PHP # non-pic patch from Rasmus Lerdorf # cat ../../non-pic_php.diff | patch -p0 ./configure \ --with-apxs=$AP_PREFIX/bin/apxs \ --disable-debug \ --without-pear \ --enable-bcmath \ --enable-exif \ --enable-ftp \ --enable-gd-native-ttf \ --enable-inline-optimization \ --enable-magic-quotes \ --enable-mysql \ --enable-track-vars \ --enable-wddx \ --with-pic \ --with-openssl=/usr \ --with-calendar=shared \ --with-freetype-dir=/usr \ --with-gd \ --with-gettext=/usr \ --with-imap=/usr \ --with-kerberos \ --with-t1lib=/usr \ --with-xpm-dir=/usr \ --enable-memory-limit \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-ttf \ --with-zlib \ --with-zlib-dir=/usr || exit # $PERL -pi -e 's,prefer-pic,prefer-non-pic,g' `find . -name 'Makefile*'` make -j2 || exit make install # cp php.ini-dist /usr/local/lib/php.ini ########################################################## # # compile mod_perl DSO # ########################################################## cd $WORKDIR/$MODPERL perl Makefile.PL \ USE_APXS=1 \ USE_THREADS=1 \ WITH_APXS=$AP_PREFIX/bin/apxs \ EVERYTHING=1 || exit make -j2 || exit make install # DONE! # .dd