SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "asterisk"

# SliTaz package receipt.

PACKAGE="asterisk"
VERSION="20.2.1"
CATEGORY="misc"
TAGS="telephony"
SHORT_DESC="Open Source PBX and telephony toolkit."
MAINTAINER="pascal.bellard@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://www.asterisk.org/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
EXTRA_SOURCE_FILES="rfc3951.txt"
WGET_URL="http://downloads.asterisk.org/pub/telephony/asterisk/releases/$TARBALL"

DEPENDS="alsa-lib attr bluez codec2 curl dahdi freetds iksemel jansson
    libcap libcomerr3 libedit libical libkrb5 libldap libmysqlclient
    libogg libpostgresqlclient libpri libsdl libsdl-image libssl
    libunixODBC libusb-compat libvorbis libxml2 lua nbs ncurses neon
    net-snmp newt openssl opus popt portaudio radiusclient-ng spandsp
    speex sqlite tiff util-linux-uuid zlib"
BUILD_DEPENDS="alsa-lib-dev autoconf automake bluez bluez-dev codec2-dev
    curl-dev dahdi-dev dahdi-linux dahdi-tools gmime gmime-dev 
    gtk+-dev iksemel iksemel-dev jack-audio-connection-kit-dev 
    jansson-dev libcap-dev libedit-dev libical-dev libpri-dev 
    libsdl-dev libsdl-image-dev libtool libvorbis-dev libxml2-dev 
    lua lua-dev mysql-dev nbs-dev ncurses-dev neon neon-dev net-snmp-dev 
    newt-dev openldap openldap-dev openssl-dev opus-dev popt-dev 
    portaudio-dev postgresql postgresql-dev radiusclient-ng 
    radiusclient-ng-dev speex-dev sqlite-dev unixODBC unixODBC-dev"

CONFIG_FILES="/etc/asterisk"

# What is the latest version available today?
current_version()
{
    wget -O - $WEB_SITE 2>/dev/null | \
    sed '/Available/!d;s|.*Asterisk ||;s|,* .*||;q'
}

# Rules to configure and make the package.
#
# Graphical configuration: 'make menuconfig' or 'make gmenuconfig'
#
compile_rules()
{
# according to https://issues.asterisk.org/jira/browse/ASTERISK-20576
# the message "Makefile:82: pjproject/build.mak: No such file or directory" is normal :-/
    sed -i 's/>no</>yes</' addons/[acor]*.c
    find * -name config.guess -o -name configure | xargs \
        sed -i "s/(uname -m)/(echo $ARCH)/"
    find * -name Makefile | xargs \
        sed -i "s/(shell uname -m)/(shell echo $ARCH)/"
    busybox sed -i 's/tar xof/tar xf/' sounds/Makefile
    busybox sed -i '/LOG_ERROR, "The file/ {nd}' main/config.c
    busybox sed -i 's/LOG_ERROR, "The file/LOG_WARNING, "The file/' \
        main/config.c
    busybox sed -i 's|lua5.1/||' pbx/pbx_lua.c
    grep -rsl '^#define AST_PBX_MAX_STACK' * | xargs busybox sed -i \
        's/define AST_PBX_MAX_STACK.*/define AST_PBX_MAX_STACK 1024/'
    while read url
      do
        [ -s $SOURCES_REPOSITORY/$(basename "$url") ] ||
            wget --no-check-certificate -P $SOURCES_REPOSITORY "$url"
      done <<EOT
http://www.ietf.org/rfc/rfc3951.txt                                            
EOT
    # suitable for 11.1.2
#https://github.com/meetecho/asterisk-opus/raw/master/asterisk_opus+vp8.diff
    # suitable for 11.8.1
#http://svn.code.sf.net/p/freetel/code/codec2/branches/0.5/asterisk-11/asterisk-11.8.1-codec2.patch                                                             
#http://svn.code.sf.net/p/freetel/code/codec2/branches/0.5/asterisk-11/asterisk-11.8.1-opus-codec2.patch                                                        

    cp $SOURCES_REPOSITORY/rfc3951.txt codecs/ilbc ||
    cp $stuff/rfc3951.txt codecs/ilbc
    [ -f codecs/ilbc/iLBC_define.h ] ||
    ( cd codecs/ilbc && awk -f $stuff/extract-cfile.awk rfc3951.txt > /dev/null )
    # suitable for 11.1.2
#    patch -p1 < $SOURCES_REPOSITORY/asterisk_opus+vp8.diff
    # suitable for 11.8.1
#    patch -p1 < $SOURCES_REPOSITORY/asterisk-11.8.1-opus-codec2.patch       

    mkdir -p $DESTDIR/usr/bin

    ./bootstrap.sh                                                          
    # 20.2.1 unrecognised:
    #    --without-pwlib
    ./configure                        \
        --prefix=/usr                    \
        --includedir=/usr/include            \
        --sysconfdir=/etc                \
        --with-dahdi=$WOK/dahdi/$(ls $WOK/dahdi/taz)    \
        --with-tonezone                    \
        $CONFIGURE_ARGS &&
    make            -j 1 2>&1 | grep -v pjproject &&
    make install        DESTDIR=$DESTDIR &&
    make install-headers    DESTDIR=$DESTDIR &&
    make samples        DESTDIR=$DESTDIR &&
    cd contrib/utils &&
    gcc rawplayer.c -o $DESTDIR/usr/bin/rawplayer
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/usr

    cp -a $install/etc        $fs
    cp -a $install/var        $fs
    cp -a $install/usr/lib        $fs/usr
    cp -a $install/usr/sbin        $fs/usr
    cp -a $stuff/*/            $fs
    rm -f                $fs/usr/lib/libasteriskssl.so
    ln -s libasteriskssl.so.1    $fs/usr/lib/libasteriskssl.so
}

# Rules to configure package
setup_rules()
{
    case "$2" in
    (mysql_host)
        sed -i "s|^hostname=.*|hostname=$3|" \
            "$1/etc/asterisk/cdr_mysql.conf"
        sed -i "s|^dbhost=.*|dbhost=$3|" \
            "$1/etc/asterisk/res_mysql.conf"
        ;;
    (mysql_user)
        sed -i "s|^user=.*|user=$3|" \
            "$1/etc/asterisk/cdr_mysql.conf"
        sed -i "s|^dbuser=.*|dbuser=$3|" \
            "$1/etc/asterisk/res_mysql.conf"
        ;;
    (mysql_password)
        sed -i "s|^password=.*|password=$3|" \
            "$1/etc/asterisk/cdr_mysql.conf"
        sed -i "s|^dbpass=.*|dbpass=$3|" \
            "$1/etc/asterisk/res_mysql.conf"
        ;;
    (mysql_database)
        sed -i "s|^dbname=.*|dbname=$3|" \
            "$1/etc/asterisk/res_mysql.conf" \
            "$1/etc/asterisk/cdr_mysql.conf"
        ;;
    (pgsql_host)
        sed -i "s|^hostname=.*|hostname=$3|" \
            "$1/etc/asterisk/cdr_pgsql.conf"
        sed -i "s|^dbhost=.*|dbhost=$3|" \
            "$1/etc/asterisk/res_pgsql.conf"
        ;;
    (pgsql_user)
        sed -i "s|^user=.*|user=$3|" \
            "$1/etc/asterisk/cdr_pgsql.conf"
        sed -i "s|^dbuser=.*|dbuser=$3|" \
            "$1/etc/asterisk/res_pgsql.conf"
        ;;
    (pgsql_password)
        sed -i "s|^password=.*|password=$3|" \
            "$1/etc/asterisk/cdr_pgsql.conf"
        sed -i "s|^dbpass=.*|dbpass=$3|" \
            "$1/etc/asterisk/res_pgsql.conf"
        ;;
    (pgsql_database)
        sed -i "s|^dbname=.*|dbname=$3|" \
            "$1/etc/asterisk/res_pgsql.conf" \
            "$1/etc/asterisk/cdr_pgsql.conf"
        ;;
    (*)    cat <<EOT
mysql_host    hostname or ip of mysql server
mysql_user    username to connect to mysql server
mysql_password    password to connect to mysql server
mysql_database    database used by asterisk
pgsql_host    hostname or ip of postgresql server
pgsql_user    username to connect to postgresql server
pgsql_password    password to connect to postgresql server
pgsql_database    database used by asterisk
EOT
        ;;
    esac
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)