2006-01-30 16:04:19 -05:00
|
|
|
#!/bin/sh
|
2005-12-21 11:24:37 -05:00
|
|
|
|
2005-12-28 10:42:49 -05:00
|
|
|
root=$1
|
|
|
|
shift
|
|
|
|
|
2006-02-13 14:51:17 -05:00
|
|
|
|
2005-12-28 10:42:49 -05:00
|
|
|
if [ -f $root/.nodepends ] ; then
|
2006-01-30 16:04:19 -05:00
|
|
|
echo "***depends disabled*** use $MAKE yesdepends to re-enable"
|
2005-12-21 12:22:38 -05:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2006-02-13 14:51:17 -05:00
|
|
|
if [ -f $root/build/freeswitch.env ] ; then
|
|
|
|
. $root/build/freeswitch.env
|
|
|
|
fi
|
|
|
|
|
2006-09-23 19:27:44 -04:00
|
|
|
if [ -z "$MAKE" ] ; then
|
2006-02-13 14:51:17 -05:00
|
|
|
make=`which gmake 2>/dev/null`
|
2006-09-23 19:27:44 -04:00
|
|
|
if [ -z "$MAKE" ] ; then
|
2006-01-30 16:04:19 -05:00
|
|
|
make=make
|
|
|
|
fi
|
|
|
|
fi
|
2005-12-21 12:22:38 -05:00
|
|
|
|
2006-12-12 11:38:46 -05:00
|
|
|
GZCAT=`which gzcat 2>/dev/null`
|
|
|
|
if [ -z "$GZCAT" ] ; then
|
|
|
|
GZCAT=zcat
|
|
|
|
fi
|
|
|
|
|
2005-12-21 12:22:38 -05:00
|
|
|
install=
|
2006-03-07 21:58:36 -05:00
|
|
|
base=http://svn.freeswitch.org/downloads/libs
|
2005-12-21 12:22:38 -05:00
|
|
|
|
2006-09-23 19:27:44 -04:00
|
|
|
if [ ! -z "$1" ] && [ "$1" = install ] ; then
|
2005-12-21 11:24:37 -05:00
|
|
|
install=1
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2005-12-21 12:22:38 -05:00
|
|
|
tar=$1
|
|
|
|
shift
|
|
|
|
|
|
|
|
cd $root/libs/.
|
|
|
|
CFLAGS=
|
|
|
|
LDFLAGS=
|
2006-01-30 16:04:19 -05:00
|
|
|
MAKEFLAGS=
|
2005-12-21 11:24:37 -05:00
|
|
|
|
|
|
|
if [ -d $tar ] ; then
|
|
|
|
uncompressed=$tar
|
|
|
|
tar=
|
|
|
|
else
|
|
|
|
uncompressed=`echo $tar | sed "s/\.tar\.gz//g"`
|
2005-12-28 16:00:36 -05:00
|
|
|
uncompressed=`echo $uncompressed | sed "s/\.tgz//g"`
|
|
|
|
|
2005-12-21 11:24:37 -05:00
|
|
|
if [ ! -f $tar ] ; then
|
|
|
|
rm -fr $uncompressed
|
2006-09-22 23:44:32 -04:00
|
|
|
wget $base/$tar || ftp $base/$tar
|
2005-12-21 11:24:37 -05:00
|
|
|
if [ ! -f $tar ] ; then
|
|
|
|
echo cannot find $tar
|
|
|
|
exit
|
|
|
|
fi
|
2005-12-28 16:00:36 -05:00
|
|
|
fi
|
|
|
|
if [ ! -d $uncompressed ] ; then
|
2006-12-12 11:38:46 -05:00
|
|
|
$GZCAT $tar | tar xf -
|
2005-12-21 11:24:37 -05:00
|
|
|
fi
|
|
|
|
fi
|
2006-12-12 11:38:46 -05:00
|
|
|
if [ -f $uncompressed/.complete ] ; then
|
2006-12-18 19:43:27 -05:00
|
|
|
if [ $uncompressed/.complete -ot $uncompressed ]; then
|
2006-12-12 11:38:46 -05:00
|
|
|
if [ ! -f $root/.nothanks ] ; then
|
2006-10-18 18:57:35 -04:00
|
|
|
echo remove stale .complete
|
|
|
|
rm $uncompressed/.complete
|
2006-10-18 20:20:40 -04:00
|
|
|
sh -c "cd $uncompressed && $MAKE clean distclean"
|
2006-10-18 18:57:35 -04:00
|
|
|
fi
|
2006-12-12 11:38:46 -05:00
|
|
|
fi
|
|
|
|
fi
|
2006-10-18 18:57:35 -04:00
|
|
|
|
2005-12-21 12:22:38 -05:00
|
|
|
if [ -f $uncompressed/.complete ] ; then
|
2005-12-20 18:17:30 -05:00
|
|
|
echo $uncompressed already installed
|
2005-12-22 17:17:25 -05:00
|
|
|
exit 0
|
2005-12-20 18:17:30 -05:00
|
|
|
fi
|
2005-12-21 11:24:37 -05:00
|
|
|
|
2005-12-20 18:17:30 -05:00
|
|
|
cd $uncompressed
|
|
|
|
|
2006-02-09 17:37:44 -05:00
|
|
|
if [ -f ../$uncompressed.build.sh ] ; then
|
|
|
|
MAKE=$MAKE ../$uncompressed.build.sh $@
|
|
|
|
else
|
|
|
|
$MAKE clean 2>&1
|
2006-08-22 17:18:36 -04:00
|
|
|
CFLAGS="$MOD_CFLAGS" ; export CFLAGS; sh ./configure $@
|
2006-02-09 17:37:44 -05:00
|
|
|
|
|
|
|
if [ $? = 0 ] ; then
|
|
|
|
$MAKE
|
|
|
|
else
|
|
|
|
echo ERROR
|
|
|
|
exit 1
|
|
|
|
fi
|
2005-12-21 11:24:37 -05:00
|
|
|
|
2006-02-09 17:37:44 -05:00
|
|
|
if [ ! -z $install ] ; then
|
|
|
|
$MAKE install
|
|
|
|
fi
|
2005-12-21 11:24:37 -05:00
|
|
|
fi
|
|
|
|
|
2006-01-30 18:31:06 -05:00
|
|
|
if [ $? = 0 ] ; then
|
2005-12-21 11:24:37 -05:00
|
|
|
touch .complete
|
2006-12-12 12:38:03 -05:00
|
|
|
sleep 1
|
2006-12-12 11:38:46 -05:00
|
|
|
touch .complete
|
2005-12-21 11:24:37 -05:00
|
|
|
else
|
|
|
|
echo ERROR
|
|
|
|
exit 1
|
|
|
|
fi
|
2005-12-20 18:17:30 -05:00
|
|
|
|
2005-12-21 11:24:37 -05:00
|
|
|
exit 0
|
2006-12-18 19:43:27 -05:00
|
|
|
|