add basic asterisk 1.6.x package based on 1.6.1-rc1

git-svn-id: svn://svn.openwrt.org/openwrt/packages@14304 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
zandbelt 2009-01-31 15:37:14 +00:00
parent 754ce8a42f
commit ff7131de18
5 changed files with 327 additions and 0 deletions

246
net/asterisk-1.6.x/Makefile Normal file
View File

@ -0,0 +1,246 @@
#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$
# TODO:
# - create smaller default config files (sip.conf and extensions.conf)
# - ldd /usr/sbin/asterisk result:
# + libssl.so.0.9.8 dep. is missing (and zlib sub dep.) => libopenssl
# + libcrypto.so.0.9.8 dep. is missing => libopenssl
# => need 1063071 and 223551 bytes!
# - asterisk -cvvv
# + load_dynamic_module: Error loading module 'func_strings.so': File not found
# + Unable to open Asterisk database '/var/lib/asterisk/astdb
# + Error loading module 'res_musiconhold.so': File not found
# - mkdir -p /var/lib/asterisk/
# - app_echo.so need app_playback.so
# - I need app_macro.so
# - Function "CALLERID not registered
#
# Changelog:
# 20090111 nm build brcm47xx failde: add --without-sdl to CONFIGURE_ARGS
# build x86: Package gtk+-2.0 was not found in the pkg-config search path.
# => --without-gtk and --without-gtk2 added to CONFIGURE_ARGS but libpopt
# is needed
include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk
PKG_VERSION:=1.6.1-rc1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://downloads.digium.com/pub/asterisk/releases/
PKG_MD5SUM:=29f7285b673d52b49d91c8e797acbbb0
include $(INCLUDE_DIR)/package.mk
define Package/asterisk16/Default
SUBMENU:=asterisk16 (Complete Open Source PBX), v1.6.x
SECTION:=net
CATEGORY:=Network
URL:=http://www.asterisk.org/
endef
define Package/asterisk16/Default/description
Asterisk is a complete PBX in software. It provides all of the features
you would expect from a PBX and more. Asterisk does voice over IP in three
protocols, and can interoperate with almost all standards-based telephony
equipment using relatively inexpensive hardware.
endef
define Package/asterisk16
$(call Package/asterisk16/Default)
TITLE:=Complete open source PBX
DEPENDS:= +libncurses +libpopt +libpthread +zlib @!TARGET_avr32
endef
define Package/asterisk16/description
$(call Package/asterisk16/Default/description)
endef
define Package/asterisk16-sounds
$(call Package/asterisk16/Default)
TITLE:=Sound files
DEPENDS:= +asterisk16
endef
define Package/asterisk16-sounds/description
$(call Package/asterisk16/Default/description)
This package contains sound files for Asterisk.
endef
define Package/asterisk16-voicemail
$(call Package/asterisk16/Default)
TITLE:=Voicemail support
DEPENDS:= +asterisk16
endef
define Package/asterisk16-voicemail/description
$(call Package/asterisk16/Default/description)
This package contains voicemail related modules for Asterisk.
endef
define Package/asterisk16-app-meetme
$(call Package/asterisk16/Default)
TITLE:=conferencing support
DEPENDS:= +asterisk16 +dahdi-tools-libtonezone +kmod-dahdi-linux
endef
define Package/asterisk16-app-meetme/description
$(call Package/asterisk16/Default/description)
This package provides the MeetMe application driver Conferencing support to
Asterisk.
endef
CONFIGURE_ARGS+= \
--without-curl \
--without-curses \
--with-gsm=internal \
--without-gtk \
--without-gtk2 \
--without-isdnnet \
--without-kde \
--without-misdn \
--without-nbs \
--with-ncurses="$(STAGING_DIR)/usr" \
--without-netsnmp \
--without-newt \
--without-odbc \
--without-ogg \
--without-osptk \
--with-popt="$(STAGING_DIR)/usr" \
--without-pri \
--without-qt \
--without-radius \
--without-sdl \
--without-spandsp \
--without-suppserv \
--without-tds \
--without-termcap \
--without-tinfo \
--without-vorbis \
--without-vpb \
--with-z="$(STAGING_DIR)/usr" \
ifneq ($(SDK)$(CONFIG_PACKAGE_asterisk16-app-meetme),)
CONFIGURE_ARGS+= \
--with-dahdi="$(STAGING_DIR)/usr"
else
CONFIGURE_ARGS+= \
--without-dahdi
endif
EXTRA_CFLAGS:= $(TARGET_CPPFLAGS)
EXTRA_LDFLAGS:= $(TARGET_LDFLAGS)
define Build/Configure
-rm $(PKG_BUILD_DIR)/menuselect.makeopts
$(call Build/Configure/Default,,$(SITE_VARS))
endef
define Build/Compile
$(MAKE) -C "$(PKG_BUILD_DIR)" \
include/asterisk/version.h \
include/asterisk/buildopts.h defaults.h \
makeopts.embed_rules
ASTCFLAGS="$(EXTRA_CFLAGS) -DLOW_MEMORY $(TARGET_CFLAGS)" \
ASTLDFLAGS="$(EXTRA_LDFLAGS)" \
$(MAKE) -C "$(PKG_BUILD_DIR)" \
ASTVARLIBDIR="/usr/lib/asterisk" \
NOISY_BUILD="1" \
DEBUG="" \
OPTIMIZE="" \
DESTDIR="$(PKG_INSTALL_DIR)" \
all install samples
$(SED) 's|/var/lib/asterisk|/usr/lib/asterisk|g' $(PKG_INSTALL_DIR)/etc/asterisk/musiconhold.conf
endef
define Build/InstallDev
mkdir -p $(1)/usr/include/asterisk/
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk/*.h $(1)/usr/include/asterisk/
$(CP) $(PKG_INSTALL_DIR)/usr/include/asterisk.h $(1)/usr/include/
endef
define Package/asterisk16/conffiles
/etc/asterisk/asterisk.conf
/etc/asterisk/modules.conf
/etc/asterisk/extensions.conf
/etc/asterisk/sip.conf
/etc/asterisk/sip_notify.conf
/etc/asterisk/features.conf
/etc/asterisk/logger.conf
/etc/asterisk/manager.conf
/etc/asterisk/rtp.conf
/etc/default/asterisk
/etc/init.d/asterisk
endef
define Package/asterisk16/install
$(INSTALL_DIR) $(1)/etc/asterisk
for f in asterisk extensions features \
logger manager modules \
sip sip_notify rtp; do \
$(CP) $(PKG_INSTALL_DIR)/etc/asterisk/$$$$f.conf $(1)/etc/asterisk/ ; \
done
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
for f in app_dial chan_sip \
codec_ulaw codec_gsm \
format_gsm format_pcm format_wav format_wav_gsm \
pbx_config func_timeout; do \
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/$$$$f.so $(1)/usr/lib/asterisk/modules/ ; \
done
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/asterisk $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/default
$(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk
endef
define Package/asterisk16-sounds/install
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/* $(1)/usr/lib/asterisk/sounds/
rm -f $(1)/usr/lib/asterisk/sounds/vm-*
rm -f $(1)/usr/lib/asterisk/sounds/conf-*
endef
define Package/asterisk16-voicemail/conffiles
/etc/asterisk/voicemail.conf
endef
define Package/asterisk16-voicemail/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/voicemail.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/*voicemail.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/res_adsi.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/vm-*.gsm $(1)/usr/lib/asterisk/sounds/
endef
define Package/asterisk16-app-meetme/conffiles
/etc/asterisk/meetme.conf
endef
define Package/asterisk16-app-meetme/install
$(INSTALL_DIR) $(1)/etc/asterisk
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/asterisk/meetme.conf $(1)/etc/asterisk/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/modules
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/app_meetme.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/asterisk/modules/chan_dahdi.so $(1)/usr/lib/asterisk/modules/
$(INSTALL_DIR) $(1)/usr/lib/asterisk/sounds/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/asterisk/sounds/en/conf-*.gsm $(1)/usr/lib/asterisk/sounds/
endef
$(eval $(call BuildPackage,asterisk16))
$(eval $(call BuildPackage,asterisk16-voicemail))
$(eval $(call BuildPackage,asterisk16-sounds))
#$(eval $(call BuildPackage,asterisk16-app-meetme))

View File

@ -0,0 +1,4 @@
## startup options for /etc/init.d/asterisk
ENABLE_ASTERISK="yes"
OPTIONS=""

View File

@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=50
DEST=
DEFAULT=$DEST/etc/default/asterisk
OPTIONS=""
start() {
[ -f $DEFAULT ] && . $DEFAULT
[ -d $DEST/var/run ] || mkdir -p $DEST/var/run
[ -d $DEST/var/log/asterisk ] || mkdir -p $DEST/var/log/asterisk
[ -d $DEST/var/spool/asterisk ] || mkdir -p $DEST/var/spool/asterisk
[ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk
[ -h $DEST/usr/lib/asterisk/astdb ] || ln -sf /var/spool/asterisk/astdb $DEST/usr/lib/asterisk/astdb
$DEST/usr/sbin/asterisk $OPTIONS
}
stop() {
[ -f $DEST/var/run/asterisk.pid ] && kill $(cat $DEST/var/run/asterisk.pid) >/dev/null 2>&1
}

View File

@ -0,0 +1,12 @@
diff -Nru asterisk-1.6.1-beta4.org/build_tools/menuselect-deps.in asterisk-1.6.1-beta4/build_tools/menuselect-deps.in
--- asterisk-1.6.1-beta4.org/build_tools/menuselect-deps.in 2008-08-03 18:14:14.000000000 +0200
+++ asterisk-1.6.1-beta4/build_tools/menuselect-deps.in 2008-12-22 21:49:16.000000000 +0100
@@ -10,7 +10,7 @@
GTK=@PBX_GTK@
H323=@PBX_H323@
HOARD=@PBX_HOARD@
-ICONV=@PBX_ICONV@
+ICONV=0
IKSEMEL=@PBX_IKSEMEL@
IMAP_TK=@PBX_IMAP_TK@
ISDNNET=@PBX_ISDNNET@

View File

@ -0,0 +1,44 @@
diff -Nru asterisk-1.6.1-beta4.org/main/asterisk.c asterisk-1.6.1-beta4/main/asterisk.c
--- asterisk-1.6.1-beta4.org/main/asterisk.c 2008-12-12 23:05:58.000000000 +0100
+++ asterisk-1.6.1-beta4/main/asterisk.c 2008-12-23 15:28:21.000000000 +0100
@@ -3295,9 +3295,40 @@
#if HAVE_WORKING_FORK
if (ast_opt_always_fork || !ast_opt_no_fork) {
#ifndef HAVE_SBIN_LAUNCHD
+#ifndef __UCLIBC__
if (daemon(1, 0) < 0) {
ast_log(LOG_ERROR, "daemon() failed: %s\n", strerror(errno));
}
+#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();
/* Blindly re-write pid file since we are forking */
unlink(ast_config_AST_PID);