|
Packit |
383869 |
#!/bin/sh
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
Packit |
383869 |
# contributor license agreements. See the NOTICE file distributed with
|
|
Packit |
383869 |
# this work for additional information regarding copyright ownership.
|
|
Packit |
383869 |
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
Packit |
383869 |
# (the "License"); you may not use this file except in compliance with
|
|
Packit |
383869 |
# the License. You may obtain a copy of the License at
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
# http://www.apache.org/licenses/LICENSE-2.0
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
# Unless required by applicable law or agreed to in writing, software
|
|
Packit |
383869 |
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
Packit |
383869 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
Packit |
383869 |
# See the License for the specific language governing permissions and
|
|
Packit |
383869 |
# limitations under the License.
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
|
|
Packit |
383869 |
if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
|
|
Packit |
383869 |
verbose="--verbose"
|
|
Packit |
383869 |
shift
|
|
Packit |
383869 |
fi
|
|
Packit |
383869 |
|
|
Packit |
383869 |
# Default place to look for apr source. Can be overridden with
|
|
Packit |
383869 |
# --with-apr=[directory]
|
|
Packit |
383869 |
apr_src_dir=../apr
|
|
Packit |
383869 |
|
|
Packit |
383869 |
while test $# -gt 0
|
|
Packit |
383869 |
do
|
|
Packit |
383869 |
# Normalize
|
|
Packit |
383869 |
case "$1" in
|
|
Packit |
383869 |
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
|
Packit |
383869 |
*) optarg= ;;
|
|
Packit |
383869 |
esac
|
|
Packit |
383869 |
|
|
Packit |
383869 |
case "$1" in
|
|
Packit |
383869 |
--with-apr=*)
|
|
Packit |
383869 |
apr_src_dir=$optarg
|
|
Packit |
383869 |
;;
|
|
Packit |
383869 |
esac
|
|
Packit |
383869 |
|
|
Packit |
383869 |
shift
|
|
Packit |
383869 |
done
|
|
Packit |
383869 |
|
|
Packit |
383869 |
if [ -f "$apr_src_dir/build/apr_common.m4" ]; then
|
|
Packit |
383869 |
apr_src_dir=`cd $apr_src_dir; pwd`
|
|
Packit |
383869 |
echo ""
|
|
Packit |
383869 |
echo "Looking for apr source in $apr_src_dir"
|
|
Packit |
383869 |
else
|
|
Packit |
383869 |
echo ""
|
|
Packit |
383869 |
echo "Problem finding apr source in $apr_src_dir."
|
|
Packit |
383869 |
echo "Use:"
|
|
Packit |
383869 |
echo " --with-apr=[directory]"
|
|
Packit |
383869 |
exit 1
|
|
Packit |
383869 |
fi
|
|
Packit |
383869 |
|
|
Packit |
383869 |
set -e
|
|
Packit |
383869 |
|
|
Packit |
383869 |
# Remove some files, then copy them from apr source tree
|
|
Packit |
383869 |
rm -f build/apr_common.m4 build/find_apr.m4 build/install.sh \
|
|
Packit |
383869 |
build/config.guess build/config.sub build/get-version.sh
|
|
Packit |
383869 |
cp -p $apr_src_dir/build/apr_common.m4 $apr_src_dir/build/find_apr.m4 \
|
|
Packit |
383869 |
$apr_src_dir/build/install.sh $apr_src_dir/build/config.guess \
|
|
Packit |
383869 |
$apr_src_dir/build/config.sub $apr_src_dir/build/get-version.sh \
|
|
Packit |
383869 |
build/
|
|
Packit |
383869 |
|
|
Packit |
383869 |
# Remove aclocal.m4 as it'll break some builds...
|
|
Packit |
383869 |
rm -rf aclocal.m4 autom4te*.cache
|
|
Packit |
383869 |
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
# Generate the autoconf header (include/apu_config.h) and ./configure
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
echo "Creating include/private/apu_config.h ..."
|
|
Packit |
383869 |
${AUTOHEADER:-autoheader} $verbose
|
|
Packit |
383869 |
|
|
Packit |
383869 |
echo "Creating configure ..."
|
|
Packit |
383869 |
### do some work to toss config.cache?
|
|
Packit |
383869 |
if ${AUTOCONF:-autoconf} $verbose; then
|
|
Packit |
383869 |
:
|
|
Packit |
383869 |
else
|
|
Packit |
383869 |
echo "autoconf failed"
|
|
Packit |
383869 |
exit 1
|
|
Packit |
383869 |
fi
|
|
Packit |
383869 |
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
# Generate build-outputs.mk for the build system
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
echo "Generating 'make' outputs ..."
|
|
Packit |
383869 |
$apr_src_dir/build/gen-build.py $verbose make
|
|
Packit |
383869 |
|
|
Packit |
383869 |
# Remove autoconf cache again
|
|
Packit |
383869 |
rm -rf autom4te*.cache
|
|
Packit |
383869 |
|
|
Packit |
383869 |
# Create RPM Spec file
|
|
Packit |
383869 |
if [ -f `which cut` ]; then
|
|
Packit |
383869 |
echo rebuilding rpm spec file
|
|
Packit |
383869 |
REVISION=`build/get-version.sh all include/apu_version.h APU`
|
|
Packit |
383869 |
VERSION=`echo $REVISION | cut -d- -s -f1`
|
|
Packit |
383869 |
RELEASE=`echo $REVISION | cut -d- -s -f2`
|
|
Packit |
383869 |
if [ "x$VERSION" = "x" ]; then
|
|
Packit |
383869 |
VERSION=$REVISION
|
|
Packit |
383869 |
RELEASE=1
|
|
Packit |
383869 |
fi
|
|
Packit |
383869 |
sed -e "s/APU_VERSION/$VERSION/" -e "s/APU_RELEASE/$RELEASE/" \
|
|
Packit |
383869 |
./build/rpm/apr-util.spec.in > apr-util.spec
|
|
Packit |
383869 |
fi
|
|
Packit |
383869 |
|
|
Packit |
383869 |
# Verify the tree was clean, notify user if not (normal in development)
|
|
Packit |
383869 |
#
|
|
Packit |
383869 |
if [ -f "include/apu.h" -o -f "include/private/apu_config.h" -o \
|
|
Packit |
383869 |
-f "include/apu_want.h" -o -f "include/private/apu_select_dbm.h" ]; then
|
|
Packit |
383869 |
echo ""
|
|
Packit |
383869 |
echo "Generated include files already exist, the tree is not clean."
|
|
Packit |
383869 |
echo "The resulting build-outputs.mk file is incorrect"
|
|
Packit |
383869 |
fi
|
|
Packit |
383869 |
|
|
Packit |
383869 |
exit 0
|