]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/apr-util/buildconf
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / apr-util / buildconf
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
20 if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
21     verbose="--verbose"
22     shift
23 fi
24
25 # Default place to look for apr source.  Can be overridden with 
26 #   --with-apr=[directory]
27 apr_src_dir=../apr
28
29 while test $# -gt 0 
30 do
31   # Normalize
32   case "$1" in
33   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
34   *) optarg= ;;
35   esac
36
37   case "$1" in
38   --with-apr=*)
39   apr_src_dir=$optarg
40   ;;
41   esac
42
43   shift
44 done
45
46 if [ -f "$apr_src_dir/build/apr_common.m4" ]; then
47   apr_src_dir=`cd $apr_src_dir; pwd`
48   echo ""
49   echo "Looking for apr source in $apr_src_dir"
50 else
51   echo ""
52   echo "Problem finding apr source in $apr_src_dir."
53   echo "Use:"
54   echo "  --with-apr=[directory]" 
55   exit 1
56 fi
57
58 set -e
59
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 \
66       build/
67
68 # Remove aclocal.m4 as it'll break some builds...
69 rm -rf aclocal.m4 autom4te*.cache
70
71 #
72 # Generate the autoconf header (include/apu_config.h) and ./configure
73 #
74 echo "Creating include/private/apu_config.h ..."
75 ${AUTOHEADER:-autoheader} $verbose
76
77 echo "Creating configure ..."
78 ### do some work to toss config.cache?
79 if ${AUTOCONF:-autoconf} $verbose; then
80   :
81 else
82   echo "autoconf failed"
83   exit 1
84 fi
85
86 #
87 # Generate build-outputs.mk for the build system
88 #
89 echo "Generating 'make' outputs ..."
90 $apr_src_dir/build/gen-build.py $verbose make
91
92 #
93 # If Expat has been bundled, then go and configure the thing
94 #
95 if [ -f xml/expat/buildconf.sh ]; then
96   echo "Invoking xml/expat/buildconf.sh ..."
97   (cd xml/expat; ./buildconf.sh $verbose)
98 fi
99
100 # Remove autoconf cache again
101 rm -rf autom4te*.cache
102
103 # Create RPM Spec file
104 if [ -f `which cut` ]; then
105   echo rebuilding rpm spec file
106   REVISION=`build/get-version.sh all include/apu_version.h APU`
107   VERSION=`echo $REVISION | cut -d- -s -f1`
108   RELEASE=`echo $REVISION | cut -d- -s -f2`
109   if [ "x$VERSION" = "x" ]; then
110       VERSION=$REVISION
111       RELEASE=1
112   fi
113   sed -e "s/APU_VERSION/$VERSION/" -e "s/APU_RELEASE/$RELEASE/" \
114     ./build/rpm/apr-util.spec.in > apr-util.spec
115 fi
116