From f82c23ea69038a0a7faec9680d7837a9bf46f3a9 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Mon, 28 Feb 2011 12:46:12 -0300 Subject: [PATCH] freetdm: updated mkrelease.sh to download libsng-ss7 and libsng-isdn, compile freetdm and mod_freetdm and test the ABI compatibility against older releases, through an external script, before generating the tarball. --- libs/freetdm/mkrelease.sh | 86 +++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 58d176119d..414542b349 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -29,11 +29,89 @@ then exit 1 fi +arch=$(uname -m) + +# defs +LIBSNG_ISDN_URL=ftp://ftp.sangoma.com/linux/libsng_isdn +LIBSNG_ISDN_NAME=libsng_isdn-7-current +LIBSNG_SS7_URL=ftp://ftp.sangoma.com/linux/libsng_ss7 +LIBSNG_SS7_NAME=libsng_ss7-3-current +LIBSNG_ISDN_DIR="$LIBSNG_ISDN_NAME.$arch" +LIBSNG_SS7_DIR="$LIBSNG_SS7_NAME.$arch" + +# download and decompress a tarball +# $1 = prefix_url, such as ftp://ftp.sangoma.com/foo/bar +# $2 = package name, such as libsng_isdn-7.0.0.x86_64 +function download() { + wget $1/$2.tgz + if [ $? = 0 ] + then + tardir=$(tar -tf $2.tgz | head -n1 | sed 's,\/,,g') + tar -xvzf $2.tgz || echo "FAILED to decompress $2.tgz" + if [ "$tardir" != "$2" ] + then + mv $tardir $2 || echo "FAILED to move $tardir to $2" + fi + echo "SUCCESSFULLY downloaded $2" + else + echo "FAILED to download $1/$2.tgz" + fi +} + +# download and build libsng-ss7 +fullname="$LIBSNG_ISDN_NAME.$arch" +if [ -d $fullname ] +then + echo "skipping isdn download since $fullname directory already exists ... remove if you want this step to be performed" +else + download $LIBSNG_ISDN_URL $fullname +fi + +cd $LIBSNG_ISDN_DIR +make DESTDIR=$INSTALLPREFIX install || echo "Failed to build libsng-isdn" +cd .. + +# download and build libsng-ss7 +fullname="$LIBSNG_SS7_NAME.$arch" +if [ -d $fullname ] +then + echo "skipping ss7 download since $fullname directory already exists ... remove if you want this step to be performed" +else + download $LIBSNG_SS7_URL $fullname +fi + +cd $LIBSNG_SS7_DIR +make DESTDIR=$INSTALLPREFIX install || echo "Failed to build libsng-ss7" +cd .. + if [ ! -d $INSTALLPREFIX ] then mkdir -p $INSTALLPREFIX || exit 1 fi +# attempt to compile freetdm +echo "Build freetdm and mod_freetdm now..." +make all mod_freetdm || exit 1 +echo "freetdm built OK" + +major=$(echo "$VERSION" | cut -d. -f1) +minor=$(echo "$VERSION" | cut -d. -f2) +micro=$(echo "$VERSION" | cut -d. -f3) +release="freetdm-$VERSION" + +# ABI compatibility check +if [ -x /usr/local/bin/ftdm_abi_check.py ]; then + /usr/local/bin/ftdm_abi_check.py $major + if [ $? -ne 0 ]; then + echo "ABI compabitility test failed, not creating release. Either increment the major version number or fix the interface." + exit 1 + fi +else + echo -ne "\n\nWARNING: /usr/local/bin/abi_check.py not found, skipping ABI compatibility test\n\n" +fi + +# clean the source tree +rm -rf $LIBSNG_ISDN_DIR $LIBSNG_SS7_DIR make clean make mod_freetdm-clean if [ $NODOCS = "NO" ] @@ -41,13 +119,7 @@ then make dox || exit 1 fi -major=$(echo "$VERSION" | cut -d. -f1) -minor=$(echo "$VERSION" | cut -d. -f2) -micro=$(echo "$VERSION" | cut -d. -f3) -release="freetdm-$VERSION" - -echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... press any key to continue" -read +echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... " mkdir -p $INSTALLPREFIX/$release