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
11 APDIR=`basename $APDIR`
12 VER=`echo $APDIR |sed s/apache-//`
13 OS=`src/helpers/GuessOS`
14 USER="`src/helpers/buildinfo.sh -n %u@%h%d`"
15 TAR="`src/helpers/PrintPath tar`"
16 GTAR="`src/helpers/PrintPath gtar`"
17 GZIP="`src/helpers/PrintPath gzip`"
18 CONFIGPARAM="--with-layout=BinaryDistribution --enable-module=most --enable-shared=max"
20 if [ ! -f ./ABOUT_APACHE ]
22 echo "ERROR: The current directory contains no valid Apache distribution."
23 echo "Please change the directory to the top level directory of a freshly"
24 echo "unpacked Apache 1.3 source distribution and re-execute the script"
25 echo "'./src/helpers/bindbuild.sh'."
31 echo "ERROR: The current directory is a CVS checkout of Apache."
32 echo "Only a standard Apache 1.3 source distribution should be used to"
33 echo "create a binary distribution."
37 echo "Building Apache $VER binary distribution..."
38 echo "Platform is \"$OS\"..."
40 ( echo "Build log for Apache binary distribution" && \
41 echo "----------------------------------------------------------------------" && \
42 ./configure $CONFIGPARAM && \
43 echo "----------------------------------------------------------------------" && \
45 rm -rf bindist install-bindist.sh *.bindist
46 echo "----------------------------------------------------------------------" && \
48 echo "----------------------------------------------------------------------" && \
49 make install-quiet root="bindist/" && \
50 echo "----------------------------------------------------------------------" && \
52 echo "----------------------------------------------------------------------" && \
56 if [ ! -f ./bindist/bin/httpd ]
58 echo "ERROR: Failed to build Apache. See \"build.log\" for details."
62 echo "Binary images successfully created..."
63 echo "Creating supplementary files..."
66 echo "Apache $VER binary distribution" && \
67 echo "================================" && \
69 echo "This binary distribution is usable on a \"$OS\"" && \
70 echo "system and was built by \"$USER\"." && \
72 echo "The distribution contains all standard Apache modules as shared" && \
73 echo "objects. This allows you to enable or disable particular modules" && \
74 echo "with the LoadModule/AddModule directives in the configuration file" && \
75 echo "without the need to re-compile Apache." && \
77 echo "See \"INSTALL.bindist\" on how to install the distribution." && \
79 echo "NOTE: Please do not send support-related mails to the address mentioned" && \
80 echo " above or to any member of the Apache Group! Support questions" && \
81 echo " should be directed to the \"comp.infosystems.www.servers.unix\"" && \
82 echo " or \"comp.infosystems.www.servers.ms-windows\" newsgroup" && \
83 echo " (as appropriate for the platform you use), where some of the" && \
84 echo " Apache team lurk, in the company of many other Apache gurus" && \
85 echo " who should be able to help." && \
86 echo " If you think you found a bug in Apache or have a suggestion please" && \
87 echo " visit the bug report page at http://www.apache.org/bug_report.html" && \
89 echo "----------------------------------------------------------------------" && \
90 ./bindist/bin/httpd -V && \
91 echo "----------------------------------------------------------------------" \
93 cp README.bindist ../apache-$VER-$OS.README
96 echo "Apache $VER binary installation" && \
97 echo "================================" && \
99 echo "To install this binary distribution you have to execute the installation" && \
100 echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
102 echo "The script takes the ServerRoot directory into which you want to install" && \
103 echo "Apache as an option. If you ommit the option the default path" && \
104 echo "\"/usr/local/apache\" is used." && \
105 echo "Make sure you have write permissions in the target directory, e.g. switch" && \
106 echo "to user \"root\" before you execute the script." && \
108 echo "See \"README.bindist\" for further details about this distribution." && \
110 echo "Please note that this distribution includes the complete Apache source code." && \
111 echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
112 echo "installation on your system." && \
113 echo "See \"INSTALL\" for details on how to accomplish this." && \
117 ( echo "#!/bin/sh" && \
119 echo "# Usage: install-bindist.sh [ServerRoot]" && \
120 echo "# This script installs the Apache binary distribution and" && \
121 echo "# was automatically created by binbuild.sh." && \
123 echo "if [ .\$1 = . ]" && \
125 echo " SR=/usr/local/apache" && \
129 echo "echo \"Installing binary distribution for platform $OS\"" && \
130 echo "echo \"into directory \$SR ...\"" && \
131 echo "./src/helpers/mkdir.sh \$SR" && \
132 echo "cp -r bindist/proxy \$SR/proxy" && \
133 echo "cp -r bindist/man \$SR/man" && \
134 echo "cp -r bindist/logs \$SR/logs" && \
135 echo "cp -r bindist/libexec \$SR/libexec" && \
136 echo "cp -r bindist/include \$SR/include" && \
137 echo "cp -r bindist/icons \$SR/icons" && \
138 echo "cp -r bindist/cgi-bin \$SR/cgi-bin" && \
139 echo "cp -r bindist/bin \$SR/bin" && \
140 echo "if [ -d \$SR/conf ]" && \
142 echo " echo \"[Preserving existing configuration files.]\"" && \
143 echo " cp -r bindist/conf/*.default \$SR/conf/" && \
145 echo " cp -r bindist/conf \$SR/conf" && \
147 echo "if [ -d \$SR/htdocs ]" && \
149 echo " echo \"[Preserving existing htdocs directory.]\"" && \
151 echo " cp -r bindist/htdocs \$SR/htdocs" && \
153 echo "sed -e s%/usr/local/apache%\$SR/% \$SR/conf/httpd.conf.default > \$SR/conf/httpd.conf" && \
154 echo "sed -e s%PIDFILE=%PIDFILE=\$SR/% -e s%HTTPD=%HTTPD=\\\"\$SR/% -e \"s%/httpd$%/httpd -d \$SR\\\"%\" bindist/bin/apachectl > \$SR/bin/apachectl" && \
156 echo "echo \"Ready.\"" && \
157 echo "echo \" +--------------------------------------------------------+\"" && \
158 echo "echo \" | You now have successfully installed the Apache $VER |\"" && \
159 echo "echo \" | HTTP server. To verify that Apache actually works |\"" && \
160 echo "echo \" | correctly you now should first check the (initially |\"" && \
161 echo "echo \" | created or preserved) configuration files |\"" && \
162 echo "echo \" | |\"" && \
163 echo "echo \" | \$SR/conf/httpd.conf\"" && \
164 echo "echo \" | |\"" && \
165 echo "echo \" | and then you should be able to immediately fire up |\"" && \
166 echo "echo \" | Apache the first time by running: |\"" && \
167 echo "echo \" | |\"" && \
168 echo "echo \" | \$SR/bin/apachectl start \"" &&\
169 echo "echo \" | |\"" && \
170 echo "echo \" | Thanks for using Apache. The Apache Group |\"" && \
171 echo "echo \" | http://www.apache.org/ |\"" && \
172 echo "echo \" +--------------------------------------------------------+\"" && \
174 ) > install-bindist.sh
175 chmod 755 install-bindist.sh
177 sed -e "s%\"/htdocs%\"/usr/local/apache/htdocs%" \
178 -e "s%\"/icons%\"/usr/local/apache/icons%" \
179 -e "s%\"/cgi-bin%\"/usr/local/apache/cgi-bin%" \
180 -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
181 -e "s%#ServerName.*%#ServerName localhost%" \
182 -e "s%Port 8080%Port 80%" \
183 bindist/conf/httpd.conf.default > bindist/conf/httpd.conf
184 cp bindist/conf/httpd.conf bindist/conf/httpd.conf.default
186 echo "Creating distribution archive and readme file..."
188 if [ ".`grep -i error build.log > /dev/null`" != . ]
190 echo "ERROR: Failed to build Apache. See \"build.log\" for details."
195 $GTAR -zcf ../apache-$VER-$OS.tar.gz -C .. --owner=root --group=root apache-$VER
199 $TAR -cf ../apache-$VER-$OS.tar -C .. apache-$VER
202 $GZIP ../apache-$VER-$OS.tar
205 echo "ERROR: Could not find a 'tar' program!"
206 echo " Please execute the following commands manually:"
207 echo " tar -cf ../apache-$VER-$OS.tar ."
208 echo " gzip ../apache-$VER-$OS.tar"
212 if [ -f ../apache-$VER-$OS.tar.gz ] && [ -f ../apache-$VER-$OS.README ]
215 echo "You can find the binary archive (apache-$VER-$OS.tar.gz)"
216 echo "and the readme file (apache-$VER-$OS.README) in the"
217 echo "parent directory."