]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix getlib support for bz2 and support xz
authorTravis Cross <tc@traviscross.com>
Thu, 27 Oct 2011 20:03:28 +0000 (20:03 +0000)
committerTravis Cross <tc@traviscross.com>
Sun, 30 Oct 2011 09:54:17 +0000 (09:54 +0000)
This fixes the build as flite is now bundled as a tar.bz2 archive.

build/getlib.sh.in
configure.in

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