From a75e6feb7cbd28e93abe95b9bdb0b5c86a9f6532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 6 Aug 2014 09:17:51 +0300 Subject: main/asterisk: various fixes and clean ups - remove unused uclibc patches - fix libcap with musl - enable iconv as it is built into musl - import mp3 addon as patch instead of svn checkout - update ASTERISK-23818 patch from upstream --- main/asterisk/100-uclibc-daemon.patch | 46 ----------------------------- main/asterisk/101-caps-uclibc.patch | 17 ----------- main/asterisk/102-gsm-pic.patch | 54 ----------------------------------- main/asterisk/APKBUILD | 38 +++++++++++------------- main/asterisk/ASTERISK-23818.patch | 25 ++++++++++++---- main/asterisk/musl-libcap.patch | 41 ++++++++++++++++++++++++++ 6 files changed, 76 insertions(+), 145 deletions(-) delete mode 100644 main/asterisk/100-uclibc-daemon.patch delete mode 100644 main/asterisk/101-caps-uclibc.patch delete mode 100644 main/asterisk/102-gsm-pic.patch create mode 100644 main/asterisk/musl-libcap.patch (limited to 'main') diff --git a/main/asterisk/100-uclibc-daemon.patch b/main/asterisk/100-uclibc-daemon.patch deleted file mode 100644 index f3c6053501..0000000000 --- a/main/asterisk/100-uclibc-daemon.patch +++ /dev/null @@ -1,46 +0,0 @@ ---- asterisk-11.2.1-orig/main/asterisk.c -+++ asterisk-11.2.1/main/asterisk.c -@@ -3891,11 +3891,41 @@ - #if HAVE_WORKING_FORK - if (ast_opt_always_fork || !ast_opt_no_fork) { - #ifndef HAVE_SBIN_LAUNCHD -+#ifndef __UCLIBC__ - if (daemon(1, 0) < 0) { - fprintf(stderr, "daemon() failed: %s\n", strerror(errno)); -- } else { -- ast_mainpid = getpid(); - } -+#else -+ /* -+ * workaround for uClibc-0.9.29 mipsel bug: -+ * recursive mutexes do not work if uClibc daemon() function has been called, -+ * if parent thread locks a mutex -+ * the child thread cannot acquire a lock with the same name -+ * (same code works if daemon() is not called) -+ * but duplication of uClibc daemon.c code in here does work. -+ */ -+ int fd; -+ switch (fork()) { -+ case -1: -+ exit(1); -+ case 0: -+ break; -+ default: -+ _exit(0); -+ } -+ if (setsid() == -1) -+ exit(1); -+ if (fork()) -+ _exit(0); -+ if ((fd = open("/dev/null", O_RDWR, 0)) != -1) { -+ dup2(fd, STDIN_FILENO); -+ dup2(fd, STDOUT_FILENO); -+ dup2(fd, STDERR_FILENO); -+ if (fd > 2) -+ close(fd); -+ } -+#endif -+ ast_mainpid = getpid(); - #else - fprintf(stderr, "Mac OS X detected. Use 'launchctl load /Library/LaunchDaemon/org.asterisk.asterisk.plist'.\n"); - #endif diff --git a/main/asterisk/101-caps-uclibc.patch b/main/asterisk/101-caps-uclibc.patch deleted file mode 100644 index bb32d1ece1..0000000000 --- a/main/asterisk/101-caps-uclibc.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- asterisk-1.6.0.18/configure.ac.orig Mon Oct 26 23:13:28 2009 -+++ asterisk-1.6.0.18/configure.ac Fri Nov 27 21:42:36 2009 -@@ -627,9 +627,11 @@ - - AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h]) - --if test "x${OSARCH}" = "xlinux-gnu" ; then -- AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h]) --fi -+case "${OSARCH}" in -+ linux*) -+ AST_EXT_LIB_CHECK([CAP], [cap], [cap_from_text], [sys/capability.h]) -+ ;; -+esac - - AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h]) - diff --git a/main/asterisk/102-gsm-pic.patch b/main/asterisk/102-gsm-pic.patch deleted file mode 100644 index 71370ec0b7..0000000000 --- a/main/asterisk/102-gsm-pic.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- a/codecs/gsm/Makefile.org 2008-03-29 11:33:09.000000000 +0100 -+++ b/codecs/gsm/Makefile 2008-03-29 11:44:40.000000000 +0100 -@@ -37,23 +37,6 @@ - ######### ppro's, etc, as well as the AMD K6 and K7. The compile will - ######### probably require gcc. - --ifeq (, $(findstring $(OSARCH) , Darwin SunOS )) --ifeq (, $(findstring $(PROC) , x86_64 amd64 ultrasparc sparc64 arm armv5b armeb ppc powerpc ppc64 ia64 s390 bfin mipsel mips)) --ifeq (, $(findstring $(shell uname -m) , ppc ppc64 alpha armv4l s390 )) --OPTIMIZE+=-march=$(PROC) --endif --endif --endif -- --#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only. --#This works for even old (2.96) versions of gcc and provides a small boost either way. --#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesn't support it. --#So we go lowest common available by gcc and go a step down, still a step up from --#the default as we now have a better instruction set to work with. - Belgarath --ifeq ($(PROC),ultrasparc) --OPTIMIZE+=-mcpu=v8 -mtune=$(PROC) -O3 --endif -- - PG = - #PG = -g -pg - ######### Profiling flags. If you don't know what that means, leave it blank. -@@ -208,12 +191,10 @@ - # XXX Keep a space after each findstring argument - # XXX should merge with GSM_OBJECTS - ifeq ($(OSARCH),linux-gnu) --ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc s390 )) --ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 s390 bfin mipsel mips )) -+ifneq ($(K6OPT),) - GSM_SOURCES+= $(SRC)/k6opt.s - endif - endif --endif - - TOAST_SOURCES = $(SRC)/toast.c \ - $(SRC)/toast_lin.c \ -@@ -260,12 +241,10 @@ - $(SRC)/table.o - - ifeq ($(OSARCH),linux-gnu) --ifeq (,$(findstring $(shell uname -m) , x86_64 amd64 ppc ppc64 alpha armv4l sparc64 parisc )) --ifeq (,$(findstring $(PROC) , arm armv5b armeb powerpc ia64 bfin mipsel mips )) -+ifneq ($(K6OPT),) - GSM_OBJECTS+= $(SRC)/k6opt.o - endif - endif --endif - - TOAST_OBJECTS = $(SRC)/toast.o \ - $(SRC)/toast_lin.o \ diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD index bf0f390ce1..cb1a7cf49e 100644 --- a/main/asterisk/APKBUILD +++ b/main/asterisk/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teras pkgname=asterisk pkgver=12.4.0 -pkgrel=6 +pkgrel=7 pkgdesc="Asterisk: A Module Open Source PBX System" pkgusers="asterisk" pkggroups="asterisk" @@ -14,7 +14,7 @@ makedepends="autoconf automake libtool tar wget ncurses-dev popt-dev newt-dev zlib-dev pjproject-dev jansson-dev libedit-dev dahdi-tools-dev libpri-dev sqlite-dev postgresql-dev unixodbc-dev freetds-dev openssl-dev lua-dev alsa-lib-dev spandsp-dev tiff-dev libresample speex-dev libogg-dev - bluez-dev curl-dev libsrtp-dev util-linux-dev mysql-dev subversion" + bluez-dev curl-dev libsrtp-dev util-linux-dev mysql-dev" install="$pkgname.pre-install $pkgname.pre-upgrade" subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-pgsql $pkgname-odbc $pkgname-tds $pkgname-fax $pkgname-sample-config:sample @@ -26,17 +26,16 @@ _download="http://downloads.asterisk.org/pub/telephony/asterisk/releases" _z=${pkgver##*.} _xy=${pkgver%.$_z} _patches="" -# Do not apply the .1 security patch. Upstream made 12.3.2-patch.gz -# special and is against 12.3.0 against policy. -while [ $_z -gt 1 ]; do +while [ $_z -gt 0 ]; do _patches="$_download/asterisk-$_xy.$_z-patch.gz $_patches" _z=$((_z-1)) done source="$_download/asterisk-$_xy.0.tar.gz $_patches - 100-uclibc-daemon.patch - 101-caps-uclibc.patch + asterisk-addon-mp3-r201.patch.gz + + musl-libcap.patch musl-includes.patch musl-glob-compat.patch musl-outofmem-handling.patch @@ -61,19 +60,15 @@ prepare() { for i in $source; do case $i in *.patch) msg "$i"; patch -p1 -i "$srcdir"/$i || return 1;; - *-patch.gz) msg "${i##*/}"; gunzip < "$srcdir"/${i##*/} | patch -p0 || return 1;; + *patch.gz) msg "${i##*/}"; gunzip < "$srcdir"/${i##*/} | patch -p0 || return 1;; esac done - # enable mp3 support - /bin/sh contrib/scripts/get_mp3_source.sh || return 1 - # asteriskssl does not have direct references to libssl, but looks up # symbols from it using dlsym(RTLD_NEXT), so use --no-as-needed for it. sed -i -e 's/ASTSSL_LIBS:=$(OPENSSL_LIB)/ASTSSL_LIBS:=-Wl,--no-as-needed $(OPENSSL_LIB) -Wl,--as-needed/g' main/Makefile sed -i -e 's:lua5.1/::' pbx/pbx_lua.c - sed -i -e 's/PBX_ICONV=1/PBX_ICONV=0/g' configure.ac sed -i -e 's/int foo = res_ninit(NULL);/res_ninit_is_not_really_here();/g' configure.ac update_config_sub || return 1 @@ -93,7 +88,6 @@ build() { --localstatedir=/var \ --disable-xmldoc \ --with-gsm=internal \ - --without-iconv \ --with-popt \ --with-z \ --with-newt \ @@ -254,8 +248,8 @@ sound_en() { } md5sums="96af38f9d11a1ba794cd520cef842d9c asterisk-12.4.0.tar.gz -837fc3bc835699462a8d2a7a16b9b6a3 100-uclibc-daemon.patch -6e1129e30c4fd2c25c86c81685a485a9 101-caps-uclibc.patch +126dd4fba66f4cf9aa94dfd7034e0ec4 asterisk-addon-mp3-r201.patch.gz +a66f192623276530eeb6d722ee35bee9 musl-libcap.patch b4211313aae31efa8c3c1931ba47dbf9 musl-includes.patch 9b3e6cb75464a6ef4c40d191bdfdf7ea musl-glob-compat.patch 10b84632764a6f05ec9973c31f5e82fb musl-outofmem-handling.patch @@ -263,13 +257,13 @@ b4211313aae31efa8c3c1931ba47dbf9 musl-includes.patch bc6713f5434e07b79d3afdd155461d72 ASTERISK-18995.patch 8499917c1476953cdc2f5c94c0581775 ASTERISK-19109.patch 676ca42ee1859d8a7bae4345ede5eb89 ASTERISK-20527.patch -6a6d84ad4df329e210dc7360c8bebdac ASTERISK-23818.patch +829518608463847cb5ff00a945e45aed ASTERISK-23818.patch 74cd25a5638a94ef51e9f4ede2fd28f2 asterisk.initd ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd 3e65172275684373e1a25c8a11224411 asterisk.logrotate" sha256sums="6c72d0060d1ce7a7d09f510d91d588f269aac0032de6a4464d5449b0d5600a72 asterisk-12.4.0.tar.gz -6f56ea997513c10fa39835e8dd11fbfb4ec0bb23f4b771963e56691b15a5c003 100-uclibc-daemon.patch -c2ef786e9a8082fe8ba7b4eb2f130925cb823d100ec567909ad465c279e335bf 101-caps-uclibc.patch +d32a5a695cee1699011d0e9ad02eb43af612def06f92017627194099edf98e3f asterisk-addon-mp3-r201.patch.gz +ba8334d855191af3fa662931244b6fea4ffc9eec84e40e1a52d6b3c0186d2005 musl-libcap.patch e3b7128813d0452b152d3af5015da927b07849e7f33de9f80f1d10f65907d268 musl-includes.patch c6a5c32646b767f09ebffccc49cac6a4ff9181498499e4453300775e75284b52 musl-glob-compat.patch 235b9c339793c02d1d80ac37d308cf14dc3e86fe8ccbe757e9855b186d9c164b musl-outofmem-handling.patch @@ -277,13 +271,13 @@ a5205ed44b57a72934baf8cde543ddb179f277494181818905110bfdcccfe7d9 musl-mutex-ini 7a7140156ae7fc7e833035db1e428db8d90159579cd2678c4b5cc829ded47485 ASTERISK-18995.patch 8970797d4812a751968c0db83816fe2bc05c8b01dba7f64f21c197807528d234 ASTERISK-19109.patch 1f822e618554e9962fe4599975bdcc24413e087dbd7ea4ce0305ecb7ea9bef94 ASTERISK-20527.patch -0d94dc1e1ba0eaee8e2e17bc0ecd63d0bff5526dcdbd0894ee3584e96bdfd760 ASTERISK-23818.patch +491cab5d61880603a4e2324d475f017d32abf78e3fe2225780a093b189aaa0d9 ASTERISK-23818.patch 13bcc98f2a78d4dd41e810232979eb83044e9166302bfb5b971315f2a82af36f asterisk.initd d221148583b57f9c37d7160f2493f0d204ad11f7abb17e3a3534e108ad5452d7 asterisk.confd 77b253b6db71460acf9a51e87ad4c8582027a46db01a4c50fb048bada58c19d1 asterisk.logrotate" sha512sums="f1a58b42422efe7bca5bf39f400309d062b1f10c2918029e9b7db84dbffe38cef1712ce87537a22e4d7dcd32b3b768f057b6903d937d68593baeb5a56390f649 asterisk-12.4.0.tar.gz -24a0d3c0ae86117ead8d2e35fc9a5945e04b9f80f3baf122337c8361c015e5ad904c206579962aefe3eb35a1fbf269515228ae5f34a801d7725d73dc235cf831 100-uclibc-daemon.patch -601681b9a33e77b33a0393a494c4140aa6c1f174c514093242a4081661bb7f78b6af867100996c97f3bf12e8dd10873dd3e116b61e2a0e04832f4ee470664368 101-caps-uclibc.patch +aacef3f4796fb1abd33266998b53909cb4b36e7cc5ad2f7bac68bdc43e9a9072d9a4e2e7e681bddfa31f3d04575eb248afe6ea95da780c67e4829c1e22adfe1b asterisk-addon-mp3-r201.patch.gz +d30d1be03cbc637f1d05e6897efa2e1fae560ac2c48124a9636c5ff390c81b8c07cf9cef6d930e71eb59cb932f234284a0390487ec257e0fa45ec11d294c106c musl-libcap.patch 878b8cddc5af338a07658c388d42a7f9ddf3edcf302ca8b294adcf278b6ceacd463d279cb716b0b6b059f47eb287803bc15a7f36a403c66697f466ff3cd5a6e4 musl-includes.patch edf65eba44e8f1f0e78671aba312bcff2090134cf94e89ebb4b6beef7b2d57b24381ae9511cbf9fffe6b555e695a3dbe2cedcd04f1d237df822fa742bd5092ac musl-glob-compat.patch 7cbbad2c16d89b0b4ea45257a44c25ea96ca6ecb1f5bf7707656dfa3957cae34d1dca404b3d62baca8b55cea6f9fa39819bef48a1f4dad0124da95d6c80a294e musl-outofmem-handling.patch @@ -291,7 +285,7 @@ f72c2e04de80d3ed9ce841308101383a1655e6da7a3c888ad31fffe63d1280993e08aefcf8e63831 42b2385d88e72473fe34c63e1be8cdf7f37688649fe5bf033b5ba17627008b771aec8f0a583e9ad483a20f9e1f7c33922cb42bf5b73adc68aa43fd46c5da1daa ASTERISK-18995.patch 875dcd976b82b554157c5539df6fae0082b072c81d4db12827d1fc41c00e8dc0118b3bf7359f30e3b49051de27a85394ff30d08e62cde811a7c197b41f1f313a ASTERISK-19109.patch 6edd8e0a1dce326aadf659c8bf8ed34083e8247b6c0f032d097c77df25feb93107375ba505e9076c084fe80676336d6c863e04c3c6808a850e24257fd7a7702d ASTERISK-20527.patch -10d56739531b8a923c2090257159932b15d91c9881f432dd30e9129fdd430c2164f0e9549ac0249eb64ca8800ecbbdad8347eecbaf1862e3f39b0a61610a4904 ASTERISK-23818.patch +214479320e713e851fc26f730c076e2d7296a385c9abe573e0acfb277d657834d48d57ffb4a2b437fc42b9d004f867a0a1cc50aa1d39e1905b5baa6c05876056 ASTERISK-23818.patch e29477aa57d88fedc96d13751f68f302d3892c70b5ea5b5a8cc85d0439335fc1a6847648447b443a074c0877718f23295e3752056a108301d340d1e2919465b1 asterisk.initd ab6b6f08ff43268cbb1abb7ed7d678949991ba495682a644bbaeb017d6adbff0a43297905fd73ae8db1786a28d5b5904f1bc253209a0e388c8a27f26c6ce14ed asterisk.confd 7591d2faf539d05d9ee4e431c78a5e20686721fd79221ad94dffeeaff9282220b09cb9aec214bd7a8d12affaec0276c9c91e6e21af8b6712c0a9502b60b02f2b asterisk.logrotate" diff --git a/main/asterisk/ASTERISK-23818.patch b/main/asterisk/ASTERISK-23818.patch index 917bac839a..0360f4c842 100644 --- a/main/asterisk/ASTERISK-23818.patch +++ b/main/asterisk/ASTERISK-23818.patch @@ -1,10 +1,9 @@ -This reverts ASTERISK-23818 as the fix causes lua modules to break. -Note sent upstrean and hopefully they fix it in more proper way. +https://issues.asterisk.org/jira/browse/ASTERISK-23818 +https://reviewboard.asterisk.org/r/3891 -diff -ru asterisk-12.4.0.orig/pbx/pbx_lua.c asterisk-12.4.0/pbx/pbx_lua.c ---- asterisk-12.4.0.orig/pbx/pbx_lua.c 2014-08-04 15:11:22.000000000 -0300 -+++ asterisk-12.4.0/pbx/pbx_lua.c 2014-08-05 10:25:35.092623642 -0300 -@@ -1672,7 +1672,7 @@ +--- a/pbx/pbx_lua.c (revision 420123) ++++ b/pbx/pbx_lua.c (working copy) +@@ -1562,7 +1562,7 @@ return AST_MODULE_LOAD_SUCCESS; } @@ -13,3 +12,17 @@ diff -ru asterisk-12.4.0.orig/pbx/pbx_lua.c asterisk-12.4.0/pbx/pbx_lua.c .load = load_module, .unload = unload_module, .reload = reload, +--- a/main/pbx.c (revision 420123) ++++ b/main/pbx.c (working copy) +@@ -7868,6 +7868,11 @@ + ast_hashtab_end_traversal(prio_iter); + } + ast_hashtab_end_traversal(exten_iter); ++ } else if (new) { ++ /* If the context existed but had no extensions, we still want to merge ++ * the includes, switches and ignore patterns. ++ */ ++ context_merge_incls_swits_igps_other_registrars(new, context, registrar); + } + + if (!insert_count && !new && (strcmp(context->registrar, registrar) != 0 || diff --git a/main/asterisk/musl-libcap.patch b/main/asterisk/musl-libcap.patch new file mode 100644 index 0000000000..d7ce52e7be --- /dev/null +++ b/main/asterisk/musl-libcap.patch @@ -0,0 +1,41 @@ +diff -ru asterisk-12.4.0.orig/configure.ac asterisk-12.4.0/configure.ac +--- asterisk-12.4.0.orig/configure.ac 2014-08-06 09:07:19.000000000 -0300 ++++ asterisk-12.4.0/configure.ac 2014-08-06 09:10:16.350632198 -0300 +@@ -1259,9 +1259,11 @@ + 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 -ru asterisk-12.4.0.orig/main/Makefile asterisk-12.4.0/main/Makefile +--- asterisk-12.4.0.orig/main/Makefile 2014-08-06 08:53:33.000000000 -0300 ++++ asterisk-12.4.0/main/Makefile 2014-08-06 09:07:59.210630841 -0300 +@@ -1,4 +1,3 @@ +-# + # Asterisk -- An open source telephony toolkit. + # + # Makefile to build main Asterisk binary +@@ -40,14 +39,12 @@ + AST_LIBS+=$(URIPARSER_LIB) + AST_LIBS+=$(UUID_LIB) + AST_LIBS+=$(CRYPT_LIB) ++AST_LIBS+=$(CAP_LIB) + + ifneq ($(findstring $(OSARCH), linux-gnu uclinux linux-uclibc kfreebsd-gnu),) + ifneq ($(findstring LOADABLE_MODULES,$(MENUSELECT_CFLAGS)),) + AST_LIBS+=-ldl + endif +- ifneq (x$(CAP_LIB),x) +- AST_LIBS+=$(CAP_LIB) +- endif + AST_LIBS+=-lpthread $(EDITLINE_LIB) -lm -lresolv + else + AST_LIBS+=$(EDITLINE_LIB) -lm -- cgit v1.2.3