binbuild.sh revision 832923c3efd3343644ced4a6a65b16cd1edc05e5
888d5172c9670a1a6278556625f1f6199ec53a2dfielding# binbuild.sh - Builds an Apache binary distribution.
888d5172c9670a1a6278556625f1f6199ec53a2dfielding# Initially written by Lars Eilebrecht <lars@apache.org>.
888d5172c9670a1a6278556625f1f6199ec53a2dfielding# This script falls under the Apache License.
f2bb0fcbae983ee168351523a860675292b18e5arbbCONFIGPARAM="--with-layout=BinaryDistribution --prefix=`pwd`/bindist"
f2bb0fcbae983ee168351523a860675292b18e5arbbif [ x$1 != x ]; then
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: The current directory contains no valid Apache distribution."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Please change the directory to the top level directory of a freshly"
62c34f2ec7702e37bb57679c3bfe624bc9822de4rbb echo "unpacked Apache 2.0 source distribution and re-execute the script"
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: The current directory is a CVS checkout of Apache."
62c34f2ec7702e37bb57679c3bfe624bc9822de4rbb echo "Only a standard Apache 2.0 source distribution should be used to"
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "create a binary distribution."
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Building Apache $VER binary distribution..."
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Platform is \"$OS\"..."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding( echo "Build log for Apache binary distribution" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: Failed to build Apache. See \"build.log\" for details."
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlarsecho "Binary image successfully created..."
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Creating supplementary files..."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "This binary distribution is usable on a \"$OS\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "The distribution contains all standard Apache modules as shared" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "objects. This allows you to enable or disable particular modules" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "with the LoadModule/AddModule directives in the configuration file" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "See \"INSTALL.bindist\" on how to install the distribution." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "NOTE: Please do not send support-related mails to the address mentioned" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " above or to any member of the Apache Group! Support questions" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " should be directed to the \"comp.infosystems.www.servers.unix\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " or \"comp.infosystems.www.servers.ms-windows\" newsgroup" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " (as appropriate for the platform you use), where some of the" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " Apache team lurk, in the company of many other Apache gurus" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " If you think you found a bug in Apache or have a suggestion please" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " visit the bug report page at http://www.apache.org/bug_report.html" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "To install this binary distribution you have to execute the installation" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "The script takes the ServerRoot directory into which you want to install" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Apache as an option. If you ommit the option the default path" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Make sure you have write permissions in the target directory, e.g. switch" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "to user \"root\" before you execute the script." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "See \"README.bindist\" for further details about this distribution." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Please note that this distribution includes the complete Apache source code." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "See \"INSTALL\" for details on how to accomplish this." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "# Usage: install-bindist.sh [ServerRoot]" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "# This script installs the Apache binary distribution and" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "# was automatically created by binbuild.sh." && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " echo \"Failed to create directory: \${path}\"" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " test -d \${to} || lmkdir \${to} \${dmode}" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " (cd \${from} && tar -cf - *) | (cd \${to} && tar -xf -)" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " find \${to} -type f -print | xargs chmod \${fmode}" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " find \${to} -type d -print | xargs chmod \${dmode}" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "## determine path to (optional) Perl interpreter" && \
a75c915ed35cab08df1518939f2dd774def23fb4randy echo " if \`\${dir}/\${pperl} -v | grep 'version 5\.' >/dev/null 2>&1\` ; then" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "echo \"Installing binary distribution for platform $OS\"" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "lcopy bindist/include \$SR/include 755 644" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "lcopy bindist/cgi-bin \$SR/cgi-bin 750 750" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " echo \"[Preserving existing configuration files.]\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " echo \"[Preserving existing htdocs directory.]\"" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "sed -e \"s;^#!/.*;#!\$PERL;\" -e \"s;\@prefix\@;\$SR;\" -e \"s;\@sbindir\@;\$SR/bin;\" \\" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " -e \"s;\@libexecdir\@;\$SR/libexec;\" -e \"s;\@includedir\@;\$SR/include;\" \\" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo " -e \"s;\@sysconfdir\@;\$SR/conf;\" bindist/bin/apxs > \$SR/bin/apxs" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "sed -e \"s;^#!/.*;#!\$PERL;\" bindist/bin/dbmmanage > \$SR/bin/dbmmanage" && \
832923c3efd3343644ced4a6a65b16cd1edc05e5rbb echo "sed -e \"s%/usr/local/apache%\$SR%\" \$SR/conf/httpd-std.conf > \$SR/conf/httpd.conf" && \
29f36295d4e95ef41b3eb2c24908ee0638a32198randy echo "sed -e \"s%PIDFILE=%PIDFILE=\$SR/%\" -e \"s%HTTPD=%HTTPD=\\\"\$SR/%\" -e \"s%httpd\$%httpd -d \$SR -R \$SR/libexec\\\"%\" bindist/bin/apachectl > \$SR/bin/apachectl" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "echo \" +--------------------------------------------------------+\"" && \
fe91ea62b1c4a963f6abae07f9735a53a719058clars echo "echo \" | You now have successfully installed the Apache $VER |\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "echo \" | HTTP server. To verify that Apache actually works |\"" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "echo \" | correctly you should first check the (initially |\"" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "echo \" | created or preserved) configuration files: |\"" && \
432100a6b78199e710fde202ea669e8069d7bfd6randy echo "echo \" | You should then be able to immediately fire up |\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "echo \" | Apache the first time by running: |\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "echo \" | Thanks for using Apache. The Apache Group |\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "echo \" +--------------------------------------------------------+\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding -e "s%#ServerName.*%#ServerName localhost%" \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding -e "s%Port 8080%Port 80%" \
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingcp bindist/conf/httpd.conf bindist/conf/httpd.conf.default
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Creating distribution archive and readme file..."
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingif [ ".`grep -i error build.log > /dev/null`" != . ]
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: Failed to build Apache. See \"build.log\" for details."
1621254cf82b58cfac8fa84c0d28b1bebb90c0c8stoddard x*390*) $TAR -cfU ../apache_$VER-$OS.tar -C .. apache_$VER;;
3fa13f6e3793f6a3f3c4523787c5e18279450c52gstein *) (cd .. && $TAR -cf apache_$VER-$OS.tar apache_$VER);;
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: Could not find a 'tar' program!"
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " Please execute the following commands manually:"
71abf82bde7656b0bf32d4b20818b70abdec8d16lars echo " tar -cf ../apache_$VER-$OS.tar ."
71abf82bde7656b0bf32d4b20818b70abdec8d16lars echo " gzip ../apache_$VER-$OS.tar"
71abf82bde7656b0bf32d4b20818b70abdec8d16lars if [ -f ../apache_$VER-$OS.tar.gz ] && [ -f ../apache_$VER-$OS.README ]
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Ready."
71abf82bde7656b0bf32d4b20818b70abdec8d16lars echo "You can find the binary archive (apache_$VER-$OS.tar.gz)"
71abf82bde7656b0bf32d4b20818b70abdec8d16lars echo "and the readme file (apache_$VER-$OS.README) in the"
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "parent directory."