fix getlib support for bz2 and support xz

This fixes the build as flite is now bundled as a tar.bz2 archive.
This commit is contained in:
Travis Cross 2011-10-27 20:03:28 +00:00
parent 05c06443e7
commit 50328a6634
2 changed files with 28 additions and 38 deletions

View File

@ -1,58 +1,46 @@
#!/bin/sh #!/bin/sh
bz="false"
BUNZIP=/usr/bin/bunzip2
TAR=@TAR@ TAR=@TAR@
ZCAT=@ZCAT@ ZCAT=@ZCAT@
BZIP=@BZIP@
XZ=@XZ@
WGET=@WGET@ WGET=@WGET@
CURL=@CURL@ CURL=@CURL@
if [ -f "$WGET" ] ; then if [ -f "$WGET" ]; then
DOWNLOAD_CMD=$WGET DOWNLOAD_CMD=$WGET
else elif [ -f "$CURL" ]; then
if [ -f "$CURL" ] ; then DOWNLOAD_CMD="$CURL -O"
DOWNLOAD_CMD="$CURL -O"
fi
fi fi
base=http://files.freeswitch.org/downloads/libs/ if [ -n "`echo $1 | grep '://'`" ]; then
tarfile=$1 base=$1/
url=`echo $tarfile | grep "://"`
if [ `echo $tarfile | grep bz2` ] ; then
bz="true"
UNZIPPER=$BUNZIP
else
UNZIPPER=$ZCAT
fi
if [ ! -z $url ] ; then
base=$tarfile/
tarfile=$2 tarfile=$2
else
base=http://files.freeswitch.org/downloads/libs/
tarfile=$1
fi fi
if [ ! -d $tarfile ] ; then uncompressed=`echo $tarfile | sed 's/\(\(\.tar\.gz\|\.tar\.bz2\|\.tar\.xz\)\|\(\.tgz\|\.tbz2\)\)$//'`
if [ $bz = "true" ] ; then case `echo $tarfile | sed 's/.*\.\([^.]\+\)$/\1/'` in
uncompressed=`echo $tarfile | sed "s/\.tar\.bz2//g"` bz2|tbz2) UNZIPPER=$BZIP ;;
else xz) UNZIPPER=$XZ ;;
uncompressed=`echo $tarfile | sed "s/\.tar\.gz//g"` gz|tgz|*) UNZIPPER=$ZCAT ;;
uncompressed=`echo $uncompressed | sed "s/\.tgz//g"` esac
fi
if [ ! -f $tarfile ] ; then if [ ! -d $tarfile ]; then
rm -fr $uncompressed if [ ! -f $tarfile ]; then
$DOWNLOAD_CMD $base$tarfile rm -fr $uncompressed
if [ ! -f $tarfile ] ; then $DOWNLOAD_CMD $base$tarfile
echo cannot find $tarfile if [ ! -f $tarfile ]; then
exit 1 echo cannot find $tarfile
fi exit 1
fi
fi fi
if [ ! -d $uncompressed ] ; then if [ ! -d $uncompressed ]; then
$UNZIPPER -c -d $tarfile | $TAR xf - $UNZIPPER -c -d $tarfile | $TAR -xf -
fi fi
fi fi
exit 0 exit 0

View File

@ -764,6 +764,8 @@ case $host in
;; ;;
esac esac
AC_PATH_PROGS(BZIP, bzip2)
AC_PATH_PROGS(XZ, xz)
AC_PATH_PROGS(TAR, gtar tar) AC_PATH_PROGS(TAR, gtar tar)
AC_PATH_PROGS(WGET, wget) AC_PATH_PROGS(WGET, wget)
AC_PATH_PROGS(CURL, curl) AC_PATH_PROGS(CURL, curl)