asterisk-11.x: update to 11.22.0, fix several build issues
authorJiri Slachta <slachta@cesnet.cz>
Mon, 4 Apr 2016 13:27:09 +0000 (15:27 +0200)
committerJiri Slachta <slachta@cesnet.cz>
Mon, 4 Apr 2016 13:27:09 +0000 (15:27 +0200)
Within this commit asterisk has been upgraded to version 11.22.0.
Several build issues has also been fixed (thanks to musl fixes from
Alpine linux).

Signed-off-by: Jiri Slachta <slachta@cesnet.cz>
net/asterisk-11.x/Makefile
net/asterisk-11.x/patches/010-asterisk-configure-undef-res-ninit.patch
net/asterisk-11.x/patches/050-musl-glob-compat.patch [new file with mode: 0644]
net/asterisk-11.x/patches/051-musl-includes.patch [new file with mode: 0644]
net/asterisk-11.x/patches/052-musl-libcap.patch [new file with mode: 0644]
net/asterisk-11.x/patches/053-musl-mutex-init.patch [new file with mode: 0644]

index 72d790582528c1d7c28196d5ec1b7dce9e6525d5..62b55752132da1d084fae79906b3a9fa59435b47 100644 (file)
@@ -1,6 +1,6 @@
 #
-# Copyright (C) 2015 OpenWrt.org
-# Copyright (C) 2015 Cesnet, z.s.p.o.
+# Copyright (C) 2016 OpenWrt.org
+# Copyright (C) 2016 Cesnet, z.s.p.o.
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,14 +9,14 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=asterisk11
-PKG_VERSION:=11.20.0
+PKG_VERSION:=11.22.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=asterisk-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://downloads.asterisk.org/pub/telephony/asterisk/releases/
-PKG_MD5SUM:=d15759b05862250073e2708394ad2f4c
+PKG_MD5SUM:=35870c34fadbd2bcb284bd8521c6e689
 
-PKG_BUILD_DIR=$(BUILD_DIR)/asterisk-$(PKG_VERSION)
+PKG_BUILD_DIR:=$(BUILD_DIR)/asterisk-$(PKG_VERSION)
 PKG_BUILD_DEPENDS:=libxml2/host
 
 PKG_LICENSE:=GPL-2.0
@@ -271,7 +271,7 @@ CONFIGURE_ARGS+= \
        --without-vpb \
        --with-z="$(STAGING_DIR)/usr" \
        --with-sounds-cache="$(DL_DIR)" \
-       --disable-xmldoc 
+       --disable-xmldoc
 
 CONFIGURE_VARS += \
        ac_cv_path_ac_pt_CONFIG_LIBXML2=$(STAGING_DIR)/host/bin/xml2-config
@@ -279,8 +279,8 @@ CONFIGURE_VARS += \
 AST_MENUSELECT_OPTS = \
        --without-newt \
        --without-curses \
-       --with-ncurses="$(STAGING_DIR_HOST)/usr" \
-       --with-libxml2="$(STAGING_DIR_HOST)/usr"
+       --with-ncurses="$(STAGING_DIR)/host/usr" \
+       --with-libxml2="$(STAGING_DIR)/host/usr"
 
 define Build/Configure
        (cd $(PKG_BUILD_DIR); \
@@ -301,13 +301,13 @@ define Build/Configure
                $(HOST_CONFIGURE_ARGS) \
                $(AST_MENUSELECT_OPTS) \
                LDFLAGS="$(HOST_LDFLAGS) -lxml2" \
-               CFLAGS="$(HOST_CFLAGS) -I$(STAGING_DIR_HOST)/include/libxml2" \
+               CFLAGS="$(HOST_CFLAGS) -I$(STAGING_DIR)/host/include/libxml2" \
        );
 endef
 
 define Build/Compile
        $(MAKE) -C "$(PKG_BUILD_DIR)/menuselect" \
-               CFLAGS="$(HOST_CFLAGS) -I$(STAGING_DIR_HOST)/include/libxml2" \
+               CFLAGS="$(HOST_CFLAGS) -I$(STAGING_DIR)/host/include/libxml2" \
                LDFLAGS="$(HOST_LDFLAGS) -lxml2"
        $(MAKE) -C "$(PKG_BUILD_DIR)" include/asterisk/version.h \
                include/asterisk/buildopts.h defaults.h \
@@ -378,6 +378,16 @@ $(eval $(call BuildAsterisk11Module,app-while,While loop,a while loop implementa
 $(eval $(call BuildAsterisk11Module,cdr-csv,Provides CDR CSV,Call Detail Record with CSV support,,,,cdr_csv,))
 $(eval $(call BuildAsterisk11Module,cdr-sqlite3,Provides CDR SQLITE3,Call Detail Record with SQLITE3 support,libsqlite3,,,cdr_sqlite3_custom,))
 $(eval $(call BuildAsterisk11Module,cdr,Provides CDR,Call Detail Record,,/etc/asterisk/cdr.conf /etc/asterisk/cdr_custom.conf /etc/asterisk/cdr_manager.conf /etc/asterisk/cdr_syslog.conf,cdr cdr_custom cdr_manager cdr_syslog,app_cdr app_forkcdr cdr_custom cdr_manager cdr_syslog func_cdr,))
+$(eval $(call BuildAsterisk11Module,chan-alsa,ALSA channel,the channel chan_alsa,+alsa-lib,/etc/asterisk/alsa.conf,alsa.conf,chan_alsa,,))
+$(eval $(call BuildAsterisk11Module,chan-agent,Agents proxy channel,an implementation of agents proxy channel,,,,chan_agent,))
+$(eval $(call BuildAsterisk11Module,chan-dahdi,DAHDI channel,DAHDI channel support,+dahdi-tools-libtonezone +kmod-dahdi +libpri,/etc/asterisk/chan_dahdi.conf,chan_dahdi.conf,chan_dahdi,))
+$(eval $(call BuildAsterisk11Module,chan-iax2,IAX2 channel,IAX support,+asterisk11-res-timing-timerfd,/etc/asterisk/iax.conf /etc/asterisk/iaxprov.conf,iax.conf iaxprov.conf,chan_iax2,))
+$(eval $(call BuildAsterisk11Module,chan-mgcp,MGCP channel,the channel chan_mgcp,,/etc/asterisk/mgcp.conf,mgcp.conf,chan_mgcp,))
+$(eval $(call BuildAsterisk11Module,chan-motif,Jingle channel,Motif Jingle Channel Driver,+asterisk11-res-xmpp,/etc/asterisk/motif.conf /etc/asterisk/jingle.conf,motif.conf jingle.conf,chan_motif,))
+$(eval $(call BuildAsterisk11Module,chan-ooh323,ooH323 channel,the channel chan_ooh323,,/etc/asterisk/ooh323.conf,ooh323.conf,chan_ooh323,))
+$(eval $(call BuildAsterisk11Module,chan-oss,OSS channel,the channel chan_oss,,/etc/asterisk/oss.conf,oss.conf,chan_oss,,))
+$(eval $(call BuildAsterisk11Module,chan-skinny,Skinny channel,the channel chan_skinny,,/etc/asterisk/skinny.conf,skinny.conf,chan_skinny,))
+$(eval $(call BuildAsterisk11Module,chan-unistim,Unistim channel,channel driver for the UNISTIM (Unified Networks IP Stimulus) protocol,,/etc/asterisk/unistim.conf,unistim.conf,chan_unistim,))
 $(eval $(call BuildAsterisk11Module,codec-a-mu,Alaw to ulaw translation,translation between alaw and ulaw codecs,,,,codec_a_mu,))
 $(eval $(call BuildAsterisk11Module,codec-adpcm,ADPCM text,ADPCM text ,,,,codec_adpcm,))
 $(eval $(call BuildAsterisk11Module,codec-alaw,Signed linear to alaw translation,translation between signed linear and alaw codecs,,,,codec_alaw,))
@@ -416,14 +426,6 @@ $(eval $(call BuildAsterisk11Module,func-shell,Shell,support for shell execution
 $(eval $(call BuildAsterisk11Module,func-uri,URI encoding and decoding,Encodes and decodes URI-safe strings,,,,func_uri,))
 $(eval $(call BuildAsterisk11Module,func-vmcount,vmcount dialplan,a vmcount dialplan function,,,,func_vmcount,))
 $(eval $(call BuildAsterisk11Module,func-realtime,realtime dialplan,the realtime dialplan function,,,,func_realtime,))
-$(eval $(call BuildAsterisk11Module,chan-agent,Agents proxy channel,an implementation of agents proxy channel,,,,chan_agent,))
-$(eval $(call BuildAsterisk11Module,chan-dahdi,DAHDI channel,DAHDI channel support,+dahdi-tools-libtonezone +kmod-dahdi +libpri,/etc/asterisk/chan_dahdi.conf,chan_dahdi.conf,chan_dahdi,))
-$(eval $(call BuildAsterisk11Module,chan-iax2,IAX2 channel,IAX support,+asterisk11-res-timing-timerfd,/etc/asterisk/iax.conf /etc/asterisk/iaxprov.conf,iax.conf iaxprov.conf,chan_iax2,))
-$(eval $(call BuildAsterisk11Module,chan-mgcp,MGCP channel,the channel chan_mgcp,,/etc/asterisk/mgcp.conf,mgcp.conf,chan_mgcp,))
-$(eval $(call BuildAsterisk11Module,chan-motif,Jingle channel,Motif Jingle Channel Driver,+asterisk11-res-xmpp,/etc/asterisk/motif.conf /etc/asterisk/jingle.conf,motif.conf jingle.conf,chan_motif,))
-$(eval $(call BuildAsterisk11Module,chan-ooh323,ooH323 channel,the channel chan_ooh323,,/etc/asterisk/ooh323.conf,ooh323.conf,chan_ooh323,))
-$(eval $(call BuildAsterisk11Module,chan-skinny,Skinny channel,the channel chan_skinny,,/etc/asterisk/skinny.conf,skinny.conf,chan_skinny,))
-$(eval $(call BuildAsterisk11Module,chan-unistim,Unistim channel,channel driver for the UNISTIM (Unified Networks IP Stimulus) protocol,,/etc/asterisk/unistim.conf,unistim.conf,chan_unistim,))
 $(eval $(call BuildAsterisk11Module,mysql,MySQL,MySQL support,+libmysqlclient,/etc/asterisk/res_config_mysql.conf,res_config_mysql.conf,res_config_mysql,))
 $(eval $(call BuildAsterisk11Module,odbc,ODBC,ODBC support,+libpthread +libc +unixodbc,/etc/asterisk/cdr_adaptive_odbc.conf /etc/asterisk/cdr_odbc.conf /etc/asterisk/cel_odbc.conf /etc/asterisk/func_odbc.conf /etc/asterisk/res_odbc.conf,cdr_adaptive_odbc cdr_odbc cel_odbc func_odbc res_odbc,cdr_adaptive_odbc cdr_odbc cel_odbc func_odbc res_config_odbc res_odbc,))
 $(eval $(call BuildAsterisk11Module,pbx-ael,Asterisk Extension Logic,support for symbolic Asterisk Extension Logic,,,extensions.ael,pbx_ael,))
index b8a633725a70669864a46e8223049a81ff3b0c00..90259083d4ed13811504ffc39188a3f2219cdc78 100644 (file)
@@ -1,6 +1,6 @@
 --- a/configure.ac
 +++ b/configure.ac
-@@ -1111,7 +1111,6 @@ AC_LINK_IFELSE(
+@@ -1175,7 +1175,6 @@ AC_LINK_IFELSE(
                        #include <resolv.h>],
                        [int foo = res_ninit(NULL);])],
        AC_MSG_RESULT(yes)
diff --git a/net/asterisk-11.x/patches/050-musl-glob-compat.patch b/net/asterisk-11.x/patches/050-musl-glob-compat.patch
new file mode 100644 (file)
index 0000000..429babb
--- /dev/null
@@ -0,0 +1,31 @@
+--- asterisk-11.7.0.orig/res/ael/ael.flex
++++ asterisk-11.7.0/res/ael/ael.flex
+@@ -79,6 +79,12 @@
+ #if !defined(GLOB_ABORTED)
+ #define GLOB_ABORTED GLOB_ABEND
+ #endif
++#if !defined(GLOB_BRACE)
++#define GLOB_BRACE 0
++#endif
++#if !defined(GLOB_NOMAGIC)
++#define GLOB_NOMAGIC 0
++#endif
+ #include "asterisk/logger.h"
+ #include "asterisk/utils.h"
+Only in asterisk-11.7.0: res/ael/ael.tab.o
+--- asterisk-11.7.0.orig/res/ael/ael_lex.c
++++ asterisk-11.7.0/res/ael/ael_lex.c
+@@ -838,6 +838,12 @@
+ #if !defined(GLOB_ABORTED)
+ #define GLOB_ABORTED GLOB_ABEND
+ #endif
++#if !defined(GLOB_BRACE)
++#define GLOB_BRACE 0
++#endif
++#if !defined(GLOB_NOMAGIC)
++#define GLOB_NOMAGIC 0
++#endif
+ #include "asterisk/logger.h"
+ #include "asterisk/utils.h"
diff --git a/net/asterisk-11.x/patches/051-musl-includes.patch b/net/asterisk-11.x/patches/051-musl-includes.patch
new file mode 100644 (file)
index 0000000..a45f710
--- /dev/null
@@ -0,0 +1,46 @@
+diff -ru asterisk-13.0.0.orig/include/asterisk/compat.h asterisk-13.0.0/include/asterisk/compat.h
+--- asterisk-13.0.0.orig/include/asterisk/compat.h     2014-10-31 08:48:56.000000000 -0200
++++ asterisk-13.0.0/include/asterisk/compat.h  2014-10-31 08:49:10.163808393 -0200
+@@ -68,7 +68,7 @@
+ #endif
+ #ifndef AST_POLL_COMPAT
+-#include <sys/poll.h>
++#include <poll.h>
+ #else
+ #include "asterisk/poll-compat.h"
+ #endif
+diff -ru asterisk-13.0.0.orig/include/asterisk/poll-compat.h asterisk-13.0.0/include/asterisk/poll-compat.h
+--- asterisk-13.0.0.orig/include/asterisk/poll-compat.h        2014-10-31 08:48:56.000000000 -0200
++++ asterisk-13.0.0/include/asterisk/poll-compat.h     2014-10-31 08:49:10.163808393 -0200
+@@ -83,7 +83,7 @@
+ #ifndef AST_POLL_COMPAT
+-#include <sys/poll.h>
++#include <poll.h>
+ #define ast_poll(a, b, c) poll(a, b, c)
+diff -ru asterisk-13.0.0.orig/main/ast_expr2.c asterisk-13.0.0/main/ast_expr2.c
+--- asterisk-13.0.0.orig/main/ast_expr2.c      2014-10-31 08:48:56.000000000 -0200
++++ asterisk-13.0.0/main/ast_expr2.c   2014-10-31 08:49:10.163808393 -0200
+@@ -93,6 +93,7 @@
+ #include "asterisk.h"
++#include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <stdio.h>
+diff -ru asterisk-13.0.0.orig/main/ast_expr2.y asterisk-13.0.0/main/ast_expr2.y
+--- asterisk-13.0.0.orig/main/ast_expr2.y      2014-10-31 08:48:56.000000000 -0200
++++ asterisk-13.0.0/main/ast_expr2.y   2014-10-31 08:49:10.163808393 -0200
+@@ -14,6 +14,7 @@
+ #include "asterisk.h"
++#include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <stdio.h>
diff --git a/net/asterisk-11.x/patches/052-musl-libcap.patch b/net/asterisk-11.x/patches/052-musl-libcap.patch
new file mode 100644 (file)
index 0000000..6bd37cc
--- /dev/null
@@ -0,0 +1,39 @@
+diff -rupN asterisk-11.22.0/configure.ac ast11/configure.ac
+--- asterisk-11.22.0/configure.ac      2016-04-04 14:23:46.141373501 +0200
++++ ast11/configure.ac 2016-04-04 14:22:35.168787508 +0200
+@@ -181,6 +181,9 @@ case "${host_os}" in
+      linux-gnueabi* |  linux-gnuspe)
+      OSARCH=linux-gnu
+      ;;
++     linux-musl*)
++     OSARCH=linux-musl
++     ;;
+      kfreebsd*-gnu)
+      OSARCH=kfreebsd-gnu
+      ;;
+@@ -1285,9 +1288,11 @@ if test "${PBX_BFD}" = "0"; then
+   AST_EXT_LIB_CHECK([BFD], [bfd], [bfd_check_format], [bfd.h], [-ldl -liberty -lz])
+ fi
+-if test "x${OSARCH}" = "xlinux-gnu" ; then
++case "${OSARCH}" in
++linux*)
+   AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h])
+-fi
++  ;;
++esac
+ AST_C_DEFINE_CHECK([DAHDI], [DAHDI_RESET_COUNTERS], [dahdi/user.h], [230])
+ AST_C_DEFINE_CHECK([DAHDI], [DAHDI_DEFAULT_MTU_MRU], [dahdi/user.h], [220])
+diff -rupN asterisk-11.22.0/main/Makefile ast11/main/Makefile
+--- asterisk-11.22.0/main/Makefile     2016-03-29 21:25:17.000000000 +0200
++++ ast11/main/Makefile        2016-04-04 14:22:35.164787476 +0200
+@@ -37,7 +37,7 @@ AST_LIBS+=$(SQLITE3_LIB)
+ AST_LIBS+=$(ASTSSL_LIBS)
+ AST_LIBS+=$(AST_CLANG_BLOCKS_LIBS)
+-ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc kfreebsd-gnu),)
++ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc linux-musl kfreebsd-gnu),)
+   ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),)
+   AST_LIBS+=-ldl
+   endif
diff --git a/net/asterisk-11.x/patches/053-musl-mutex-init.patch b/net/asterisk-11.x/patches/053-musl-mutex-init.patch
new file mode 100644 (file)
index 0000000..ecb104f
--- /dev/null
@@ -0,0 +1,12 @@
+diff -ru asterisk-12.4.0.orig/include/asterisk/lock.h asterisk-12.4.0/include/asterisk/lock.h
+--- asterisk-12.4.0.orig/include/asterisk/lock.h       2013-11-02 06:05:24.000000000 -0200
++++ asterisk-12.4.0/include/asterisk/lock.h    2014-08-04 16:00:29.811967599 -0300
+@@ -65,7 +65,7 @@
+ #define AST_PTHREADT_NULL (pthread_t) -1
+ #define AST_PTHREADT_STOP (pthread_t) -2
+-#if (defined(SOLARIS) || defined(BSD))
++#if (defined(SOLARIS) || defined(BSD) || !defined(HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP))
+ #define AST_MUTEX_INIT_W_CONSTRUCTORS
+ #endif /* SOLARIS || BSD */