aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-asterisk
diff options
context:
space:
mode:
authorFabio Berton <fabio.berton@ossystems.com.br>2015-09-30 21:29:34 -0300
committerFabio Berton <fabio.berton@ossystems.com.br>2015-10-15 13:27:57 -0300
commit1464800759840509d5b2094b6b408575a6de59fb (patch)
treed4f5c5c44608b0d2ebcc5e416d7f08f5f94fa10f /recipes-asterisk
parent97676796f729efd1c847ff65da9a5076ab0a8cbb (diff)
asterisk: Add recipe
Asterisk is an Open Source PBX and telephony toolkit. Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
Diffstat (limited to 'recipes-asterisk')
-rw-r--r--recipes-asterisk/asterisk/asterisk_13.5.0.bb155
-rw-r--r--recipes-asterisk/asterisk/files/0001-Use-pkgconfig-to-find-sdl.patch26
-rw-r--r--recipes-asterisk/asterisk/files/0002-Use-pkgconfig-to-find-libxml2.patch73
-rw-r--r--recipes-asterisk/asterisk/files/asterisk.init.d150
4 files changed, 404 insertions, 0 deletions
diff --git a/recipes-asterisk/asterisk/asterisk_13.5.0.bb b/recipes-asterisk/asterisk/asterisk_13.5.0.bb
new file mode 100644
index 0000000..c912b3d
--- /dev/null
+++ b/recipes-asterisk/asterisk/asterisk_13.5.0.bb
@@ -0,0 +1,155 @@
+DESCRIPTION = "Asterisk is an Open Source PBX and telephony toolkit."
+HOMEPAGE = "http://www.asterisk.org/"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3aa955c628d43053f8ba9569d173105a"
+
+DEPENDS += "jansson sqlite3 libedit alsa-lib util-linux"
+
+SRC_URI = "\
+ http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${PV}.tar.gz \
+ file://0001-Use-pkgconfig-to-find-sdl.patch \
+ file://0002-Use-pkgconfig-to-find-libxml2.patch \
+ file://asterisk.init.d \
+"
+
+SRC_URI[md5sum] = "2fb7d247aacdbb9736c82b133053dfdf"
+SRC_URI[sha256sum] = "e8b8d071f783edea82de510194dd272070ffbb7cdb2f5f6b020be5d15b67e8b9"
+
+S = "${WORKDIR}/asterisk-${PV}"
+
+inherit autotools-brokensep pkgconfig useradd update-rc.d
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM_${PN} = "--system -g asterisk --shell /bin/false asterisk"
+GROUPADD_PARAM_${PN} = "--system asterisk"
+
+PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'largefile', 'largefile', '', d)}"
+# Optional features
+PACKAGECONFIG[dev-mode] = "--enable-dev-mode,--disable-dev-mode"
+PACKAGECONFIG[coverage] = "--enable-coverage,--disable-coverage"
+PACKAGECONFIG[xmldoc] = "--enable-xmldoc,--disable-xmldoc"
+PACKAGECONFIG[largefile] = "--enable-largefile,--disable-largefile"
+PACKAGECONFIG[internal-poll] = "--enable-internal-poll,--disable-internal-poll"
+PACKAGECONFIG[asteriskssl] = "--enable-asteriskssl,--disable-asteriskssl,openssl"
+PACKAGECONFIG[rpath] = "--enable-rpath,--disable-rpath"
+# Optional packages
+PACKAGECONFIG[bfd] = "--with-bfd,--without-bfd"
+PACKAGECONFIG[bluetooth] = "--with-bluetooth,--without-bluetooth,bluez5"
+PACKAGECONFIG[backtrace] = "--with-execinfo,--without-execinfo"
+PACKAGECONFIG[cap] = "--with-cap,--without-cap,libcap"
+PACKAGECONFIG[corosync] = "--with-cpg,--without-cpg,corosync"
+PACKAGECONFIG[curses] = "--with-curses,--without-curses,ncurses"
+PACKAGECONFIG[crypt] = "--with-crypt,--without-crypt"
+PACKAGECONFIG[crypto] = "--with-crypto,--without-crypto"
+PACKAGECONFIG[dahdi] = "--with-dahdi,--without-dahdi,dahdi-tools"
+# To enable FFMPEG add LICENSE_FLAGS_WHITELIST = "commercial" to your local.conf
+PACKAGECONFIG[ffmpeg] = "--with-avcodec,--without-avcodec,libav"
+PACKAGECONFIG[gsm] = "--with-gsm,--without-gsm,libgsm"
+PACKAGECONFIG[ilbc] = "--with-ilbc,--without-ilbc"
+PACKAGECONFIG[gtk2] = "--with-gtk2,--without-gtk2,gtk+"
+PACKAGECONFIG[gmime] = "--with-gmime,--without-gmime"
+PACKAGECONFIG[openh323] = "--with-h323,--without-h323"
+PACKAGECONFIG[hoard] = "--with-hoard,--without-hoard"
+PACKAGECONFIG[ical] = "--with-ical,--without-ical"
+PACKAGECONFIG[iconv] = "--with-iconv,--without-iconv,libiconv"
+PACKAGECONFIG[iksemel] = "--with-iksemel,--without-iksemel,iksemel"
+PACKAGECONFIG[imap_tk] = "--with-imap,--without-imap,uw-imap"
+PACKAGECONFIG[inotify] = "--with-inotify,--without-inotify"
+PACKAGECONFIG[iodbc] = "--with-iodbc,--without-iodbc"
+PACKAGECONFIG[isdnnet] = "--with-isdnnet,--without-isdnnet"
+# Jack depends on kqeueu
+PACKAGECONFIG[jack] = "--with-jack,--without-jack,jack"
+PACKAGECONFIG[uriparser] = "--with-uriparser,--without-uriparser"
+PACKAGECONFIG[kqueue] = "--with-kqueue,--without-kqueue"
+PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
+PACKAGECONFIG[libcurl] = "--with-libcurl,--without-libcurl,curl"
+PACKAGECONFIG[libxml2] = "--with-libxml2,--without-libxml2,libxml2"
+PACKAGECONFIG[libxslt] = "--with-libxslt,--without-libxslt,libxslt"
+PACKAGECONFIG[ltdl] = "--with-ltdl,--without-ltdl,libtool"
+PACKAGECONFIG[lua] = "--with-lua,--without-lua,lua"
+PACKAGECONFIG[misdn] = "--with-misdn,--without-misdn,misdn-utils"
+PACKAGECONFIG[mysqlclient] = "--with-mysqlclient,--without-mysqlclient,mariadb"
+PACKAGECONFIG[nbs] = "--with-nbs,--without-nbs"
+PACKAGECONFIG[ncurses] = "--with-curses,--without-curses,ncurses"
+PACKAGECONFIG[neon] = "--with-neon,--without-neon,neon"
+PACKAGECONFIG[netsnmp] = "--with-netsnmp,--without-netsnmp,net-snmp"
+PACKAGECONFIG[newt] = "--with-newt,--without-newt,libnewt"
+PACKAGECONFIG[ogg] = "--with-ogg,--without-ogg,libogg"
+PACKAGECONFIG[openr2] = "--with-openr2,--without-openr2"
+PACKAGECONFIG[opus] = "--with-opus,--without-opus,libopus"
+PACKAGECONFIG[osptk] = "--with-osptk,--without-osptk"
+PACKAGECONFIG[oss] = "--with-oss,--without-oss,alsa-oss"
+PACKAGECONFIG[pgsql] = "--with-postgres,--without-postgres,postgresql"
+PACKAGECONFIG[pjproject] = "--with-pjproject,--without-pjproject,pjproject"
+PACKAGECONFIG[popt] = "--with-popt,--without-popt,popt"
+PACKAGECONFIG[portaudio] = "--with-portaudio,--without-portaudio,portaudio-v19"
+PACKAGECONFIG[pri] = "--with-pri,--without-pri,misdn-utils"
+PACKAGECONFIG[pwlib] = "--with-pwlib,--without-pwlib,pwlib"
+PACKAGECONFIG[radius] = "--with-radius,--without-radius,radiusclient-ng"
+PACKAGECONFIG[resample] = "--with-resample,--without-resample,ncurses"
+# Need to enable sdl_images to use sdl
+PACKAGECONFIG[sdl] = "--with-sdl,--without-sdl,libsdl"
+PACKAGECONFIG[sdl_image] = "--with-SDL_image,--without-SDL_image,libsdl-image"
+PACKAGECONFIG[sounds-cache] = "--with-sounds-cache,--without-sounds-cache"
+PACKAGECONFIG[spandsp] = "--with-spandsp,--without-spandsp"
+PACKAGECONFIG[ss7] = "--with-ss7,--without-ss7"
+PACKAGECONFIG[speex] = "--with-speex,--without-speex,speex"
+PACKAGECONFIG[speexdsp] = "--with-speexdsp,--without-speexdsp,speexdsp"
+PACKAGECONFIG[srtp] = "--with-srtp,--without-srtp"
+PACKAGECONFIG[openssl] = "--with-ssl,--without-ssl,openssl"
+PACKAGECONFIG[suppserv] = "--with-suppserv,--without-suppserv,misdn-utils"
+PACKAGECONFIG[freetds] = "--with-tds,--without-tds"
+PACKAGECONFIG[termcap] = "--with-termcap,--without-termcap,libcap"
+PACKAGECONFIG[timerfd] = "--with-timerfd,--without-timerfd"
+PACKAGECONFIG[tinfo] = "--with-tinfo,--without-tinfo,ncurses"
+PACKAGECONFIG[tonezone] = "--with-tonezone,--without-tonezone"
+PACKAGECONFIG[unixodbc] = "--with-unixodbc,--without-unixodbc,libodbc"
+PACKAGECONFIG[vorbis] = "--with-vorbis,--without-vorbis,libvorbis"
+PACKAGECONFIG[vpb] = "--with-vpb,--without-vpb"
+PACKAGECONFIG[x11] = "--with-x11,--without-x11,libx11"
+PACKAGECONFIG[zlib] = "--with-z,--without-z,zlib"
+
+EXTRA_OECONF += " \
+ --with-libedit=${STAGING_INCDIR} \
+"
+
+INITSCRIPT_NAME = "asterisk"
+INITSCRIPT_PARAMS = "defaults"
+
+do_configure_append() {
+ echo "Regenerate the configure scripts"
+ for d in ${S}/menuselect; do
+ echo " - $d"
+ (cd $d; autoreconf -I ${S}/autoconf)
+ done
+
+ echo "Starting the build of menuselect"
+ cd ${B}/menuselect
+ CC="${HOST_CC}" \
+ CXX="${HOST_CXX}" \
+ LD="" \
+ AR="" \
+ RANLIB="" \
+ CFLAGS="${HOST_CFLAGS}" \
+ LDFLAGS="${HOST_LDFLAGS}" \
+ ./configure
+}
+
+do_install_append() {
+ oe_runmake DESTDIR=${D} samples
+ install -Dm 0755 ${WORKDIR}/asterisk.init.d ${D}${sysconfdir}/init.d/asterisk
+ # Set file permissions and ownerships
+ chown -R root:asterisk ${D}${sysconfdir}/asterisk
+ chmod -R u=rwX,g=rwX,o= ${D}${sysconfdir}/asterisk
+ for x in spool run lib log; do
+ chown -R asterisk:asterisk ${D}${localstatedir}/${x}/asterisk
+ chmod -R u=rwX,g=rwX,o= ${D}${localstatedir}/${x}/asterisk
+ done
+}
+
+FILES_${PN} += "\
+ /run/asterisk \
+ ${datadir}/dahdi/* \
+ ${libdir}/hotplug/firmware \
+"
+FILES_${PN}-dbg += "${libdir}/*/*/.debug"
diff --git a/recipes-asterisk/asterisk/files/0001-Use-pkgconfig-to-find-sdl.patch b/recipes-asterisk/asterisk/files/0001-Use-pkgconfig-to-find-sdl.patch
new file mode 100644
index 0000000..a0cc4b2
--- /dev/null
+++ b/recipes-asterisk/asterisk/files/0001-Use-pkgconfig-to-find-sdl.patch
@@ -0,0 +1,26 @@
+Upstream-Status: Pending
+
+Subject: [PATCH 1/2] Use pkgconfig to find sdl
+Organization: O.S. Systems Software LTDA.
+
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 971f9bf..c371d19 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -2427,7 +2427,7 @@ AC_SUBST(PBX_IXJUSER)
+ AST_C_DEFINE_CHECK([MSG_NOSIGNAL], [MSG_NOSIGNAL], [sys/socket.h])
+ AST_C_DEFINE_CHECK([SO_NOSIGPIPE], [SO_NOSIGPIPE], [sys/socket.h])
+
+-AST_EXT_TOOL_CHECK([SDL], [sdl-config])
++AST_PKG_CONFIG_CHECK([SDL], [sdl])
+ AST_EXT_LIB_CHECK([SDL_IMAGE], [SDL_image], [IMG_Load], [SDL_image.h], [${SDL_LIB}], [${SDL_INCLUDE}])
+ AST_EXT_LIB_CHECK([FFMPEG], [avcodec], [sws_getContext], [ffmpeg/avcodec.h], [${PTHREAD_LIBS} -lz -lm], [${PTHREAD_CFLAGS}])
+
+--
+2.1.4
+
diff --git a/recipes-asterisk/asterisk/files/0002-Use-pkgconfig-to-find-libxml2.patch b/recipes-asterisk/asterisk/files/0002-Use-pkgconfig-to-find-libxml2.patch
new file mode 100644
index 0000000..f5c8d26
--- /dev/null
+++ b/recipes-asterisk/asterisk/files/0002-Use-pkgconfig-to-find-libxml2.patch
@@ -0,0 +1,73 @@
+Upstream-Status: Pending
+
+Subject: [PATCH 2/2] Use pkgconfig to find libxml2
+Organization: O.S. Systems Software LTDA.
+
+Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
+---
+ configure.ac | 12 +-----------
+ menuselect/configure.ac | 11 +++--------
+ 2 files changed, 4 insertions(+), 19 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index c371d19..17f0d2d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -575,17 +575,6 @@ if test "x$JANSSON_LIB" == "x"; then
+ AC_MSG_ERROR([*** JSON support not found (this typically means the libjansson development package is missing)])
+ fi
+
+-AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
+- [#include <libxml/tree.h>
+- #include <libxml/parser.h>],
+- [LIBXML_TEST_VERSION])
+-
+-if test "${PBX_LIBXML2}" != 1; then
+- AC_MSG_NOTICE(*** The Asterisk menuselect tool requires the 'libxml2' development package.)
+- AC_MSG_NOTICE(*** Please install the 'libxml2' development package.)
+- exit 1
+-fi
+-
+ AST_EXT_LIB_CHECK([URIPARSER], [uriparser], [uriParseUriA], [uriparser/Uri.h])
+
+ # Another mandatory item (unless it's explicitly disabled)
+@@ -1280,6 +1269,7 @@ PKG_PROG_PKG_CONFIG()
+
+
+ # do the package library checks now
++AST_PKG_CONFIG_CHECK([LIBXML2], [libxml-2.0])
+
+ AST_EXT_LIB_CHECK([ALSA], [asound], [snd_spcm_init], [alsa/asoundlib.h], [-lm -ldl])
+
+diff --git a/menuselect/configure.ac b/menuselect/configure.ac
+index 5989f5c..675113b 100644
+--- a/menuselect/configure.ac
++++ b/menuselect/configure.ac
+@@ -125,14 +125,6 @@ AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
+ AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h])
+ AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h])
+ AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h])
+-AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , ,
+- [#include <libxml/tree.h>
+- #include <libxml/parser.h>],
+- [LIBXML_TEST_VERSION])
+-
+-if test "${PBX_LIBXML2}" != 1; then
+- AC_MSG_ERROR([Could not find required 'Libxml2' development package])
+-fi
+
+ PBX_GTK2=0
+ AC_CHECK_TOOL(PKGCONFIG, pkg-config, No)
+@@ -146,6 +138,9 @@ AC_SUBST(PBX_GTK2)
+ AC_SUBST(GTK2_INCLUDE)
+ AC_SUBST(GTK2_LIB)
+
++PKG_PROG_PKG_CONFIG()
++AST_PKG_CONFIG_CHECK([LIBXML2], [libxml-2.0])
++
+ test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent"
+
+ AC_CONFIG_FILES([makeopts])
+--
+2.1.4
+
diff --git a/recipes-asterisk/asterisk/files/asterisk.init.d b/recipes-asterisk/asterisk/files/asterisk.init.d
new file mode 100644
index 0000000..631ce1d
--- /dev/null
+++ b/recipes-asterisk/asterisk/files/asterisk.init.d
@@ -0,0 +1,150 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: asterisk
+# Required-Start: $network $syslog $named $local_fs $remote_fs
+# Required-Stop: $network $syslog $named $local_fs $remote_fs
+# Should-Start: dahdi misdn lcr wanrouter mysql postgresql
+# Should-Stop: dahdi misdn lcr wanrouter mysql postgresql
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Asterisk PBX
+# Description: Asterisk Open Source PBX
+### END INIT INFO
+
+# Do NOT "set -e"
+
+log_daemon_msg() {
+ echo $*
+}
+
+log_end_msg() {
+ if [ $1 -eq 0 ]; then
+ success $*
+ else
+ failure $*
+ fi
+}
+
+log_failure_msg() {
+ echo $*
+}
+
+log_success_msg() {
+ echo $*
+}
+
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="Asterisk PBX"
+NAME=asterisk
+DAEMON=/usr/sbin/$NAME
+DAEMON_ARGS=""
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+CHROOT=/var/run/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+# LSB log_* functions
+. /etc/init.d/functions
+
+do_start()
+{
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+}
+
+do_stop()
+{
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
+ [ "$?" = 2 ] && return 2
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+do_reload() {
+ start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
+ return 0
+}
+
+#
+# Function that shows the daemon/service status
+#
+status_of_proc () {
+ local pid status
+
+ status=0
+ # pidof output null when no program is running, so no "2>/dev/null".
+ pid=`pidofproc $NAME` || status=$?
+ case $status in
+ 0)
+ echo "$DESC is running ($pid)."
+ exit 0
+ ;;
+ *)
+ echo "$DESC is not running." >&2
+ exit $status
+ ;;
+ esac
+}
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ reload)
+ log_daemon_msg "Reloading $DESC" "$NAME"
+ do_reload
+ log_end_msg $?
+ ;;
+ restart|force-reload)
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ status)
+ status_of_proc $DAEMON $NAME -p $PIDFILE && exit 0 || exit $?
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload|status}" >&2
+ exit 3
+ ;;
+esac
+
+:
+