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"
12 CONFIGPARAM="--with-layout=BinaryDistribution --prefix=$BUILD_DIR"
14 APDIR=`basename $APDIR`
15 VER=`echo $APDIR |sed s/httpd-//`
16 TAR="`srclib/apr/build/PrintPath tar`"
17 GTAR="`srclib/apr/build/PrintPath gtar`"
18 GZIP="`srclib/apr/build/PrintPath gzip`"
23 USER="`build/buildinfo.sh -n %u@%h%d`"
26 if [ ! -f ./ABOUT_APACHE ]
28 echo "ERROR: The current directory contains no valid Apache distribution."
29 echo "Please change the directory to the top level directory of a freshly"
30 echo "unpacked Apache 2.0 source distribution and re-execute the script"
31 echo "'./build/bindbuild.sh'."
37 echo "ERROR: The current directory is a CVS checkout of Apache."
38 echo "Only a standard Apache 2.0 source distribution should be used to"
39 echo "create a binary distribution."
43 echo "Building Apache $VER binary distribution..."
44 echo "Platform is \"$OS\"..."
46 ( echo "Build log for Apache binary distribution" && \
47 echo "----------------------------------------------------------------------" && \
48 ./configure $CONFIGPARAM && \
49 echo "----------------------------------------------------------------------" && \
51 rm -rf bindist install-bindist.sh *.bindist
52 echo "----------------------------------------------------------------------" && \
54 echo "----------------------------------------------------------------------" && \
55 make install root="bindist/" && \
56 echo "----------------------------------------------------------------------" && \
58 echo "----------------------------------------------------------------------" && \
60 ) 2>&1 | tee build.log
62 if [ ! -f ./bindist/bin/httpd ]
64 echo "ERROR: Failed to build Apache. See \"build.log\" for details."
68 echo "Binary image successfully created..."
70 ./bindist/bin/httpd -v
72 echo "Creating supplementary files..."
75 echo "Apache $VER binary distribution" && \
76 echo "================================" && \
78 echo "This binary distribution is usable on a \"$OS\"" && \
79 echo "system and was built by \"$USER\"." && \
81 echo "The distribution contains all standard Apache modules as shared" && \
82 echo "objects. This allows you to enable or disable particular modules" && \
83 echo "with the LoadModule/AddModule directives in the configuration file" && \
84 echo "without the need to re-compile Apache." && \
86 echo "See \"INSTALL.bindist\" on how to install the distribution." && \
88 echo "NOTE: Please do not send support-related mails to the address mentioned" && \
89 echo " above or to any member of the Apache Group! Support questions" && \
90 echo " should be directed to the \"comp.infosystems.www.servers.unix\"" && \
91 echo " or \"comp.infosystems.www.servers.ms-windows\" newsgroup" && \
92 echo " (as appropriate for the platform you use), where some of the" && \
93 echo " Apache team lurk, in the company of many other Apache gurus" && \
94 echo " who should be able to help." && \
95 echo " If you think you found a bug in Apache or have a suggestion please" && \
96 echo " visit the bug report page at http://www.apache.org/bug_report.html" && \
98 echo "----------------------------------------------------------------------" && \
99 ./bindist/bin/httpd -V && \
100 echo "----------------------------------------------------------------------" \
102 cp README.bindist ../httpd-$VER-$OS.README
105 echo "Apache $VER binary installation" && \
106 echo "================================" && \
108 echo "To install this binary distribution you have to execute the installation" && \
109 echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
111 echo "The script takes the ServerRoot directory into which you want to install" && \
112 echo "Apache as an option. If you omit the option the default path" && \
113 echo "\"$DEFAULT_DIR\" is used." && \
114 echo "Make sure you have write permissions in the target directory, e.g. switch" && \
115 echo "to user \"root\" before you execute the script." && \
117 echo "See \"README.bindist\" for further details about this distribution." && \
119 echo "Please note that this distribution includes the complete Apache source code." && \
120 echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
121 echo "installation on your system." && \
122 echo "See \"INSTALL\" for details on how to accomplish this." && \
126 sed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
127 -e "s%\@ver\@%$VER%" \
129 build/install-bindist.sh.in > install-bindist.sh
131 chmod 755 install-bindist.sh
133 sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
134 -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
135 -e "s%#ServerName.*%#ServerName localhost%" \
136 bindist/conf/httpd-std.conf > bindist/conf/httpd.conf
137 cp bindist/conf/httpd.conf bindist/conf/httpd-std.conf
139 sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
140 bindist/bin/apachectl > bindist/bin/apachectl.tmp
141 mv bindist/bin/apachectl.tmp bindist/bin/apachectl
143 echo "Creating distribution archive and readme file..."
145 if [ ".`grep -i error build.log > /dev/null`" != . ]
147 echo "ERROR: Failed to build Apache. See \"build.log\" for details."
150 if [ "x$GTAR" != "x" ]
152 $GTAR -zcf ../httpd-$VER-$OS.tar.gz -C .. httpd-$VER
154 if [ "x$TAR" != "x" ]
157 x*390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
158 *) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
160 if [ "x$GZIP" != "x" ]
162 $GZIP ../httpd-$VER-$OS.tar
165 echo "ERROR: Could not find a 'tar' program!"
166 echo " Please execute the following commands manually:"
167 echo " tar -cf ../httpd-$VER-$OS.tar ."
168 echo " gzip ../httpd-$VER-$OS.tar"
172 if [ -f ../httpd-$VER-$OS.tar.gz ] && [ -f ../httpd-$VER-$OS.README ]
175 echo "You can find the binary archive (httpd-$VER-$OS.tar.gz)"
176 echo "and the readme file (httpd-$VER-$OS.README) in the"
177 echo "parent directory."