binbuild.sh revision 1abda201e49646ada8a4d90d63f82a850034c63d
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd#!/bin/sh
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd#
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd# binbuild.sh - Builds an Apache binary distribution.
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd# Initially written by Lars Eilebrecht <lars@apache.org>.
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd#
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd# This script falls under the Apache License.
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd# See http://www.apache.org/docs/LICENSE
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndCONFIGPARAM="--with-layout=BinaryDistribution --enable-module=most --enable-shared=max"
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowenAPDIR=`pwd`
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowenAPDIR=`basename $APDIR`
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowenVER=`echo $APDIR |sed s/apache_//`
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowenOS=`src/helpers/GuessOS`
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndTAR="`src/helpers/PrintPath tar`"
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndGTAR="`src/helpers/PrintPath gtar`"
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowenGZIP="`src/helpers/PrintPath gzip`"
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndif [ x$1 != x ]
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndthen
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd USER=$1
3f08db06526d6901aa08c110b5bc7dde6bc39905ndelse
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd USER="`src/helpers/buildinfo.sh -n %u@%h%d`"
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndfi
1c8f2418892d98febb00a06b9a4f45f8bcfd80a3nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndif [ ! -f ./ABOUT_APACHE ]
bf7fcf0c216a914407c0877aa37894fd9aecc219nilgunthen
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung echo "ERROR: The current directory contains no valid Apache distribution."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Please change the directory to the top level directory of a freshly"
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf echo "unpacked Apache 1.3 source distribution and re-execute the script"
4b575a6b6704b516f22d65a3ad35696d7b9ba372rpluem echo "'./src/helpers/bindbuild.sh'."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd exit 1;
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndfi
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndif [ -d ./CVS ]
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndthen
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "ERROR: The current directory is a CVS checkout of Apache."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Only a standard Apache 1.3 source distribution should be used to"
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "create a binary distribution."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd exit 1;
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndfi
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndecho "Building Apache $VER binary distribution..."
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndecho "Platform is \"$OS\"..."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd( echo "Build log for Apache binary distribution" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd ./configure $CONFIGPARAM && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd make clean && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd rm -rf bindist install-bindist.sh *.bindist
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd make && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd make install-quiet root="bindist/" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd make clean && \
5effc8b39fae5cd169d17f342bfc265705840014rbowen echo "----------------------------------------------------------------------" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "[EOF]" \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd) > build.log 2>&1
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndif [ ! -f ./bindist/bin/httpd ]
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndthen
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "ERROR: Failed to build Apache. See \"build.log\" for details."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd exit 1;
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndfi
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndecho "Binary image successfully created..."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd./bindist/bin/httpd -v
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndecho "Creating supplementary files..."
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd( echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Apache $VER binary distribution" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "================================" && \
f5a398cc8880978754903f9ece8e4beb63a81cedrbowen echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "This binary distribution is usable on a \"$OS\"" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "system and was built by \"$USER\"." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "The distribution contains all standard Apache modules as shared" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "objects. This allows you to enable or disable particular modules" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "with the LoadModule/AddModule directives in the configuration file" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "without the need to re-compile Apache." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "See \"INSTALL.bindist\" on how to install the distribution." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "NOTE: Please do not send support-related mails to the address mentioned" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " above or to any member of the Apache Group! Support questions" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " should be directed to the \"comp.infosystems.www.servers.unix\"" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " or \"comp.infosystems.www.servers.ms-windows\" newsgroup" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " (as appropriate for the platform you use), where some of the" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " Apache team lurk, in the company of many other Apache gurus" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " who should be able to help." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " If you think you found a bug in Apache or have a suggestion please" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " visit the bug report page at http://www.apache.org/bug_report.html" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" && \
ec878843fb39a84bac1e1c2e1a2b821b1b7882fend ./bindist/bin/httpd -V && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "----------------------------------------------------------------------" \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd) > README.bindist
1cc20a8827ff6056399d64e3106b44d31e8e0e53ndcp README.bindist ../apache_$VER-$OS.README
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd( echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Apache $VER binary installation" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "================================" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "To install this binary distribution you have to execute the installation" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "The script takes the ServerRoot directory into which you want to install" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Apache as an option. If you ommit the option the default path" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "\"/usr/local/apache\" is used." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Make sure you have write permissions in the target directory, e.g. switch" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "to user \"root\" before you execute the script." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "See \"README.bindist\" for further details about this distribution." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Please note that this distribution includes the complete Apache source code." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "installation on your system." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "See \"INSTALL\" for details on how to accomplish this." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd) > INSTALL.bindist
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd( echo "#!/bin/sh" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "#" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "# Usage: install-bindist.sh [ServerRoot]" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "# This script installs the Apache binary distribution and" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "# was automatically created by binbuild.sh." && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " " && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "if [ .\$1 = . ]" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "then" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " SR=/usr/local/apache" && \
1c8f2418892d98febb00a06b9a4f45f8bcfd80a3nd echo "else" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo " SR=\$1" && \
bf7fcf0c216a914407c0877aa37894fd9aecc219nilgun echo "fi" && \
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung echo "echo \"Installing binary distribution for platform $OS\"" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "echo \"into directory \$SR ...\"" && \
5effc8b39fae5cd169d17f342bfc265705840014rbowen echo "./src/helpers/mkdir.sh \$SR" && \
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen echo "cp -r bindist/proxy \$SR/proxy" && \
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd echo "cp -r bindist/man \$SR/man" && \
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd echo "cp -r bindist/logs \$SR/logs" && \
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd echo "cp -r bindist/libexec \$SR/libexec" && \
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd echo "cp -r bindist/include \$SR/include" && \
1cc20a8827ff6056399d64e3106b44d31e8e0e53nd echo "cp -r bindist/icons \$SR/icons" && \
echo "cp -r bindist/cgi-bin \$SR/cgi-bin" && \
echo "cp -r bindist/bin \$SR/bin" && \
echo "if [ -d \$SR/conf ]" && \
echo "then" && \
echo " echo \"[Preserving existing configuration files.]\"" && \
echo " cp -r bindist/conf/*.default \$SR/conf/" && \
echo "else" && \
echo " cp -r bindist/conf \$SR/conf" && \
echo "fi" && \
echo "if [ -d \$SR/htdocs ]" && \
echo "then" && \
echo " echo \"[Preserving existing htdocs directory.]\"" && \
echo "else" && \
echo " cp -r bindist/htdocs \$SR/htdocs" && \
echo "fi" && \
echo "sed -e s%/usr/local/apache%\$SR/% \$SR/conf/httpd.conf.default > \$SR/conf/httpd.conf" && \
echo "sed -e s%PIDFILE=%PIDFILE=\$SR/% -e s%HTTPD=%HTTPD=\\\"\$SR/% -e \"s%/httpd$%/httpd -d \$SR\\\"%\" bindist/bin/apachectl > \$SR/bin/apachectl" && \
echo " " && \
echo "echo \"Ready.\"" && \
echo "echo \" +--------------------------------------------------------+\"" && \
echo "echo \" | You now have successfully installed the Apache $VER |\"" && \
echo "echo \" | HTTP server. To verify that Apache actually works |\"" && \
echo "echo \" | correctly you now should first check the (initially |\"" && \
echo "echo \" | created or preserved) configuration files |\"" && \
echo "echo \" | |\"" && \
echo "echo \" | \$SR/conf/httpd.conf\"" && \
echo "echo \" | |\"" && \
echo "echo \" | and then you should be able to immediately fire up |\"" && \
echo "echo \" | Apache the first time by running: |\"" && \
echo "echo \" | |\"" && \
echo "echo \" | \$SR/bin/apachectl start \"" &&\
echo "echo \" | |\"" && \
echo "echo \" | Thanks for using Apache. The Apache Group |\"" && \
echo "echo \" | http://www.apache.org/ |\"" && \
echo "echo \" +--------------------------------------------------------+\"" && \
echo "echo \" \"" \
) > install-bindist.sh
chmod 755 install-bindist.sh
sed -e "s%\"/htdocs%\"/usr/local/apache/htdocs%" \
-e "s%\"/icons%\"/usr/local/apache/icons%" \
-e "s%\"/cgi-bin%\"/usr/local/apache/cgi-bin%" \
-e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
-e "s%#ServerName.*%#ServerName localhost%" \
-e "s%Port 8080%Port 80%" \
bindist/conf/httpd.conf.default > bindist/conf/httpd.conf
cp bindist/conf/httpd.conf bindist/conf/httpd.conf.default
echo "Creating distribution archive and readme file..."
if [ ".`grep -i error build.log > /dev/null`" != . ]
then
echo "ERROR: Failed to build Apache. See \"build.log\" for details."
exit 1;
else
if [ "x$GTAR" != "x" ]
then
$GTAR -zcf ../apache_$VER-$OS.tar.gz -C .. apache_$VER
else
if [ "x$TAR" != "x" ]
then
$TAR -cf ../apache_$VER-$OS.tar -C .. apache_$VER
if [ "x$GZIP" != "x" ]
then
$GZIP ../apache_$VER-$OS.tar
fi
else
echo "ERROR: Could not find a 'tar' program!"
echo " Please execute the following commands manually:"
echo " tar -cf ../apache_$VER-$OS.tar ."
echo " gzip ../apache_$VER-$OS.tar"
fi
fi
if [ -f ../apache_$VER-$OS.tar.gz ] && [ -f ../apache_$VER-$OS.README ]
then
echo "Ready."
echo "You can find the binary archive (apache_$VER-$OS.tar.gz)"
echo "and the readme file (apache_$VER-$OS.README) in the"
echo "parent directory."
exit 0;
else
exit 1;
fi
fi