3 # binbuild.sh - Builds an Apache binary distribution.
4 # Initially written by Lars Eilebrecht <lars@apache.org>.
6 # This script falls under the Apache License.
7 # See http://www.apache.org/docs/LICENSE
9 OS=`./srclib/apr/build/config.guess`
10 BUILD_DIR="`pwd`/bindist"
11 DEFAULT_DIR="/usr/local/apache2"
13 APDIR=`basename $APDIR`
15 CONFIGPARAM="--with-layout=BinaryDistribution --prefix=$BUILD_DIR --enable-mods-shared=most --with-expat=$APFULLDIR/srclib/apr-util/xml/expat --enable-static-support"
16 VER=`echo $APDIR |sed s/httpd-//`
17 TAR="`srclib/apr/build/PrintPath tar`"
18 GTAR="`srclib/apr/build/PrintPath gtar`"
19 GZIP="`srclib/apr/build/PrintPath gzip`"
24 USER="`build/buildinfo.sh -n %u@%h%d`"
27 if [ ! -f ./ABOUT_APACHE ]
29 echo "ERROR: The current directory contains no valid Apache distribution."
30 echo "Please change the directory to the top level directory of a freshly"
31 echo "unpacked Apache 2.0 source distribution and re-execute the script"
32 echo "'./build/binbuild.sh'."
38 echo "ERROR: The current directory is a CVS checkout of Apache."
39 echo "Only a standard Apache 2.0 source distribution should be used to"
40 echo "create a binary distribution."
44 echo "Building Apache $VER binary distribution..."
45 echo "Platform is \"$OS\"..."
47 ( echo "Build log for Apache binary distribution" && \
48 echo "----------------------------------------------------------------------" && \
49 ./configure $CONFIGPARAM && \
50 echo "----------------------------------------------------------------------" && \
52 rm -rf bindist install-bindist.sh *.bindist
53 echo "----------------------------------------------------------------------" && \
55 echo "----------------------------------------------------------------------" && \
56 make install root="bindist/" && \
57 echo "----------------------------------------------------------------------" && \
59 echo "----------------------------------------------------------------------" && \
61 ) 2>&1 | tee build.log
63 if [ ! -f ./bindist/bin/httpd ]
65 echo "ERROR: Failed to build Apache. See \"build.log\" for details."
69 echo "Binary image successfully created..."
71 ./bindist/bin/httpd -v
73 echo "Creating supplementary files..."
76 echo "Apache $VER binary distribution" && \
77 echo "================================" && \
79 echo "This binary distribution is usable on a \"$OS\"" && \
80 echo "system and was built by \"$USER\"." && \
82 echo "The distribution contains all standard Apache modules as shared" && \
83 echo "objects. This allows you to enable or disable particular modules" && \
84 echo "with the LoadModule/AddModule directives in the configuration file" && \
85 echo "without the need to re-compile Apache." && \
87 echo "See \"INSTALL.bindist\" on how to install the distribution." && \
89 echo "NOTE: Please do not send support-related mails to the address mentioned" && \
90 echo " above or to any member of the Apache Group! Support questions" && \
91 echo " should be directed to the \"comp.infosystems.www.servers.unix\"" && \
92 echo " or \"comp.infosystems.www.servers.ms-windows\" newsgroup" && \
93 echo " (as appropriate for the platform you use), where some of the" && \
94 echo " Apache team lurk, in the company of many other Apache gurus" && \
95 echo " who should be able to help." && \
96 echo " If you think you found a bug in Apache or have a suggestion please" && \
97 echo " visit the bug report page at http://www.apache.org/bug_report.html" && \
99 echo "----------------------------------------------------------------------" && \
100 ./bindist/bin/httpd -V && \
101 echo "----------------------------------------------------------------------" \
103 cp README.bindist ../httpd-$VER-$OS.README
106 echo "Apache $VER binary installation" && \
107 echo "================================" && \
109 echo "To install this binary distribution you have to execute the installation" && \
110 echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
112 echo "The script takes the ServerRoot directory into which you want to install" && \
113 echo "Apache as an option. If you omit the option the default path" && \
114 echo "\"$DEFAULT_DIR\" is used." && \
115 echo "Make sure you have write permissions in the target directory, e.g. switch" && \
116 echo "to user \"root\" before you execute the script." && \
118 echo "See \"README.bindist\" for further details about this distribution." && \
120 echo "Please note that this distribution includes the complete Apache source code." && \
121 echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
122 echo "installation on your system." && \
123 echo "See \"INSTALL\" for details on how to accomplish this." && \
127 sed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
128 -e "s%\@ver\@%$VER%" \
130 build/install-bindist.sh.in > install-bindist.sh
132 chmod 755 install-bindist.sh
134 sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
135 -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
136 -e "s%#ServerName.*%#ServerName localhost%" \
137 bindist/conf/httpd-std.conf > bindist/conf/httpd.conf
138 cp bindist/conf/httpd.conf bindist/conf/httpd-std.conf
140 for one_file in apachectl envvars envvars-std; do
141 sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
142 -e "s%^#binbuild %%" \
143 bindist/bin/$one_file > bindist/bin/$one_file.tmp
144 mv bindist/bin/$one_file.tmp bindist/bin/$one_file
147 echo "Creating distribution archive and readme file..."
149 if [ ".`grep -i error build.log > /dev/null`" != . ]
151 echo "ERROR: Failed to build Apache. See \"build.log\" for details."
154 if [ "x$GTAR" != "x" ]
156 $GTAR -zcf ../httpd-$VER-$OS.tar.gz -C .. httpd-$VER
158 if [ "x$TAR" != "x" ]
161 x*390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
162 *) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
164 if [ "x$GZIP" != "x" ]
166 $GZIP ../httpd-$VER-$OS.tar
169 echo "ERROR: Could not find a 'tar' program!"
170 echo " Please execute the following commands manually:"
171 echo " tar -cf ../httpd-$VER-$OS.tar ."
172 echo " gzip ../httpd-$VER-$OS.tar"
176 if [ -f ../httpd-$VER-$OS.tar.gz ] && [ -f ../httpd-$VER-$OS.README ]
179 echo "You can find the binary archive (httpd-$VER-$OS.tar.gz)"
180 echo "and the readme file (httpd-$VER-$OS.README) in the"
181 echo "parent directory."