888d5172c9670a1a6278556625f1f6199ec53a2dfielding#!/bin/sh
240b85022b73af58a6d971cd3d05d54037d8f682nd#
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding# the License. You may obtain a copy of the License at
240b85022b73af58a6d971cd3d05d54037d8f682nd#
240b85022b73af58a6d971cd3d05d54037d8f682nd# http://www.apache.org/licenses/LICENSE-2.0
240b85022b73af58a6d971cd3d05d54037d8f682nd#
240b85022b73af58a6d971cd3d05d54037d8f682nd# Unless required by applicable law or agreed to in writing, software
240b85022b73af58a6d971cd3d05d54037d8f682nd# distributed under the License is distributed on an "AS IS" BASIS,
240b85022b73af58a6d971cd3d05d54037d8f682nd# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
240b85022b73af58a6d971cd3d05d54037d8f682nd# See the License for the specific language governing permissions and
240b85022b73af58a6d971cd3d05d54037d8f682nd# limitations under the License.
888d5172c9670a1a6278556625f1f6199ec53a2dfielding#
240b85022b73af58a6d971cd3d05d54037d8f682nd#
240b85022b73af58a6d971cd3d05d54037d8f682nd# binbuild.sh - Builds an Apache binary distribution.
240b85022b73af58a6d971cd3d05d54037d8f682nd# Initially written by Lars Eilebrecht <lars apache.org>.
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezOS=`./build/config.guess`
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezPRINTPATH="build/PrintPath"
189ab8a7e8c8b1139f8f12130a8f01ba35cbf853wsanchezAPFULLDIR=`pwd`
189ab8a7e8c8b1139f8f12130a8f01ba35cbf853wsanchezBUILD_DIR="$APFULLDIR/bindist"
5a322de173626af6d7e4e3e6bb67082ae5e7981egregamesDEFAULT_DIR="/usr/local/apache2"
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezAPDIR="$APFULLDIR"
8e157dab9212d6770973543a56bf644387e5a178jimAPDIR=`basename $APDIR`
abe277e8a4d9853f601b149f7a3cd62e58c2145etrawickCONFIGPARAM="--enable-layout=Apache --prefix=$BUILD_DIR --enable-mods-shared=most --with-expat=$APFULLDIR/srclib/apr-util/xml/expat --enable-static-support"
189ab8a7e8c8b1139f8f12130a8f01ba35cbf853wsanchezVER=`echo $APDIR | sed s/httpd-//`
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezTAR="`$PRINTPATH tar`"
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezGZIP="`$PRINTPATH gzip`"
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezCOMPRESS="`$PRINTPATH compress`"
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchezMD5="`$PRINTPATH md5`"
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchezif [ x$MD5 = x ]; then
1e5333ef1a0edb888d75c0cdd90b33fa7e89fc31wsanchez OPENSSL="`$PRINTPATH openssl`"
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez if [ x$OPENSSL != x ]; then
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez MD5="$OPENSSL md5"
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez fi
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchezfi
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlars
f2bb0fcbae983ee168351523a860675292b18e5arbbif [ x$1 != x ]; then
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlars USER=$1
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlarselse
62c34f2ec7702e37bb57679c3bfe624bc9822de4rbb USER="`build/buildinfo.sh -n %u@%h%d`"
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlarsfi
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
86d87cb5057a62612a598348e737c4ab5a0a657cwsanchezif [ ! -f ./ABOUT_APACHE ]; 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"
c600cf3a41e0271a863287eb0b0a189d14eb1243trawick echo "'./build/binbuild.sh'."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding exit 1;
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingfi
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
86d87cb5057a62612a598348e737c4ab5a0a657cwsanchezif [ -d ./CVS ]; then
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."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding exit 1;
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingfi
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Building Apache $VER binary distribution..."
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Platform is \"$OS\"..."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
888d5172c9670a1a6278556625f1f6199ec53a2dfielding( echo "Build log for Apache binary distribution" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding ./configure $CONFIGPARAM && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding make clean && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding rm -rf bindist install-bindist.sh *.bindist
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding make && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
f2bb0fcbae983ee168351523a860675292b18e5arbb make install root="bindist/" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding make clean && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "[EOF]" \
04ec2a6297e5cbf087f92909927919ca425ff633gregames) 2>&1 | tee build.log
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
86d87cb5057a62612a598348e737c4ab5a0a657cwsanchezif [ ! -f ./bindist/bin/httpd ]; then
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: Failed to build Apache. See \"build.log\" for details."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding exit 1;
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingfi
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlarsecho "Binary image successfully created..."
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlars
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlars./bindist/bin/httpd -v
6c423f77cd58c4eb48f5c489d05f5f976c1e74ddlars
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Creating supplementary files..."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
888d5172c9670a1a6278556625f1f6199ec53a2dfielding( echo " " && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Apache $VER binary distribution" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "================================" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " " && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "This binary distribution is usable on a \"$OS\"" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "system and was built by \"$USER\"." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "" && \
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 "without the need to re-compile Apache." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "See \"INSTALL.bindist\" on how to install the distribution." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " " && \
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" && \
4481373210a7c58c0f059410a1ad80593cdbdb09slive echo " should be directed to the forums mentioned at" && \
4481373210a7c58c0f059410a1ad80593cdbdb09slive echo " http://httpd.apache.org/lists.html#http-users" && \
4481373210a7c58c0f059410a1ad80593cdbdb09slive echo " where some of the Apache team lurk, in the company of many other" && \
4481373210a7c58c0f059410a1ad80593cdbdb09slive echo " Apache gurus who should be able to help." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " If you think you found a bug in Apache or have a suggestion please" && \
4481373210a7c58c0f059410a1ad80593cdbdb09slive echo " visit the bug report page at http://httpd.apache.org/bug_report.html" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " " && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding ./bindist/bin/httpd -V && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "----------------------------------------------------------------------" \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding) > README.bindist
94a719cfed2369f14a96e1835623198c2df96080rbbcp README.bindist ../httpd-$VER-$OS.README
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
888d5172c9670a1a6278556625f1f6199ec53a2dfielding( echo " " && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Apache $VER binary installation" && \
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 " " && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "The script takes the ServerRoot directory into which you want to install" && \
5a322de173626af6d7e4e3e6bb67082ae5e7981egregames echo "Apache as an option. If you omit the option the default path" && \
5a322de173626af6d7e4e3e6bb67082ae5e7981egregames echo "\"$DEFAULT_DIR\" is used." && \
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 " " && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "See \"README.bindist\" for further details about this distribution." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " " && \
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 "installation on your system." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "See \"INSTALL\" for details on how to accomplish this." && \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo " " \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding) > INSTALL.bindist
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
245cc5a2ec164cde44aa9849a78d8fa144d83e25gregamessed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
245cc5a2ec164cde44aa9849a78d8fa144d83e25gregames -e "s%\@ver\@%$VER%" \
43162230430f8144afe9c32cd0e60b927f4e0a60gregames -e "s%\@os\@%$OS%" \
245cc5a2ec164cde44aa9849a78d8fa144d83e25gregames build/install-bindist.sh.in > install-bindist.sh
245cc5a2ec164cde44aa9849a78d8fa144d83e25gregames
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingchmod 755 install-bindist.sh
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
5a322de173626af6d7e4e3e6bb67082ae5e7981egregamessed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
888d5172c9670a1a6278556625f1f6199ec53a2dfielding -e "s%#ServerName.*%#ServerName localhost%" \
832923c3efd3343644ced4a6a65b16cd1edc05e5rbb bindist/conf/httpd-std.conf > bindist/conf/httpd.conf
5a322de173626af6d7e4e3e6bb67082ae5e7981egregamescp bindist/conf/httpd.conf bindist/conf/httpd-std.conf
5a322de173626af6d7e4e3e6bb67082ae5e7981egregames
8b30d716ef6380801f225010838faa3c00141a06trawickfor one_file in apachectl envvars envvars-std; do
8b30d716ef6380801f225010838faa3c00141a06trawick sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
8b30d716ef6380801f225010838faa3c00141a06trawick bindist/bin/$one_file > bindist/bin/$one_file.tmp
8b30d716ef6380801f225010838faa3c00141a06trawick mv bindist/bin/$one_file.tmp bindist/bin/$one_file
8b30d716ef6380801f225010838faa3c00141a06trawickdone
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingecho "Creating distribution archive and readme file..."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
86d87cb5057a62612a598348e737c4ab5a0a657cwsanchezif [ ".`grep -i error build.log > /dev/null`" != . ]; then
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "ERROR: Failed to build Apache. See \"build.log\" for details."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding exit 1;
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingelse
86d87cb5057a62612a598348e737c4ab5a0a657cwsanchez if [ "x$TAR" != "x" ]; then
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez case "x$OS" in
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez x*os390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez *) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez esac
86d87cb5057a62612a598348e737c4ab5a0a657cwsanchez if [ "x$GZIP" != "x" ]; then
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez $GZIP -9 ../httpd-$VER-$OS.tar
472b7522e5fdba2ed7890a6ca14ca3986ca4a63cwsanchez ARCHIVE=../httpd-$VER-$OS.tar.gz
1aba7f1bb88a52b323b7ba4d635a8bdb86f7998ewsanchez elif [ "x$COMPRESS" != "x" ]; then
1aba7f1bb88a52b323b7ba4d635a8bdb86f7998ewsanchez $COMPRESS ../httpd-$VER-$OS.tar
1aba7f1bb88a52b323b7ba4d635a8bdb86f7998ewsanchez ARCHIVE=../httpd-$VER-$OS.tar.Z
888d5172c9670a1a6278556625f1f6199ec53a2dfielding else
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez echo "WARNING: Could not find a 'gzip' program!"
1aba7f1bb88a52b323b7ba4d635a8bdb86f7998ewsanchez echo " tar archive is not compressed."
472b7522e5fdba2ed7890a6ca14ca3986ca4a63cwsanchez ARCHIVE=../httpd-$VER-$OS.tar
888d5172c9670a1a6278556625f1f6199ec53a2dfielding fi
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez else
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez echo "ERROR: Could not find a 'tar' program!"
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez echo " Please execute the following commands manually:"
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez echo " tar -cf ../httpd-$VER-$OS.tar ."
1ef186dcdfff29426aa8a691de246acf59b4b27cwsanchez echo " gzip -9 ../httpd-$VER-$OS.tar"
888d5172c9670a1a6278556625f1f6199ec53a2dfielding fi
888d5172c9670a1a6278556625f1f6199ec53a2dfielding
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez if [ "x$MD5" != "x" ]; then
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez $MD5 $ARCHIVE > $ARCHIVE.md5
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez fi
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez
472b7522e5fdba2ed7890a6ca14ca3986ca4a63cwsanchez if [ -f $ARCHIVE ] && [ -f ../httpd-$VER-$OS.README ]; then
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "Ready."
472b7522e5fdba2ed7890a6ca14ca3986ca4a63cwsanchez echo "You can find the binary archive ($ARCHIVE)"
94a719cfed2369f14a96e1835623198c2df96080rbb echo "and the readme file (httpd-$VER-$OS.README) in the"
888d5172c9670a1a6278556625f1f6199ec53a2dfielding echo "parent directory."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding exit 0;
888d5172c9670a1a6278556625f1f6199ec53a2dfielding else
7559b8d0f626adc4721ab6cdd37a8c9240ab297dwsanchez echo "ERROR: Archive or README is missing."
888d5172c9670a1a6278556625f1f6199ec53a2dfielding exit 1;
888d5172c9670a1a6278556625f1f6199ec53a2dfielding fi
888d5172c9670a1a6278556625f1f6199ec53a2dfieldingfi