From cf48d28165c27b338df1ab88ac75520eb184fe86 Mon Sep 17 00:00:00 2001
From: Florian Fainelli <florian@openwrt.org>
Date: Fri, 17 Mar 2006 10:35:07 +0000
Subject: [PATCH] Updated to latest upstream version: 1.0.1 Added support for
 multiple modules, including accounting, mysql, sms, xlog ...

SVN-Revision: 3389
---
 openwrt/package/openser/Config.in             | 99 ++++++++++++++++++-
 openwrt/package/openser/Makefile              | 42 +++++++-
 .../openser/ipkg/openser-mod-acc.control      |  5 +
 .../openser/ipkg/openser-mod-auth-db.control  |  5 +
 .../ipkg/openser-mod-auth-radius.control      |  5 +
 .../openser/ipkg/openser-mod-auth.control     |  5 +
 .../openser/ipkg/openser-mod-avpops.control   |  5 +
 .../openser/ipkg/openser-mod-lcr.control      |  5 +
 .../ipkg/openser-mod-mediaproxy.control       |  5 +
 .../openser/ipkg/openser-mod-mysql.control    |  5 +
 .../ipkg/openser-mod-nathelper.control        |  5 +
 .../openser/ipkg/openser-mod-sms.control      |  5 +
 .../ipkg/openser-mod-speeddial.control        |  5 +
 .../openser/ipkg/openser-mod-xlog.control     |  5 +
 openwrt/package/openser/ipkg/openser.control  |  7 +-
 .../openser/patches/modules-build.patch       | 57 +++++++++++
 16 files changed, 256 insertions(+), 9 deletions(-)
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-acc.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-auth-db.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-auth-radius.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-auth.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-avpops.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-lcr.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-mediaproxy.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-mysql.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-nathelper.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-sms.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-speeddial.control
 create mode 100644 openwrt/package/openser/ipkg/openser-mod-xlog.control
 create mode 100644 openwrt/package/openser/patches/modules-build.patch

diff --git a/openwrt/package/openser/Config.in b/openwrt/package/openser/Config.in
index b1aa99aa6b..54a586ea95 100644
--- a/openwrt/package/openser/Config.in
+++ b/openwrt/package/openser/Config.in
@@ -1,7 +1,104 @@
+menu "openser............................ Configurable, free SIP server"
+
 config BR2_PACKAGE_OPENSER
 	tristate 
-	prompt "openser........................... Configurable, free SIP server"
+	prompt "openser.......................... Configurable, free SIP server"
 	default m if CONFIG_DEVEL
 	help
 	 Open SIP Express Router (OpenSER) is a high-performance,
 	 configurable, free SIP server.
+
+config BR2_PACKAGE_OPENSER_MOD_MYSQL
+	prompt "openser-mod-mysql................ MySQL support"
+	tristate	
+	default m
+	select BR2_COMPILE_MYSQL
+	select BR2_PACKAGE_OPENSER
+	help
+	  Enable MySQL support
+
+config BR2_PACKAGE_OPENSER_MOD_AUTH
+	prompt "openser-mod-auth................. Authentication support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  Enable authentication support
+
+config BR2_PACKAGE_OPENSER_MOD_AUTH_DB
+	prompt "openser-mod-auth-db.............. Authentication with database support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	select BR2_PACKAGE_OPENSER_MOD_AUTH
+	help
+	  Enable authentication with database support
+
+config BR2_PACKAGE_OPENSER_MOD_AUTH_RADIUS
+	prompt "openser-mod-auth-radius.......... Authentication with RADIUS support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	select BR2_PACAKGE_LIBRADIUSCLIENT_NG
+	help
+	  Authentication against RADIUS
+
+config BR2_PACKAGE_OPENSER_MOD_AVPOPS
+	prompt "openser-mod-avpops............... AVP options support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  Enable AVP options support
+
+
+config BR2_PACKAGE_OPENSER_MOD_MEDIAPROXY
+	prompt "openser-mod-mediaproxy........... Mediaproxy support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  Enable mediaproxy support
+
+config BR2_PACKAGE_OPENSER_MOD_LCR
+	prompt "openser-mod-lcr.................. Least Cost Routing support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	select BR2_PACKAGE_OPENSER_MOD_MYSQL
+	help
+	  Enable Least Cost Routing support
+
+config BR2_PACKAGE_OPENSER_MOD_NATHELPER
+	prompt "openser-mod-nathelper............ NAT helper support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  NAT helper support
+
+config BR2_PACKAGE_OPENSER_MOD_SMS
+	prompt "openser-mod-sms.................. SMS support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  SMS support
+
+config BR2_PACKAGE_OPENSER_MOD_SPEEDDIAL
+	prompt "openser-mod-speeddial............ Speed dial support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  Speed Dial support
+
+config BR2_PACKAGE_OPENSER_MOD_XLOG
+	prompt "openser-mod-xlog................. Logging support"
+	tristate
+	default m
+	select BR2_PACKAGE_OPENSER
+	help
+	  Logging support
+
+endmenu
diff --git a/openwrt/package/openser/Makefile b/openwrt/package/openser/Makefile
index d3b482678f..40c00397a4 100644
--- a/openwrt/package/openser/Makefile
+++ b/openwrt/package/openser/Makefile
@@ -3,10 +3,10 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openser
-PKG_VERSION:=1.0.0
+PKG_VERSION:=1.0.1
 PKG_RELEASE:=1
-PKG_MD5SUM:=f60f5a51772c5b06abaa1c81e9539077
-# PKG_VARIANT:=-tls for tls version
+PKG_MD5SUM:=eebc16665003ee92daf96b216d6f9563
+# PKG_VARIANT:=-tls # for tls version
 PKG_VARIANT:=
 
 PKG_SOURCE_URL:=http://openser.org/pub/openser/$(PKG_VERSION)/src
@@ -18,7 +18,43 @@ PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
 
 include $(TOPDIR)/package/rules.mk
 
+define PKG_mod_template
+
+$$(IPKG_$(1)):
+	[ -z "$(2)" ] || install -d -m 0755 $$(IDIR_$(1))/usr/lib/openser/modules/
+	$(CP) $(PKG_BUILD_DIR)/modules/$(2)/$(2).so \
+			$$(IDIR_$(1))/usr/lib/openser/modules/ ; \
+	$(RSTRIP) $$(IDIR_$(1))
+	$(IPKG_BUILD) $$(IDIR_$(1)) $(PACKAGE_DIR)
+	
+endef
+
 $(eval $(call PKG_template,OPENSER,openser,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_ACCOUNTING,openser-mod-acc,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_AUTH,openser-mod-auth,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_AUTH_DB,openser-mod-auth-db,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_AUTH_RADIUS,openser-mod-auth-radius,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_AVPOPS,openser-mod-avpops,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_LCR,openser-mod-lcr,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_MEDIAPROXY,openser-mod-mediaproxy,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_MYSQL,openser-mod-mysql,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_NATHELPER,openser-mod-nathelper,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_SMS,openser-mod-sms,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_SPEEDDIAL,openser-mod-speeddial,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+$(eval $(call PKG_template,OPENSER_MOD_XLOG,openser-mod-xlog,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
+$(eval $(call PKG_mod_template,OPENSER_MOD_ACCOUNTING,acc))
+$(eval $(call PKG_mod_template,OPENSER_MOD_AUTH,auth))
+$(eval $(call PKG_mod_template,OPENSER_MOD_AUTH_DB,auth_db))
+$(eval $(call PKG_mod_template,OPENSER_MOD_AUTH_RADIUS,auth_radius))
+$(eval $(call PKG_mod_template,OPENSER_MOD_AVPOPS,avpops))
+$(eval $(call PKG_mod_template,OPENSER_MOD_LCR,lcr))
+$(eval $(call PKG_mod_template,OPENSER_MOD_MEDIAPROXY,mediaproxy))
+$(eval $(call PKG_mod_template,OPENSER_MOD_MYSQL,mysql))
+$(eval $(call PKG_mod_template,OPENSER_MOD_NATHELPER,nathelper))
+$(eval $(call PKG_mod_template,OPENSER_MOD_SMS,sms))
+$(eval $(call PKG_mod_template,OPENSER_MOD_SPEEDIAL,speeddial))
+$(eval $(call PKG_mod_template,OPENSER_MOD_XLOG,xlog))
 
 # Select here the modules for the ipk package
 OPENSER_MODULES := sl tm rr maxfwd usrloc registrar dbtext textops exec
diff --git a/openwrt/package/openser/ipkg/openser-mod-acc.control b/openwrt/package/openser/ipkg/openser-mod-acc.control
new file mode 100644
index 0000000000..43b2e581c3
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-acc.control
@@ -0,0 +1,5 @@
+Package: openser-mod-acc
+Depends: openser, libradiusclient-ng
+Section: net
+Priority: optional
+Description: accounting support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-auth-db.control b/openwrt/package/openser/ipkg/openser-mod-auth-db.control
new file mode 100644
index 0000000000..9b6878903e
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-auth-db.control
@@ -0,0 +1,5 @@
+Package: openser-mod-auth-db
+Depends: openser, libmysqlclient
+Section: net
+Priority: optional
+Description: authentication support against database for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-auth-radius.control b/openwrt/package/openser/ipkg/openser-mod-auth-radius.control
new file mode 100644
index 0000000000..dbcdcabadb
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-auth-radius.control
@@ -0,0 +1,5 @@
+Package: openser-mod-auth-radius
+Depends: openser, libradiusclient-ng
+Section: net
+Priority: optional
+Description: authentication support against RADIUS for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-auth.control b/openwrt/package/openser/ipkg/openser-mod-auth.control
new file mode 100644
index 0000000000..4877347fa7
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-auth.control
@@ -0,0 +1,5 @@
+Package: openser-mod-auth
+Depends: openser
+Section: net
+Priority: optional
+Description: authentication support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-avpops.control b/openwrt/package/openser/ipkg/openser-mod-avpops.control
new file mode 100644
index 0000000000..f88d54d4bc
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-avpops.control
@@ -0,0 +1,5 @@
+Package: openser-mod-avpops
+Depends: openser
+Section: net
+Priority: optional
+Description: AVPOPS support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-lcr.control b/openwrt/package/openser/ipkg/openser-mod-lcr.control
new file mode 100644
index 0000000000..92541b9bd2
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-lcr.control
@@ -0,0 +1,5 @@
+Package: openser-mod-lcr
+Depends: openser
+Section: net
+Priority: optional
+Description: Least Cost Routing support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-mediaproxy.control b/openwrt/package/openser/ipkg/openser-mod-mediaproxy.control
new file mode 100644
index 0000000000..f5172ba7be
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-mediaproxy.control
@@ -0,0 +1,5 @@
+Package: openser-mod-mediaproxy
+Depends: openser
+Section: net
+Priority: optional
+Description: mediaproxy support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-mysql.control b/openwrt/package/openser/ipkg/openser-mod-mysql.control
new file mode 100644
index 0000000000..5ca3fc3dd3
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-mysql.control
@@ -0,0 +1,5 @@
+Package: openser-mod-mysql
+Depends: openser, libmysqlclient
+Section: net
+Priority: optional
+Description: MySQL support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-nathelper.control b/openwrt/package/openser/ipkg/openser-mod-nathelper.control
new file mode 100644
index 0000000000..dccbb0e026
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-nathelper.control
@@ -0,0 +1,5 @@
+Package: openser-mod-nathelper
+Depends: openser
+Section: net
+Priority: optional
+Description: NAT helper support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-sms.control b/openwrt/package/openser/ipkg/openser-mod-sms.control
new file mode 100644
index 0000000000..4b8547292b
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-sms.control
@@ -0,0 +1,5 @@
+Package: openser-mod-sms
+Depends: openser
+Section: net
+Priority: optional
+Description: SMS support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-speeddial.control b/openwrt/package/openser/ipkg/openser-mod-speeddial.control
new file mode 100644
index 0000000000..75b2f555ad
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-speeddial.control
@@ -0,0 +1,5 @@
+Package: openser-mod-speeddial
+Depends: openser
+Section: net
+Priority: optional
+Description: Speed-dial support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser-mod-xlog.control b/openwrt/package/openser/ipkg/openser-mod-xlog.control
new file mode 100644
index 0000000000..81483d295f
--- /dev/null
+++ b/openwrt/package/openser/ipkg/openser-mod-xlog.control
@@ -0,0 +1,5 @@
+Package: openser-mod-xlog
+Depends: openser
+Section: net
+Priority: optional
+Description: Xlog targets support for OpenSER
diff --git a/openwrt/package/openser/ipkg/openser.control b/openwrt/package/openser/ipkg/openser.control
index a0b9863d55..65a6a0f389 100644
--- a/openwrt/package/openser/ipkg/openser.control
+++ b/openwrt/package/openser/ipkg/openser.control
@@ -1,7 +1,4 @@
 Package: openser
-Priority: optional
 Section: net
-Maintainer: Michael Poehnl <budrus@berlios.de>
-Description: OpenSER
- OpenSER is a high-performance,
- configurable, free SIP server.
+Priority: optional
+Description: OpenSER is a high-performance, configurable, free SIP server.
diff --git a/openwrt/package/openser/patches/modules-build.patch b/openwrt/package/openser/patches/modules-build.patch
new file mode 100644
index 0000000000..6e6ee00c40
--- /dev/null
+++ b/openwrt/package/openser/patches/modules-build.patch
@@ -0,0 +1,57 @@
+--- openser-1.0.1/Makefile	2006-02-15 20:52:21.000000000 +0100
++++ openser-1.0.1.new/Makefile	2006-03-17 11:01:27.417488936 +0100
+@@ -46,8 +46,7 @@
+ skip_modules?=
+ 
+ # if not set on the cmd. line or the env, exclude this modules:
+-exclude_modules?= 		jabber cpl-c pa postgres mysql \
+-						avp_radius auth_radius group_radius uri_radius
++exclude_modules?= 		jabber cpl-c pa
+ # always exclude the CVS dir
+ override exclude_modules+= CVS $(skip_modules)
+ 
+diff -urN openser-1.0.1/modules/acc/Makefile openser-1.0.1.new/modules/acc/Makefile
+--- openser-1.0.1/modules/acc/Makefile	2005-09-05 21:32:02.000000000 +0200
++++ openser-1.0.1.new/modules/acc/Makefile	2006-03-17 10:38:14.333269928 +0100
+@@ -14,8 +14,8 @@
+ DEFS+=-DSQL_ACC
+ 
+ # uncomment the next two lines if you wish to enable RADIUS accounting
+-#DEFS+=-DRAD_ACC -I$(LOCALBASE)/include
+-#LIBS=-L$(LOCALBASE)/lib -lradiusclient-ng
++DEFS+=-DRAD_ACC -I$(LOCALBASE)/include
++LIBS=-L$(LOCALBASE)/lib -lradiusclient-ng
+ 
+ # uncomment the next two lines if you wish to enable DIAMETER accounting
+ #DEFS+=-DDIAM_ACC
+diff -urN openser-1.0.1/modules/mysql/Makefile openser-1.0.1.new/modules/mysql/Makefile
+--- openser-1.0.1/modules/mysql/Makefile	2005-06-13 18:47:40.000000000 +0200
++++ openser-1.0.1.new/modules/mysql/Makefile	2006-03-17 11:12:16.218856136 +0100
+@@ -9,14 +9,12 @@
+ # mysql.h locations (freebsd,openbsd  solaris)
+ DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/include/mysql \
+ 		-I$(LOCALBASE)/mysql/include \
+-		-I/usr/include/mysql
+ 
+ # libmysqlclient locations on RH/Suse, Solaris /OpenBSD, FreeBSD
+ # (Debian does the right thing and puts it in /usr/lib)
+ LIBS=-L/usr/lib/mysql -L$(LOCALBASE)/lib -L$(LOCALBASE)/lib/mysql \
+ 		-L$(LOCALBASE)/mysql/lib/mysql/ \
+ 		-L$(LOCALBASE)/mysql/lib \
+-		-L/usr/lib64/mysql \
+ 		-lmysqlclient -lz
+ 
+ include ../../Makefile.modules
+diff -urN openser-1.0.1/modules/postgres/Makefile openser-1.0.1.new/modules/postgres/Makefile
+--- openser-1.0.1/modules/postgres/Makefile	2005-07-01 16:52:34.000000000 +0200
++++ openser-1.0.1.new/modules/postgres/Makefile	2006-03-17 11:13:22.150832952 +0100
+@@ -7,8 +7,7 @@
+ NAME=postgres.so
+ 
+ # libpq-fe.h locations
+-DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/pgsql/include \
+-	 -I/usr/include/postgresql -I/usr/include/postgresql/8.0
++DEFS +=-I$(LOCALBASE)/include -I$(LOCALBASE)/pgsql/include -I$(LOCALBASE)/include/postgresql
+ LIBS=-L$(LOCALBASE)/lib -L$(LOCALBASE)/pgsql/lib -L$(LOCALBASE)/lib/pgsql \
+ 	 -lpq
+ 
-- 
2.30.2