~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to build/binbuild.sh

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#       
 
3
# Licensed to the Apache Software Foundation (ASF) under one or more
 
4
# contributor license agreements.  See the NOTICE file distributed with
 
5
# this work for additional information regarding copyright ownership.
 
6
# The ASF licenses this file to You under the Apache License, Version 2.0
 
7
# (the "License"); you may not use this file except in compliance with
 
8
# the License.  You may obtain a copy of the License at
 
9
#
 
10
#     http://www.apache.org/licenses/LICENSE-2.0
 
11
#
 
12
# Unless required by applicable law or agreed to in writing, software
 
13
# distributed under the License is distributed on an "AS IS" BASIS,
 
14
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
15
# See the License for the specific language governing permissions and
 
16
# limitations under the License.
 
17
#
 
18
#
 
19
# binbuild.sh - Builds an Apache binary distribution.
 
20
# Initially written by Lars Eilebrecht <lars apache.org>.
 
21
 
 
22
OS=`./build/config.guess`
 
23
PRINTPATH="build/PrintPath"
 
24
APFULLDIR=`pwd`
 
25
BUILD_DIR="$APFULLDIR/bindist"
 
26
DEFAULT_DIR="/usr/local/apache2"
 
27
APDIR="$APFULLDIR"
 
28
APDIR=`basename $APDIR`
 
29
CONFIGPARAM="--enable-layout=Apache --prefix=$BUILD_DIR --enable-mods-shared=most --with-expat=$APFULLDIR/srclib/apr-util/xml/expat --enable-static-support"
 
30
VER=`echo $APDIR | sed s/httpd-//`
 
31
TAR="`$PRINTPATH tar`"
 
32
GZIP="`$PRINTPATH gzip`"
 
33
COMPRESS="`$PRINTPATH compress`"
 
34
MD5="`$PRINTPATH md5`"
 
35
if [ x$MD5 = x ]; then
 
36
  OPENSSL="`$PRINTPATH openssl`"
 
37
  if [ x$OPENSSL != x ]; then
 
38
    MD5="$OPENSSL md5"
 
39
  fi
 
40
fi
 
41
 
 
42
if [ x$1 != x ]; then
 
43
  USER=$1
 
44
else
 
45
  USER="`build/buildinfo.sh -n %u@%h%d`"
 
46
fi
 
47
 
 
48
if [ ! -f ./ABOUT_APACHE ]; then
 
49
  echo "ERROR: The current directory contains no valid Apache distribution."
 
50
  echo "Please change the directory to the top level directory of a freshly"
 
51
  echo "unpacked Apache 2.0 source distribution and re-execute the script"
 
52
  echo "'./build/binbuild.sh'." 
 
53
  exit 1;
 
54
fi
 
55
 
 
56
if [ -d ./CVS ]; then
 
57
  echo "ERROR: The current directory is a CVS checkout of Apache."
 
58
  echo "Only a standard Apache 2.0 source distribution should be used to"
 
59
  echo "create a binary distribution."
 
60
  exit 1;
 
61
fi
 
62
 
 
63
echo "Building Apache $VER binary distribution..."
 
64
echo "Platform is \"$OS\"..."
 
65
 
 
66
( echo "Build log for Apache binary distribution" && \
 
67
  echo "----------------------------------------------------------------------" && \
 
68
  ./configure $CONFIGPARAM && \
 
69
  echo "----------------------------------------------------------------------" && \
 
70
  make clean && \
 
71
  rm -rf bindist install-bindist.sh *.bindist
 
72
  echo "----------------------------------------------------------------------" && \
 
73
  make && \
 
74
  echo "----------------------------------------------------------------------" && \
 
75
  make install root="bindist/" && \
 
76
  echo "----------------------------------------------------------------------" && \
 
77
  make clean && \
 
78
  echo "----------------------------------------------------------------------" && \
 
79
  echo "[EOF]" \
 
80
) 2>&1 | tee build.log
 
81
 
 
82
if [ ! -f ./bindist/bin/httpd ]; then
 
83
  echo "ERROR: Failed to build Apache. See \"build.log\" for details."
 
84
  exit 1;
 
85
fi
 
86
 
 
87
echo "Binary image successfully created..."
 
88
 
 
89
./bindist/bin/httpd -v
 
90
 
 
91
echo "Creating supplementary files..."
 
92
 
 
93
( echo " " && \
 
94
  echo "Apache $VER binary distribution" && \
 
95
  echo "================================" && \
 
96
  echo " " && \
 
97
  echo "This binary distribution is usable on a \"$OS\"" && \
 
98
  echo "system and was built by \"$USER\"." && \
 
99
  echo "" && \
 
100
  echo "The distribution contains all standard Apache modules as shared" && \
 
101
  echo "objects. This allows you to enable or disable particular modules" && \
 
102
  echo "with the LoadModule/AddModule directives in the configuration file" && \
 
103
  echo "without the need to re-compile Apache." && \
 
104
  echo "" && \
 
105
  echo "See \"INSTALL.bindist\" on how to install the distribution." && \
 
106
  echo " " && \
 
107
  echo "NOTE: Please do not send support-related mails to the address mentioned" && \
 
108
  echo "      above or to any member of the Apache Group! Support questions" && \
 
109
  echo "      should be directed to the forums mentioned at" && \
 
110
  echo "      http://httpd.apache.org/lists.html#http-users" && \
 
111
  echo "      where some of the Apache team lurk, in the company of many other" && \
 
112
  echo "      Apache gurus who should be able to help." && \
 
113
  echo "      If you think you found a bug in Apache or have a suggestion please" && \
 
114
  echo "      visit the bug report page at http://httpd.apache.org/bug_report.html" && \
 
115
  echo " " && \
 
116
  echo "----------------------------------------------------------------------" && \
 
117
  ./bindist/bin/httpd -V && \
 
118
  echo "----------------------------------------------------------------------" \
 
119
) > README.bindist
 
120
cp README.bindist ../httpd-$VER-$OS.README
 
121
 
 
122
( echo " " && \
 
123
  echo "Apache $VER binary installation" && \
 
124
  echo "================================" && \
 
125
  echo " " && \
 
126
  echo "To install this binary distribution you have to execute the installation" && \
 
127
  echo "script \"install-bindist.sh\" in the top-level directory of the distribution." && \
 
128
  echo " " && \
 
129
  echo "The script takes the ServerRoot directory into which you want to install" && \
 
130
  echo "Apache as an option. If you omit the option the default path" && \
 
131
  echo "\"$DEFAULT_DIR\" is used." && \
 
132
  echo "Make sure you have write permissions in the target directory, e.g. switch" && \
 
133
  echo "to user \"root\" before you execute the script." && \
 
134
  echo " " && \
 
135
  echo "See \"README.bindist\" for further details about this distribution." && \
 
136
  echo " " && \
 
137
  echo "Please note that this distribution includes the complete Apache source code." && \
 
138
  echo "Therefore you may compile Apache yourself at any time if you have a compiler" && \
 
139
  echo "installation on your system." && \
 
140
  echo "See \"INSTALL\" for details on how to accomplish this." && \
 
141
  echo " " \
 
142
) > INSTALL.bindist
 
143
 
 
144
sed -e "s%\@default_dir\@%$DEFAULT_DIR%" \
 
145
    -e "s%\@ver\@%$VER%" \
 
146
    -e "s%\@os\@%$OS%" \
 
147
    build/install-bindist.sh.in > install-bindist.sh
 
148
    
 
149
chmod 755 install-bindist.sh
 
150
 
 
151
sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
 
152
    -e "s%^ServerAdmin.*%ServerAdmin you@your.address%" \
 
153
    -e "s%#ServerName.*%#ServerName localhost%" \
 
154
    bindist/conf/httpd-std.conf > bindist/conf/httpd.conf
 
155
cp bindist/conf/httpd.conf bindist/conf/httpd-std.conf
 
156
 
 
157
for one_file in apachectl envvars envvars-std; do
 
158
    sed -e "s%$BUILD_DIR%$DEFAULT_DIR%" \
 
159
        bindist/bin/$one_file > bindist/bin/$one_file.tmp
 
160
    mv bindist/bin/$one_file.tmp bindist/bin/$one_file
 
161
done
 
162
 
 
163
echo "Creating distribution archive and readme file..."
 
164
 
 
165
if [ ".`grep -i error build.log > /dev/null`" != . ]; then
 
166
  echo "ERROR: Failed to build Apache. See \"build.log\" for details."
 
167
  exit 1;
 
168
else
 
169
  if [ "x$TAR" != "x" ]; then
 
170
    case "x$OS" in
 
171
      x*os390*) $TAR -cfU ../httpd-$VER-$OS.tar -C .. httpd-$VER;;
 
172
      *) (cd .. && $TAR -cf httpd-$VER-$OS.tar httpd-$VER);;
 
173
    esac
 
174
    if [ "x$GZIP" != "x" ]; then
 
175
      $GZIP -9 ../httpd-$VER-$OS.tar
 
176
      ARCHIVE=../httpd-$VER-$OS.tar.gz
 
177
    elif [ "x$COMPRESS" != "x" ]; then
 
178
      $COMPRESS ../httpd-$VER-$OS.tar
 
179
      ARCHIVE=../httpd-$VER-$OS.tar.Z
 
180
    else
 
181
      echo "WARNING: Could not find a 'gzip' program!"
 
182
      echo "       tar archive is not compressed."
 
183
      ARCHIVE=../httpd-$VER-$OS.tar
 
184
    fi
 
185
  else
 
186
    echo "ERROR: Could not find a 'tar' program!"
 
187
    echo "       Please execute the following commands manually:"
 
188
    echo "         tar -cf ../httpd-$VER-$OS.tar ."
 
189
    echo "         gzip -9 ../httpd-$VER-$OS.tar"
 
190
  fi
 
191
 
 
192
  if [ "x$MD5" != "x" ]; then
 
193
    $MD5 $ARCHIVE > $ARCHIVE.md5
 
194
  fi
 
195
 
 
196
  if [ -f $ARCHIVE ] && [ -f ../httpd-$VER-$OS.README ]; then
 
197
    echo "Ready."
 
198
    echo "You can find the binary archive ($ARCHIVE)"
 
199
    echo "and the readme file (httpd-$VER-$OS.README) in the"
 
200
    echo "parent directory."
 
201
    exit 0;
 
202
  else
 
203
    echo "ERROR: Archive or README is missing."
 
204
    exit 1;
 
205
  fi
 
206
fi