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
10 # http://www.apache.org/licenses/LICENSE-2.0
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.
20 if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
25 # Default place to look for apr source. Can be overridden with
26 # --with-apr=[directory]
33 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
46 if [ -f "$apr_src_dir/build/apr_common.m4" ]; then
47 apr_src_dir=`cd $apr_src_dir; pwd`
49 echo "Looking for apr source in $apr_src_dir"
52 echo "Problem finding apr source in $apr_src_dir."
54 echo " --with-apr=[directory]"
60 # Remove some files, then copy them from apr source tree
61 rm -f build/apr_common.m4 build/find_apr.m4 build/install.sh \
62 build/config.guess build/config.sub build/get-version.sh
63 cp -p $apr_src_dir/build/apr_common.m4 $apr_src_dir/build/find_apr.m4 \
64 $apr_src_dir/build/install.sh $apr_src_dir/build/config.guess \
65 $apr_src_dir/build/config.sub $apr_src_dir/build/get-version.sh \
68 # Remove aclocal.m4 as it'll break some builds...
69 rm -rf aclocal.m4 autom4te*.cache
72 # Generate the autoconf header (include/apu_config.h) and ./configure
74 echo "Creating include/private/apu_config.h ..."
75 ${AUTOHEADER:-autoheader} $verbose
77 echo "Creating configure ..."
78 ### do some work to toss config.cache?
79 if ${AUTOCONF:-autoconf} $verbose; then
82 echo "autoconf failed"
87 # Generate build-outputs.mk for the build system
89 echo "Generating 'make' outputs ..."
90 $apr_src_dir/build/gen-build.py $verbose make
92 # Remove autoconf cache again
93 rm -rf autom4te*.cache
95 # Create RPM Spec file
96 if [ -f `which cut` ]; then
97 echo rebuilding rpm spec file
98 REVISION=`build/get-version.sh all include/apu_version.h APU`
99 VERSION=`echo $REVISION | cut -d- -s -f1`
100 RELEASE=`echo $REVISION | cut -d- -s -f2`
101 if [ "x$VERSION" = "x" ]; then
105 sed -e "s/APU_VERSION/$VERSION/" -e "s/APU_RELEASE/$RELEASE/" \
106 ./build/rpm/apr-util.spec.in > apr-util.spec
109 # Verify the tree was clean, notify user if not (normal in development)
111 if [ -f "include/apu.h" -o -f "include/private/apu_config.h" -o \
112 -f "include/apu_want.h" -o -f "include/private/apu_select_dbm.h" ]; then
114 echo "Generated include files already exist, the tree is not clean."
115 echo "The resulting build-outputs.mk file is incorrect"