3
# Licensed to the Apache Software Foundation (ASF) under one or more
4
# contributor license agreements. See the NOTICE file distributed with
5
# this work for additional information regarding copyright ownership.
6
# The ASF licenses this file to You under the Apache License, Version 2.0
7
# (the "License"); you may not use this file except in compliance with
8
# the License. You may obtain a copy of the License at
10
# http://www.apache.org/licenses/LICENSE-2.0
12
# Unless required by applicable law or agreed to in writing, software
13
# distributed under the License is distributed on an "AS IS" BASIS,
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
19
# binbuild.sh - Builds an Apache binary distribution.
20
# Initially written by Lars Eilebrecht <lars apache.org>.
22
OS=`./build/config.guess`
23
PRINTPATH="build/PrintPath"
25
BUILD_DIR="$APFULLDIR/bindist"
26
DEFAULT_DIR="/usr/local/apache2"
28
APDIR=`basename $APDIR`
29
CONFIGPARAM="--enable-layout=Apache --prefix=$BUILD_DIR --enable-mods-shared=most --with-expat=$APFULLDIR/srclib/apr-util/xml/expat --enable-static-support"
30
VER=`echo $APDIR | sed s/httpd-//`
31
TAR="`$PRINTPATH tar`"
32
GZIP="`$PRINTPATH gzip`"
33
COMPRESS="`$PRINTPATH compress`"
34
MD5="`$PRINTPATH md5`"
35
if [ x$MD5 = x ]; then
36
OPENSSL="`$PRINTPATH openssl`"
37
if [ x$OPENSSL != x ]; then
45
USER="`build/buildinfo.sh -n %u@%h%d`"
48
if [ ! -f ./ABOUT_APACHE ]; then
49
echo "ERROR: The current directory contains no valid Apache distribution."
50
echo "Please change the directory to the top level directory of a freshly"
51
echo "unpacked Apache 2.0 source distribution and re-execute the script"
52
echo "'./build/binbuild.sh'."
57
echo "ERROR: The current directory is a CVS checkout of Apache."
58
echo "Only a standard Apache 2.0 source distribution should be used to"
59
echo "create a binary distribution."
63
echo "Building Apache $VER binary distribution..."
64
echo "Platform is \"$OS\"..."
66
( echo "Build log for Apache binary distribution" && \
67
echo "----------------------------------------------------------------------" && \
68
./configure $CONFIGPARAM && \
69
echo "----------------------------------------------------------------------" && \
71
rm -rf bindist install-bindist.sh *.bindist
72
echo "----------------------------------------------------------------------" && \
74
echo "----------------------------------------------------------------------" && \
75
make install root="bindist/" && \
76
echo "----------------------------------------------------------------------" && \
78
echo "----------------------------------------------------------------------" && \
80
) 2>&1 | tee build.log
82
if [ ! -f ./bindist/bin/httpd ]; then
83
echo "ERROR: Failed to build Apache. See \"build.log\" for details."
87
echo "Binary image successfully created..."
89
./bindist/bin/httpd -v
91
echo "Creating supplementary files..."
94
echo "Apache $VER binary distribution" && \
95
echo "================================" && \
97
echo "This binary distribution is usable on a \"$OS\"" && \
98
echo "system and was built by \"$USER\"." && \
100
echo "The distribution contains all standard Apache modules as shared" && \
101
echo "objects. This allows you to enable or disable particular modules" && \
102
echo "with the LoadModule/AddModule directives in the configuration file" && \
103
echo "without the need to re-compile Apache." && \
105
echo "See \"INSTALL.bindist\" on how to install the distribution." && \
107
echo "NOTE: Please do not send support-related mails to the address mentioned" && \
108
echo " above or to any member of the Apache Group! Support questions" && \
109
echo " should be directed to the forums mentioned at" && \
110
echo " http://httpd.apache.org/lists.html#http-users" && \
111
echo " where some of the Apache team lurk, in the company of many other" && \
112
echo " Apache gurus who should be able to help." && \
113
echo " If you think you found a bug in Apache or have a suggestion please" && \
114
echo " visit the bug report page at http://httpd.apache.org/bug_report.html" && \
116
echo "----------------------------------------------------------------------" && \
117
./bindist/bin/httpd -V && \
118
echo "----------------------------------------------------------------------" \
120
cp README.bindist ../httpd-$VER-$OS.README
123
echo "Apache $VER binary installation" && \
124
echo "================================" && \
126
echo "To install this binary distribution you have to execute the installation" && \
127
echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
129
echo "The script takes the ServerRoot directory into which you want to install" && \
130
echo "Apache as an option. If you omit the option the default path" && \
131
echo "\"$DEFAULT_DIR\" is used." && \
132
echo "Make sure you have write permissions in the target directory, e.g. switch" && \
133
echo "to user \"root\" before you execute the script." && \
135
echo "See \"README.bindist\" for further details about this distribution." && \
137
echo "Please note that this distribution includes the complete Apache source code." && \
138
echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
139
echo "installation on your system." && \
140
echo "See \"INSTALL\" for details on how to accomplish this." && \
144
sed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
145
-e "s%\@ver\@%$VER%" \
147
build/install-bindist.sh.in > install-bindist.sh
149
chmod 755 install-bindist.sh
151
sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
152
-e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
153
-e "s%#ServerName.*%#ServerName localhost%" \
154
bindist/conf/httpd-std.conf > bindist/conf/httpd.conf
155
cp bindist/conf/httpd.conf bindist/conf/httpd-std.conf
157
for one_file in apachectl envvars envvars-std; do
158
sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
159
bindist/bin/$one_file > bindist/bin/$one_file.tmp
160
mv bindist/bin/$one_file.tmp bindist/bin/$one_file
163
echo "Creating distribution archive and readme file..."
165
if [ ".`grep -i error build.log > /dev/null`" != . ]; then
166
echo "ERROR: Failed to build Apache. See \"build.log\" for details."
169
if [ "x$TAR" != "x" ]; then
171
x*os390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
172
*) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
174
if [ "x$GZIP" != "x" ]; then
175
$GZIP -9 ../httpd-$VER-$OS.tar
176
ARCHIVE=../httpd-$VER-$OS.tar.gz
177
elif [ "x$COMPRESS" != "x" ]; then
178
$COMPRESS ../httpd-$VER-$OS.tar
179
ARCHIVE=../httpd-$VER-$OS.tar.Z
181
echo "WARNING: Could not find a 'gzip' program!"
182
echo " tar archive is not compressed."
183
ARCHIVE=../httpd-$VER-$OS.tar
186
echo "ERROR: Could not find a 'tar' program!"
187
echo " Please execute the following commands manually:"
188
echo " tar -cf ../httpd-$VER-$OS.tar ."
189
echo " gzip -9 ../httpd-$VER-$OS.tar"
192
if [ "x$MD5" != "x" ]; then
193
$MD5 $ARCHIVE > $ARCHIVE.md5
196
if [ -f $ARCHIVE ] && [ -f ../httpd-$VER-$OS.README ]; then
198
echo "You can find the binary archive ($ARCHIVE)"
199
echo "and the readme file (httpd-$VER-$OS.README) in the"
200
echo "parent directory."
203
echo "ERROR: Archive or README is missing."