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