|
Packit |
90a5c9 |
#!/bin/sh
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
90a5c9 |
# contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
90a5c9 |
# this work for additional information regarding copyright ownership.
|
|
Packit |
90a5c9 |
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
90a5c9 |
# (the "License"); you may not use this file except in compliance with
|
|
Packit |
90a5c9 |
# the License. You may obtain a copy of the License at
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# Unless required by applicable law or agreed to in writing, software
|
|
Packit |
90a5c9 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
90a5c9 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
90a5c9 |
# See the License for the specific language governing permissions and
|
|
Packit |
90a5c9 |
# limitations under the License.
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
#
|
|
Packit |
90a5c9 |
# binbuild.sh - Builds an Apache binary distribution.
|
|
Packit |
90a5c9 |
# Initially written by Lars Eilebrecht <lars apache.org>.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
OS=`./build/config.guess`
|
|
Packit |
90a5c9 |
PRINTPATH="build/PrintPath"
|
|
Packit |
90a5c9 |
APFULLDIR=`pwd`
|
|
Packit |
90a5c9 |
BUILD_DIR="$APFULLDIR/bindist"
|
|
Packit |
90a5c9 |
DEFAULT_DIR="/usr/local/apache2"
|
|
Packit |
90a5c9 |
APDIR="$APFULLDIR"
|
|
Packit |
90a5c9 |
APDIR=`basename $APDIR`
|
|
Packit |
90a5c9 |
CONFIGPARAM="--enable-layout=Apache --prefix=$BUILD_DIR --enable-mods-shared=most --with-expat=$APFULLDIR/srclib/apr-util/xml/expat --enable-static-support"
|
|
Packit |
90a5c9 |
VER=`echo $APDIR | sed s/httpd-//`
|
|
Packit |
90a5c9 |
TAR="`$PRINTPATH tar`"
|
|
Packit |
90a5c9 |
GZIP="`$PRINTPATH gzip`"
|
|
Packit |
90a5c9 |
COMPRESS="`$PRINTPATH compress`"
|
|
Packit |
90a5c9 |
MD5="`$PRINTPATH md5`"
|
|
Packit |
90a5c9 |
if [ x$MD5 = x ]; then
|
|
Packit |
90a5c9 |
OPENSSL="`$PRINTPATH openssl`"
|
|
Packit |
90a5c9 |
if [ x$OPENSSL != x ]; then
|
|
Packit |
90a5c9 |
MD5="$OPENSSL md5"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ x$1 != x ]; then
|
|
Packit |
90a5c9 |
USER=$1
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
USER="`build/buildinfo.sh -n %u@%h%d`"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ ! -f ./ABOUT_APACHE ]; then
|
|
Packit |
90a5c9 |
echo "ERROR: The current directory contains no valid Apache distribution."
|
|
Packit |
90a5c9 |
echo "Please change the directory to the top level directory of a freshly"
|
|
Packit |
90a5c9 |
echo "unpacked Apache 2.0 source distribution and re-execute the script"
|
|
Packit |
90a5c9 |
echo "'./build/binbuild.sh'."
|
|
Packit |
90a5c9 |
exit 1;
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ -d ./CVS ]; then
|
|
Packit |
90a5c9 |
echo "ERROR: The current directory is a CVS checkout of Apache."
|
|
Packit |
90a5c9 |
echo "Only a standard Apache 2.0 source distribution should be used to"
|
|
Packit |
90a5c9 |
echo "create a binary distribution."
|
|
Packit |
90a5c9 |
exit 1;
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
echo "Building Apache $VER binary distribution..."
|
|
Packit |
90a5c9 |
echo "Platform is \"$OS\"..."
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
( echo "Build log for Apache binary distribution" && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
./configure $CONFIGPARAM && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
make clean && \
|
|
Packit |
90a5c9 |
rm -rf bindist install-bindist.sh *.bindist
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
make && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
make install root="bindist/" && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
make clean && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
echo "[EOF]" \
|
|
Packit |
90a5c9 |
) 2>&1 | tee build.log
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ ! -f ./bindist/bin/httpd ]; then
|
|
Packit |
90a5c9 |
echo "ERROR: Failed to build Apache. See \"build.log\" for details."
|
|
Packit |
90a5c9 |
exit 1;
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
echo "Binary image successfully created..."
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
./bindist/bin/httpd -v
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
echo "Creating supplementary files..."
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
( echo " " && \
|
|
Packit |
90a5c9 |
echo "Apache $VER binary distribution" && \
|
|
Packit |
90a5c9 |
echo "================================" && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "This binary distribution is usable on a \"$OS\"" && \
|
|
Packit |
90a5c9 |
echo "system and was built by \"$USER\"." && \
|
|
Packit |
90a5c9 |
echo "" && \
|
|
Packit |
90a5c9 |
echo "The distribution contains all standard Apache modules as shared" && \
|
|
Packit |
90a5c9 |
echo "objects. This allows you to enable or disable particular modules" && \
|
|
Packit |
90a5c9 |
echo "with the LoadModule/AddModule directives in the configuration file" && \
|
|
Packit |
90a5c9 |
echo "without the need to re-compile Apache." && \
|
|
Packit |
90a5c9 |
echo "" && \
|
|
Packit |
90a5c9 |
echo "See \"INSTALL.bindist\" on how to install the distribution." && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "NOTE: Please do not send support-related mails to the address mentioned" && \
|
|
Packit |
90a5c9 |
echo " above or to any member of the Apache Group! Support questions" && \
|
|
Packit |
90a5c9 |
echo " should be directed to the forums mentioned at" && \
|
|
Packit |
90a5c9 |
echo " http://httpd.apache.org/lists.html#http-users" && \
|
|
Packit |
90a5c9 |
echo " where some of the Apache team lurk, in the company of many other" && \
|
|
Packit |
90a5c9 |
echo " Apache gurus who should be able to help." && \
|
|
Packit |
90a5c9 |
echo " If you think you found a bug in Apache or have a suggestion please" && \
|
|
Packit |
90a5c9 |
echo " visit the bug report page at http://httpd.apache.org/bug_report.html" && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" && \
|
|
Packit |
90a5c9 |
./bindist/bin/httpd -V && \
|
|
Packit |
90a5c9 |
echo "----------------------------------------------------------------------" \
|
|
Packit |
90a5c9 |
) > README.bindist
|
|
Packit |
90a5c9 |
cp README.bindist ../httpd-$VER-$OS.README
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
( echo " " && \
|
|
Packit |
90a5c9 |
echo "Apache $VER binary installation" && \
|
|
Packit |
90a5c9 |
echo "================================" && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "To install this binary distribution you have to execute the installation" && \
|
|
Packit |
90a5c9 |
echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "The script takes the ServerRoot directory into which you want to install" && \
|
|
Packit |
90a5c9 |
echo "Apache as an option. If you omit the option the default path" && \
|
|
Packit |
90a5c9 |
echo "\"$DEFAULT_DIR\" is used." && \
|
|
Packit |
90a5c9 |
echo "Make sure you have write permissions in the target directory, e.g. switch" && \
|
|
Packit |
90a5c9 |
echo "to user \"root\" before you execute the script." && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "See \"README.bindist\" for further details about this distribution." && \
|
|
Packit |
90a5c9 |
echo " " && \
|
|
Packit |
90a5c9 |
echo "Please note that this distribution includes the complete Apache source code." && \
|
|
Packit |
90a5c9 |
echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
|
|
Packit |
90a5c9 |
echo "installation on your system." && \
|
|
Packit |
90a5c9 |
echo "See \"INSTALL\" for details on how to accomplish this." && \
|
|
Packit |
90a5c9 |
echo " " \
|
|
Packit |
90a5c9 |
) > INSTALL.bindist
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
sed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
|
|
Packit |
90a5c9 |
-e "s%\@ver\@%$VER%" \
|
|
Packit |
90a5c9 |
-e "s%\@os\@%$OS%" \
|
|
Packit |
90a5c9 |
build/install-bindist.sh.in > install-bindist.sh
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
chmod 755 install-bindist.sh
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
|
|
Packit |
90a5c9 |
-e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
|
|
Packit |
90a5c9 |
-e "s%#ServerName.*%#ServerName localhost%" \
|
|
Packit |
90a5c9 |
bindist/conf/httpd-std.conf > bindist/conf/httpd.conf
|
|
Packit |
90a5c9 |
cp bindist/conf/httpd.conf bindist/conf/httpd-std.conf
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
for one_file in apachectl envvars envvars-std; do
|
|
Packit |
90a5c9 |
sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
|
|
Packit |
90a5c9 |
bindist/bin/$one_file > bindist/bin/$one_file.tmp
|
|
Packit |
90a5c9 |
mv bindist/bin/$one_file.tmp bindist/bin/$one_file
|
|
Packit |
90a5c9 |
done
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
echo "Creating distribution archive and readme file..."
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ ".`grep -i error build.log > /dev/null`" != . ]; then
|
|
Packit |
90a5c9 |
echo "ERROR: Failed to build Apache. See \"build.log\" for details."
|
|
Packit |
90a5c9 |
exit 1;
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
if [ "x$TAR" != "x" ]; then
|
|
Packit |
90a5c9 |
case "x$OS" in
|
|
Packit |
90a5c9 |
x*os390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
|
|
Packit |
90a5c9 |
*) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
|
|
Packit |
90a5c9 |
esac
|
|
Packit |
90a5c9 |
if [ "x$GZIP" != "x" ]; then
|
|
Packit |
90a5c9 |
$GZIP -9 ../httpd-$VER-$OS.tar
|
|
Packit |
90a5c9 |
ARCHIVE=../httpd-$VER-$OS.tar.gz
|
|
Packit |
90a5c9 |
elif [ "x$COMPRESS" != "x" ]; then
|
|
Packit |
90a5c9 |
$COMPRESS ../httpd-$VER-$OS.tar
|
|
Packit |
90a5c9 |
ARCHIVE=../httpd-$VER-$OS.tar.Z
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
echo "WARNING: Could not find a 'gzip' program!"
|
|
Packit |
90a5c9 |
echo " tar archive is not compressed."
|
|
Packit |
90a5c9 |
ARCHIVE=../httpd-$VER-$OS.tar
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
echo "ERROR: Could not find a 'tar' program!"
|
|
Packit |
90a5c9 |
echo " Please execute the following commands manually:"
|
|
Packit |
90a5c9 |
echo " tar -cf ../httpd-$VER-$OS.tar ."
|
|
Packit |
90a5c9 |
echo " gzip -9 ../httpd-$VER-$OS.tar"
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ "x$MD5" != "x" ]; then
|
|
Packit |
90a5c9 |
$MD5 $ARCHIVE > $ARCHIVE.md5
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
if [ -f $ARCHIVE ] && [ -f ../httpd-$VER-$OS.README ]; then
|
|
Packit |
90a5c9 |
echo "Ready."
|
|
Packit |
90a5c9 |
echo "You can find the binary archive ($ARCHIVE)"
|
|
Packit |
90a5c9 |
echo "and the readme file (httpd-$VER-$OS.README) in the"
|
|
Packit |
90a5c9 |
echo "parent directory."
|
|
Packit |
90a5c9 |
exit 0;
|
|
Packit |
90a5c9 |
else
|
|
Packit |
90a5c9 |
echo "ERROR: Archive or README is missing."
|
|
Packit |
90a5c9 |
exit 1;
|
|
Packit |
90a5c9 |
fi
|
|
Packit |
90a5c9 |
fi
|