2007-03-11 06:52:04 -04:00
|
|
|
#!/bin/sh
|
2012-04-04 18:21:56 -04:00
|
|
|
##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
|
|
|
##### bootstrap FreeSWITCH and FreeSWITCH libraries
|
|
|
|
|
2021-01-25 11:02:15 -05:00
|
|
|
. $(dirname $0)/scripts/ci/build-requirements.sh
|
|
|
|
|
2007-03-11 06:52:04 -04:00
|
|
|
echo "bootstrap: checking installation..."
|
|
|
|
|
2010-06-07 20:44:27 -04:00
|
|
|
BGJOB=false
|
2012-04-05 14:38:13 -04:00
|
|
|
VERBOSE=false
|
2012-04-04 17:24:35 -04:00
|
|
|
BASEDIR=`pwd`;
|
|
|
|
LIBDIR=${BASEDIR}/libs;
|
2022-10-28 11:34:18 -04:00
|
|
|
SUBDIRS="apr iksemel srtp fs";
|
2012-04-04 17:24:35 -04:00
|
|
|
|
2012-04-05 14:38:13 -04:00
|
|
|
while getopts 'jhd:v' o; do
|
2012-04-04 17:24:35 -04:00
|
|
|
case "$o" in
|
2010-06-13 20:16:28 -04:00
|
|
|
j) BGJOB=true;;
|
2012-04-04 18:55:20 -04:00
|
|
|
d) SUBDIRS="$OPTARG";;
|
2012-04-05 14:38:13 -04:00
|
|
|
v) VERBOSE=true;;
|
2010-06-13 20:16:28 -04:00
|
|
|
h) echo "Usage: $0 <options>"
|
2012-04-04 18:21:56 -04:00
|
|
|
echo " Options:"
|
|
|
|
echo " -d 'library1 library2'"
|
2012-04-04 18:39:43 -04:00
|
|
|
echo " => Bootstrap only specified subdirectories"
|
2012-04-04 18:21:56 -04:00
|
|
|
echo " -j => Run Jobs in Background"
|
|
|
|
exit;;
|
2010-06-13 20:16:28 -04:00
|
|
|
esac
|
|
|
|
done
|
2010-06-07 20:44:27 -04:00
|
|
|
|
2012-04-05 14:38:13 -04:00
|
|
|
ex() {
|
|
|
|
test $VERBOSE && echo "bootstrap: $@" >&2
|
|
|
|
$@
|
|
|
|
}
|
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
setup_modules() {
|
|
|
|
if [ ! -f modules.conf ]; then
|
2007-11-12 19:45:20 -05:00
|
|
|
cp build/modules.conf.in modules.conf
|
2012-04-04 18:21:56 -04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
setup_gnu() {
|
|
|
|
# keep automake from making us magically GPL, and to stop
|
|
|
|
# complaining about missing files.
|
|
|
|
cp -f docs/COPYING .
|
|
|
|
cp -f docs/AUTHORS .
|
|
|
|
cp -f docs/ChangeLog .
|
|
|
|
touch NEWS
|
|
|
|
touch README
|
|
|
|
}
|
|
|
|
|
|
|
|
print_autotools_vers() {
|
|
|
|
#
|
|
|
|
# Info output
|
|
|
|
#
|
|
|
|
echo "Bootstrapping using:"
|
|
|
|
echo " autoconf : ${AUTOCONF:-`which autoconf`}"
|
|
|
|
echo " automake : ${AUTOMAKE:-`which automake`}"
|
|
|
|
echo " aclocal : ${ACLOCAL:-`which aclocal`}"
|
|
|
|
echo " libtool : ${libtool} (${lt_version})"
|
|
|
|
echo " libtoolize: ${libtoolize}"
|
2012-04-10 13:21:21 -04:00
|
|
|
echo " make : ${make} (${make_version})"
|
|
|
|
echo " awk : ${awk} (${awk_version})"
|
2012-04-04 18:21:56 -04:00
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
bootstrap_apr() {
|
|
|
|
echo "Entering directory ${LIBDIR}/apr"
|
|
|
|
cd ${LIBDIR}/apr
|
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
|
|
|
# bootstrap: Build the support scripts needed to compile from a
|
|
|
|
# checked-out version of the source code.
|
|
|
|
|
|
|
|
# Create the libtool helper files
|
|
|
|
#
|
|
|
|
# Note: we copy (rather than link) them to simplify distribution.
|
|
|
|
# Note: APR supplies its own config.guess and config.sub -- we do not
|
|
|
|
# rely on libtool's versions
|
|
|
|
#
|
|
|
|
echo "Copying libtool helper files ..."
|
|
|
|
|
|
|
|
# Remove any libtool files so one can switch between libtool 1.3
|
|
|
|
# and libtool 1.4 by simply rerunning the bootstrap script.
|
|
|
|
(cd build ; rm -f ltconfig ltmain.sh libtool.m4)
|
|
|
|
|
|
|
|
if ${libtoolize} -n --install >/dev/null 2>&1 ; then
|
|
|
|
$libtoolize --force --copy --install
|
|
|
|
else
|
|
|
|
$libtoolize --force --copy
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f libtool.m4 ]; then
|
|
|
|
ltfile=`pwd`/libtool.m4
|
|
|
|
else
|
|
|
|
if [ $lt_major -eq 2 ]; then
|
|
|
|
ltfindcmd="`sed -n \"/aclocaldir=/{s/.*=/echo /p;q;}\" < $libtoolize`"
|
|
|
|
ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`/libtool.m4}
|
|
|
|
else
|
|
|
|
ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
|
2009-04-06 18:29:10 -04:00
|
|
|
< $libtoolize`"
|
2012-04-04 18:21:56 -04:00
|
|
|
ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
|
|
|
|
fi
|
|
|
|
# Expecting the code above to be very portable, but just in case...
|
|
|
|
if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
|
|
|
|
ltpath=`dirname $libtoolize`
|
|
|
|
ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f $ltfile ]; then
|
2007-03-11 06:52:04 -04:00
|
|
|
echo "$ltfile not found"
|
|
|
|
exit 1
|
2012-04-04 18:21:56 -04:00
|
|
|
fi
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
echo "bootstrap: Using libtool.m4 at ${ltfile}."
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
cat $ltfile | sed -e 's/LIBTOOL=\(.*\)top_build/LIBTOOL=\1apr_build/' > build/libtool.m4
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
# libtool.m4 from 1.6 requires ltsugar.m4
|
|
|
|
if [ -f ltsugar.m4 ]; then
|
|
|
|
rm -f build/ltsugar.m4
|
|
|
|
mv ltsugar.m4 build/ltsugar.m4
|
|
|
|
fi
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
# Clean up any leftovers
|
|
|
|
rm -f aclocal.m4 libtool.m4
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
# fix for FreeBSD (at least):
|
|
|
|
# libtool.m4 is in share/aclocal, while e.g. aclocal19 only looks in share/aclocal19
|
|
|
|
# get aclocal's default directory and include the libtool.m4 directory via -I if
|
|
|
|
# it's in a different location
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
aclocal_dir="`${ACLOCAL:-aclocal} --print-ac-dir`"
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
if [ -n "${aclocal_dir}" -a -n "${ltfile}" -a "`dirname ${ltfile}`" != "${aclocal_dir}" ] ; then
|
|
|
|
ACLOCAL_OPTS="-I `dirname ${ltfile}`"
|
|
|
|
fi
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
### run aclocal
|
|
|
|
echo "Re-creating aclocal.m4 ..."
|
|
|
|
${ACLOCAL:-aclocal} ${ACLOCAL_OPTS}
|
2009-04-06 18:29:10 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
### do some work to toss config.cache?
|
2012-04-17 17:46:05 -04:00
|
|
|
rm -rf config.cache
|
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
echo "Creating configure ..."
|
|
|
|
${AUTOCONF:-autoconf}
|
2009-04-06 18:29:10 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
#
|
|
|
|
# Generate the autoconf header
|
|
|
|
#
|
|
|
|
echo "Creating include/arch/unix/apr_private.h.in ..."
|
|
|
|
${AUTOHEADER:-autoheader}
|
|
|
|
|
|
|
|
# Remove autoconf 2.5x's cache directory
|
|
|
|
rm -rf autom4te*.cache
|
|
|
|
|
|
|
|
}
|
2009-04-06 18:29:10 -04:00
|
|
|
|
2010-06-07 20:44:27 -04:00
|
|
|
# Libs automake automation function
|
2012-04-04 18:21:56 -04:00
|
|
|
libbootstrap() {
|
2010-06-07 20:44:27 -04:00
|
|
|
i=$1
|
2012-04-04 18:21:56 -04:00
|
|
|
if [ -d ${LIBDIR}/${i} ]; then
|
|
|
|
echo "Entering directory ${LIBDIR}/${i}"
|
2012-04-05 14:38:13 -04:00
|
|
|
ex cd ${LIBDIR}/${i}
|
|
|
|
ex rm -f aclocal.m4
|
2012-04-04 18:21:56 -04:00
|
|
|
CFFILE=
|
|
|
|
if [ -f ${LIBDIR}/${i}/configure.in ]; then
|
2007-03-11 06:52:04 -04:00
|
|
|
CFFILE="${LIBDIR}/${i}/configure.in"
|
2012-04-04 18:21:56 -04:00
|
|
|
else
|
|
|
|
if [ -f ${LIBDIR}/${i}/configure.ac ]; then
|
|
|
|
CFFILE="${LIBDIR}/${i}/configure.ac"
|
2007-03-11 06:52:04 -04:00
|
|
|
fi
|
2012-04-04 18:21:56 -04:00
|
|
|
fi
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
if [ ! -z ${CFFILE} ]; then
|
2007-03-11 06:52:04 -04:00
|
|
|
LTTEST=`grep "AC_PROG_LIBTOOL" ${CFFILE}`
|
|
|
|
LTTEST2=`grep "AM_PROG_LIBTOOL" ${CFFILE}`
|
2009-06-10 17:45:27 -04:00
|
|
|
AMTEST=`grep "AM_INIT_AUTOMAKE" ${CFFILE}`
|
|
|
|
AMTEST2=`grep "AC_PROG_INSTALL" ${CFFILE}`
|
2007-03-11 06:52:04 -04:00
|
|
|
AHTEST=`grep "AC_CONFIG_HEADERS" ${CFFILE}`
|
2011-08-31 11:08:11 -04:00
|
|
|
AXTEST=`grep "ACX_LIBTOOL_C_ONLY" ${CFFILE}`
|
2007-03-11 06:52:04 -04:00
|
|
|
|
|
|
|
echo "Creating aclocal.m4"
|
2012-04-05 14:38:13 -04:00
|
|
|
ex ${ACLOCAL:-aclocal} ${ACLOCAL_OPTS} ${ACLOCAL_FLAGS}
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
# only run if AC_PROG_LIBTOOL is in configure.in/configure.ac
|
|
|
|
if [ ! -z "${LTTEST}" -o "${LTTEST2}" -o "${AXTEST}" ]; then
|
|
|
|
echo "Running libtoolize..."
|
|
|
|
if ${libtoolize} -n --install >/dev/null 2>&1; then
|
2012-04-05 14:38:13 -04:00
|
|
|
ex $libtoolize --force --copy --install
|
2012-04-04 18:21:56 -04:00
|
|
|
else
|
2012-04-05 14:38:13 -04:00
|
|
|
ex $libtoolize --force --copy
|
2012-04-04 18:21:56 -04:00
|
|
|
fi
|
2007-03-11 06:52:04 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Creating configure"
|
2012-04-05 14:38:13 -04:00
|
|
|
ex ${AUTOCONF:-autoconf}
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
# only run if AC_CONFIG_HEADERS is found in configure.in/configure.ac
|
|
|
|
if [ ! -z "${AHTEST}" ]; then
|
|
|
|
echo "Running autoheader..."
|
2012-04-05 14:38:13 -04:00
|
|
|
ex ${AUTOHEADER:-autoheader};
|
2007-03-11 06:52:04 -04:00
|
|
|
fi
|
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
# run if AM_INIT_AUTOMAKE / AC_PROG_INSTALL is in configure.in/configure.ac
|
|
|
|
if [ ! -z "${AMTEST}" -o "${AMTEST2}" ]; then
|
|
|
|
echo "Creating Makefile.in"
|
2012-04-05 14:38:13 -04:00
|
|
|
ex ${AUTOMAKE:-automake} --no-force --add-missing --copy;
|
2007-03-11 06:52:04 -04:00
|
|
|
fi
|
2012-04-05 14:38:13 -04:00
|
|
|
ex rm -rf autom4te*.cache
|
2012-04-04 18:21:56 -04:00
|
|
|
fi
|
2010-06-08 13:21:54 -04:00
|
|
|
else
|
2012-04-04 18:21:56 -04:00
|
|
|
echo "Skipping directory ${LIBDIR}/${i}"
|
2010-06-08 13:21:54 -04:00
|
|
|
fi
|
2010-06-07 20:44:27 -04:00
|
|
|
}
|
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
bootstrap_fs() {
|
|
|
|
cd ${BASEDIR}
|
|
|
|
rm -f aclocal.m4
|
|
|
|
${ACLOCAL:-aclocal} ${ACLOCAL_OPTS}
|
|
|
|
$libtoolize --copy --automake
|
|
|
|
${AUTOCONF:-autoconf}
|
|
|
|
${AUTOHEADER:-autoheader}
|
|
|
|
${AUTOMAKE:-automake} --no-force --add-missing --copy
|
|
|
|
rm -rf autom4te*.cache
|
|
|
|
}
|
2010-06-07 20:44:27 -04:00
|
|
|
|
2012-04-17 23:05:48 -04:00
|
|
|
bootstrap_libs_pre() {
|
|
|
|
case "$1" in
|
|
|
|
*) return 0;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
bootstrap_libs_post() {
|
|
|
|
case "$1" in
|
2014-05-01 17:17:45 -04:00
|
|
|
*) return 0;;
|
2012-04-17 23:05:48 -04:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
bootstrap_libs() {
|
|
|
|
for i in ${SUBDIRS}; do
|
2012-04-04 18:55:20 -04:00
|
|
|
case "$i" in
|
2022-10-28 11:34:18 -04:00
|
|
|
apr|fs)
|
2012-05-08 16:14:19 -04:00
|
|
|
${BGJOB} && wait
|
2012-04-04 19:34:06 -04:00
|
|
|
bootstrap_$i
|
|
|
|
continue
|
2012-04-04 19:23:07 -04:00
|
|
|
;;
|
2012-04-04 18:55:20 -04:00
|
|
|
esac
|
2012-04-17 23:05:48 -04:00
|
|
|
bootstrap_libs_pre ${i}
|
2012-04-17 22:00:59 -04:00
|
|
|
if ! ${BGJOB}; then
|
2012-04-17 23:05:48 -04:00
|
|
|
libbootstrap ${i} ; bootstrap_libs_post ${i}
|
2012-04-17 22:00:59 -04:00
|
|
|
else
|
2012-05-08 15:40:43 -04:00
|
|
|
(libbootstrap ${i} ; bootstrap_libs_post ${i}) &
|
2012-04-17 22:00:59 -04:00
|
|
|
fi
|
2012-04-04 18:21:56 -04:00
|
|
|
done
|
2012-05-08 16:14:19 -04:00
|
|
|
${BGJOB} && wait
|
2012-04-04 18:21:56 -04:00
|
|
|
}
|
2010-06-07 20:44:27 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
run() {
|
|
|
|
setup_modules
|
|
|
|
setup_gnu
|
2012-04-10 13:21:21 -04:00
|
|
|
check_make
|
|
|
|
check_awk
|
2012-04-04 18:21:56 -04:00
|
|
|
check_ac_ver
|
|
|
|
check_am_ver
|
|
|
|
check_acl_ver
|
|
|
|
check_lt_ver
|
|
|
|
check_libtoolize
|
|
|
|
print_autotools_vers
|
|
|
|
bootstrap_libs
|
2012-04-04 20:23:23 -04:00
|
|
|
return 0
|
2012-04-04 18:21:56 -04:00
|
|
|
}
|
2007-03-11 06:52:04 -04:00
|
|
|
|
2012-04-04 18:21:56 -04:00
|
|
|
run
|
2007-03-11 06:52:04 -04:00
|
|
|
|