]> granicus.if.org Git - apache/blob - build/binbuild.sh
install our manual in the new location
[apache] / build / binbuild.sh
1 #!/bin/sh
2 #
3 # binbuild.sh - Builds an Apache binary distribution.
4 # Initially written by Lars Eilebrecht <lars@apache.org>.
5 #
6 # This script falls under the Apache License.
7 # See http://www.apache.org/docs/LICENSE
8
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"
13 APDIR=`pwd`
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`"
19
20 if [ x$1 != x ]; then
21   USER=$1
22 else
23   USER="`build/buildinfo.sh -n %u@%h%d`"
24 fi
25
26 if [ ! -f ./ABOUT_APACHE ]
27 then
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'." 
32   exit 1;
33 fi
34
35 if [ -d ./CVS ]
36 then
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."
40   exit 1;
41 fi
42
43 echo "Building Apache $VER binary distribution..."
44 echo "Platform is \"$OS\"..."
45
46 ( echo "Build log for Apache binary distribution" && \
47   echo "----------------------------------------------------------------------" && \
48   ./configure $CONFIGPARAM && \
49   echo "----------------------------------------------------------------------" && \
50   make clean && \
51   rm -rf bindist install-bindist.sh *.bindist
52   echo "----------------------------------------------------------------------" && \
53   make && \
54   echo "----------------------------------------------------------------------" && \
55   make install root="bindist/" && \
56   echo "----------------------------------------------------------------------" && \
57   make clean && \
58   echo "----------------------------------------------------------------------" && \
59   echo "[EOF]" \
60 ) 2>&1 | tee build.log
61
62 if [ ! -f ./bindist/bin/httpd ]
63 then
64   echo "ERROR: Failed to build Apache. See \"build.log\" for details."
65   exit 1;
66 fi
67
68 echo "Binary image successfully created..."
69
70 ./bindist/bin/httpd -v
71
72 echo "Creating supplementary files..."
73
74 ( echo " " && \
75   echo "Apache $VER binary distribution" && \
76   echo "================================" && \
77   echo " " && \
78   echo "This binary distribution is usable on a \"$OS\"" && \
79   echo "system and was built by \"$USER\"." && \
80   echo "" && \
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." && \
85   echo "" && \
86   echo "See \"INSTALL.bindist\" on how to install the distribution." && \
87   echo " " && \
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" && \
97   echo " " && \
98   echo "----------------------------------------------------------------------" && \
99   ./bindist/bin/httpd -V && \
100   echo "----------------------------------------------------------------------" \
101 ) > README.bindist
102 cp README.bindist ../httpd-$VER-$OS.README
103
104 ( echo " " && \
105   echo "Apache $VER binary installation" && \
106   echo "================================" && \
107   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." && \
110   echo " " && \
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." && \
116   echo " " && \
117   echo "See \"README.bindist\" for further details about this distribution." && \
118   echo " " && \
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." && \
123   echo " " \
124 ) > INSTALL.bindist
125
126 sed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
127     -e "s%\@ver\@%$VER%" \
128     -e "s%\@os\@%$OS%" \
129     build/install-bindist.sh.in > install-bindist.sh
130     
131 chmod 755 install-bindist.sh
132
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
138
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
142
143 echo "Creating distribution archive and readme file..."
144  
145 if [ ".`grep -i error build.log > /dev/null`" != . ]
146 then
147   echo "ERROR: Failed to build Apache. See \"build.log\" for details."
148   exit 1;
149 else
150   if [ "x$GTAR" != "x" ]
151   then
152     $GTAR -zcf ../httpd-$VER-$OS.tar.gz -C .. httpd-$VER
153   else
154     if [ "x$TAR" != "x" ]
155     then
156       case "x$OS" in
157         x*390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
158             *) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
159       esac
160       if [ "x$GZIP" != "x" ]
161       then
162         $GZIP ../httpd-$VER-$OS.tar
163       fi
164     else
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"
169     fi
170   fi
171
172   if [ -f ../httpd-$VER-$OS.tar.gz ] && [ -f ../httpd-$VER-$OS.README ]
173   then
174     echo "Ready."
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."
178     exit 0;
179   else
180     exit 1;
181   fi
182 fi