Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Oct 2019 09:26:11 +0000 (UTC)
From:      Kurt Jaeger <pi@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r513656 - in head/net/kamailio: . files
Message-ID:  <201910030926.x939QBU6062848@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pi
Date: Thu Oct  3 09:26:10 2019
New Revision: 513656
URL: https://svnweb.freebsd.org/changeset/ports/513656

Log:
  net/kamailio: added Lua and Python support
  
  - Added Lua and Python support
    https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/kemi/#lua-kemi-interpreter
  - implement configtest in rc.script
  
  PR:		240974
  Submitted by:	Dmitry Wagin <dmitry.wagin@ya.ru>

Modified:
  head/net/kamailio/Makefile
  head/net/kamailio/files/kamailio.in
  head/net/kamailio/pkg-plist

Modified: head/net/kamailio/Makefile
==============================================================================
--- head/net/kamailio/Makefile	Thu Oct  3 09:24:29 2019	(r513655)
+++ head/net/kamailio/Makefile	Thu Oct  3 09:26:10 2019	(r513656)
@@ -3,7 +3,7 @@
 
 PORTNAME=	kamailio
 PORTVERSION=	5.2.4
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net
 MASTER_SITES=	http://www.kamailio.org/pub/kamailio/${PORTVERSION}/src/
 DISTNAME=	${PORTNAME}-${PORTVERSION}_src
@@ -14,14 +14,14 @@ COMMENT=	Very fast and configurable open source SIP pr
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-BROKEN_powerpc64=Does not build: /bin/sh: clang: not found
+BROKEN_powerpc64=	Does not build: /bin/sh: clang: not found
 
 LIB_DEPENDS=	libexpat.so:textproc/expat2 \
 		libxml2.so:textproc/libxml2 \
 		libcurl.so:ftp/curl
 RUN_DEPENDS=	${LOCALBASE}/bin/bash:shells/bash
 
-USES=		gmake ncurses pkgconfig python readline shebangfix
+USES=		gmake ncurses pkgconfig python:3.5+ readline shebangfix
 
 USE_LDCONFIG=	yes
 SHEBANG_FILES=	utils/kamctl/dbtextdb/dbtextdb.py \
@@ -29,54 +29,73 @@ SHEBANG_FILES=	utils/kamctl/dbtextdb/dbtextdb.py \
 
 CFLAGS+=	-Wall
 
-USERS=		kamailio
-GROUPS=		kamailio
+KAMAILIO_USER?=		kamailio
+KAMAILIO_GROUP?=	kamailio
 
+USERS=		${KAMAILIO_USER}
+GROUPS=		${KAMAILIO_GROUP}
+
+KAMAILIO_RUNDIR?=	/var/run/${PORTNAME}
+
 USE_RC_SUBR=	kamailio
 
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
-RUNDIR?=	/var/run/${PORTNAME}
+SUB_LIST=	KAMAILIO_USER=${KAMAILIO_USER} \
+		KAMAILIO_GROUP=${KAMAILIO_GROUP} \
+		KAMAILIO_RUNDIR=${KAMAILIO_RUNDIR}
 
-SUB_LIST=	RUNDIR=${RUNDIR} \
-		USERS=${USERS} \
-		GROUPS=${GROUPS}
+OPTIONS_GROUP=		DATABASE_DRIVERS KEMI
+OPTIONS_GROUP_KEMI=	LUAJIT PYTHON3
+OPTIONS_GROUP_DATABASE_DRIVERS=	MYSQL PGSQL UNIXODBC
+OPTIONS_DEFINE=		DATABASE DIALPLAN DOCS PERL PRESENCE RADIUS \
+			SCTP TLS WEBSOCKET
+OPTIONS_DEFAULT=	MYSQL PRESENCE RADIUS TLS
+OPTIONS_SUB=		YES
 
-OPTIONS_MULTI=	DATABASE
-OPTIONS_MULTI_DATABASE=MYSQL PGSQL
-OPTIONS_DEFINE=	DATABASE DIALPLAN DOCS JITSI PERL PRESENCE RADIUS \
-		SCTP TLS UNIXODBC WEBSOCKET
-OPTIONS_DEFAULT=MYSQL PRESENCE RADIUS TLS
-OPTIONS_SUB=	YES
+DATABASE_DRIVERS_DESC=	Database drivers
 
-DATABASE_DESC=	Database support (select one or more)
+DATABASE_DESC=	Database support
+DATABASE_VARS=	EXTRA_GROUPS+=db
 
-DIALPLAN_DESC=	Dialplan support
-DIALPLAN_LIB_DEPENDS=libpcre.so:devel/pcre
-DIALPLAN_VARS=	EXTRA_MODULES+=dialplan
-
-JITSI_DESC=	VoIP Frontend GUI via Jitsi
-JITSI_RUN_DEPENDS=jitsi:net-im/jitsi
-
 MYSQL_IMPLIES=	DATABASE
 MYSQL_USES=	mysql
 MYSQL_VARS=	EXTRA_GROUPS+=mysql
 
+PGSQL_IMPLIES=	DATABASE
+PGSQL_USES=	pgsql
+PGSQL_VARS=	EXTRA_GROUPS+=postgres
+
+UNIXODBC_IMPLIES=	DATABASE
+UNIXODBC_LIB_DEPENDS=	libodbc.so:databases/unixODBC
+UNIXODBC_VARS=		EXTRA_MODULES+=db_unixodbc
+
+KEMI_DESC=		Kamailio Embedded Interface
+
+LUAJIT_DESC=		Execute embedded Lua scripts
+LUAJIT_LIB_DEPENDS=	libluajit-5.1.so:lang/luajit
+LUAJIT_MAKE_ARGS=	LUAJIT=yes
+LUAJIT_VARS=		EXTRA_MODULES+=app_lua
+
+PYTHON3_DESC=		Execute embedded Python3 scripts
+PYTHON3_MAKE_ARGS=	PYTHON3=${PYTHON_CMD}
+PYTHON3_VARS=		EXTRA_MODULES+=app_python3
+
+DIALPLAN_DESC=		String translations based on rules
+DIALPLAN_LIB_DEPENDS=	libpcre.so:devel/pcre
+DIALPLAN_VARS=		EXTRA_MODULES+=dialplan
+
 PERL_USES=	perl5
 PERL_VARS=	EXTRA_MODULES+=app_perl
 PERL_MAKE_ENV=	PERLLDOPTS="`perl -MExtUtils::Embed -e ldopts`" \
 		PERLCCOPTS="`perl -MExtUtils::Embed -e ccopts`" \
 		TYPEMAP="`perl -MConfig -e 'print $$Config{privlib}'`/ExtUtils/typemap"
 
-PGSQL_IMPLIES=	DATABASE
-PGSQL_USES=	pgsql
-PGSQL_VARS=	EXTRA_GROUPS+=postgres
-
 PRESENCE_DESC=	Presence support
 PRESENCE_VARS=	EXTRA_GROUPS+=presence
 
-RADIUS_LIB_DEPENDS=libradiusclient-ng.so:net/radiusclient
-RADIUS_VARS=	EXTRA_GROUPS+=radius
+RADIUS_LIB_DEPENDS=	libradiusclient-ng.so:net/radiusclient
+RADIUS_VARS=		EXTRA_GROUPS+=radius
 
 SCTP_DESC=	SCTP support
 SCTP_VARS=	EXTRA_MODULES+=sctp
@@ -84,51 +103,46 @@ SCTP_VARS=	EXTRA_MODULES+=sctp
 TLS_USES=	ssl
 TLS_VARS=	EXTRA_MODULES+=tls
 
-UNIXODBC_LIB_DEPENDS=libodbc.so:databases/unixODBC
-UNIXODBC_VARS=	EXTRA_MODULES+=db_unixodbc
+WEBSOCKET_DESC=		Websocket support
+WEBSOCKET_LIB_DEPENDS=	libunistring.so:devel/libunistring
+WEBSOCKET_VARS=		EXTRA_MODULES+=websocket
 
-WEBSOCKET_DESC=	Websocket support
-WEBSOCKET_LIB_DEPENDS=libunistring.so:devel/libunistring
-WEBSOCKET_VARS=	EXTRA_MODULES+=websocket
-
 .include <bsd.port.pre.mk>
 
-DEFAULT_GROUP_INCLUDE=standard standard-dep
+DEFAULT_GROUPS=	standard
 
 .if !empty (EXTRA_GROUPS)
-MAKE_ARGS+=	group_include="${DEFAULT_GROUP_INCLUDE} ${EXTRA_GROUPS}"
+CFG_ARGS+=	group_include="${DEFAULT_GROUPS} ${EXTRA_GROUPS}"
 .else
-MAKE_ARGS+=	group_include="${DEFAULT_GROUP_INCLUDE}"
+CFG_ARGS+=	group_include="${DEFAULT_GROUPS}"
 .endif
 
 .if !empty (EXTRA_MODULES)
-MAKE_ARGS+=	include_modules="${EXTRA_MODULES}"
+CFG_ARGS+=	include_modules="${EXTRA_MODULES}"
 .endif
 
 post-patch:
-	${REINPLACE_CMD} '499s|$$(run_prefix)/$$(run_dir)|${RUNDIR}|' \
+	${REINPLACE_CMD} '499s|$$(run_prefix)/$$(run_dir)|${KAMAILIO_RUNDIR}|' \
 		${WRKSRC}/src/Makefile.defs
-.if ! ${PORT_OPTIONS:MDOCS}
-	${REINPLACE_CMD} 's|install-doc install-man|install-man|' \
+
+post-patch-DOCS-off:
+	@${REINPLACE_CMD} 's|install-doc install-man|install-man|' \
 		${WRKSRC}/src/Makefile
-.endif
 
 pre-build:
-	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} cfg
+	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${CFG_ARGS} cfg
 
-do-build:
-	@cd ${WRKSRC} && ${DO_MAKE_BUILD} ${ALL_TARGET}
-
 do-install:
-	@${MKDIR} ${STAGEDIR}${RUNDIR}
-	@cd ${WRKSRC} && ${MAKE_CMD} ${INSTALL_TARGET}
+	@${MKDIR} ${STAGEDIR}${KAMAILIO_RUNDIR}
+	@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install
 	@(cd ${STAGEDIR}${ETCDIR}; for i in `${FIND} . -type f`; do ${MV} $$i $$i.sample; done)
 
 post-install:
+	@${RMDIR} ${STAGEDIR}${DATADIR} || true
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/kamailio/*.so.1
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/kamailio/modules/*.so
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/sbin/kamailio
 	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/sbin/kamcmd
-	@${ECHO_CMD} "@dir(${USERS},${GROUPS},750) ${RUNDIR}" >> ${TMPPLIST}
+	@${ECHO_CMD} "@dir(${KAMAILIO_USER},${KAMAILIO_GROUP},750) ${KAMAILIO_RUNDIR}" >> ${TMPPLIST}
 
 .include <bsd.port.post.mk>

Modified: head/net/kamailio/files/kamailio.in
==============================================================================
--- head/net/kamailio/files/kamailio.in	Thu Oct  3 09:24:29 2019	(r513655)
+++ head/net/kamailio/files/kamailio.in	Thu Oct  3 09:26:10 2019	(r513656)
@@ -9,8 +9,18 @@
 # Add the following line to /etc/rc.conf to enable this service
 # at system startup:
 #
-# kamailio_enable (bool): Set to NO by default.
-# 			  Set it to YES to enable kamailio.
+# kamailio_enable (bool):
+#     Set to NO by default
+#     Set it to YES to enable kamailio
+# kamailio_user (string)
+#     Set user to run kamailio
+#     Default is "%%KAMAILIO_USER%%"
+# kamailio_group (string)
+#     Set group to run kamailio
+#     Default is "%%KAMAILIO_GROUP%%"
+# kamailio_pidfile (string)
+#     Set full path to pid file
+#     Default is "%%KAMAILIO_RUNDIR%%/kamailio.pid"
 #
 
 . /etc/rc.subr
@@ -20,19 +30,31 @@ rcvar=kamailio_enable
 
 load_rc_config ${name}
 
-: ${kamailio_enable:=NO}
-: ${kamailio_user:=%%USERS%%}
-: ${pidfile:=%%RUNDIR%%/kamailio.pid}
+: ${kamailio_enable:="NO"}
+: ${kamailio_user:="%%KAMAILIO_USER%%"}
+: ${kamailio_group:="%%KAMAILIO_GROUP%%"}
+: ${kamailio_pidfile:="%%KAMAILIO_RUNDIR%%/kamailio.pid"}
 
+pidfile="${kamailio_pidfile}"
+required_files="%%ETCDIR%%/kamailio.cfg"
 command="/usr/local/sbin/kamailio"
 command_args="-P ${pidfile}"
 
-start_precmd="kamailio_prestart"
+start_precmd="kamailio_start_precmd"
+restart_precmd="kamailio_checkconfig"
+reload_precmd="kamailio_checkconfig"
+configtest_cmd="kamailio_checkconfig"
+extra_commands="configtest"
 
-required_files="%%ETCDIR%%/kamailio.cfg"
+kamailio_start_precmd()
+{
+	install -d -m 0750 -o ${kamailio_user} -g ${kamailio_group} "%%KAMAILIO_RUNDIR%%"
+}
 
-kamailio_prestart() {
-	install -d -m 0750 -o %%USERS%% -g %%GROUPS%% %%RUNDIR%%
+kamailio_checkconfig()
+{
+	echo "Performing sanity check on ${name} configuration:"
+	eval ${command} ${kamailio_flags} -c >/dev/null
 }
 
 run_rc_command $1

Modified: head/net/kamailio/pkg-plist
==============================================================================
--- head/net/kamailio/pkg-plist	Thu Oct  3 09:24:29 2019	(r513655)
+++ head/net/kamailio/pkg-plist	Thu Oct  3 09:26:10 2019	(r513656)
@@ -141,8 +141,8 @@
 %%DATABASE%%lib/kamailio/modules/usrloc.so
 %%DIALPLAN%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.dialplan
 %%DIALPLAN%%lib/kamailio/modules/dialplan.so
-%%ETCDIR%%/kamailio.cfg.sample
-%%ETCDIR%%/kamctlrc.sample
+%%LUAJIT%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.app_lua
+%%LUAJIT%%lib/kamailio/modules/app_lua.so
 %%MYSQL%%%%DATADIR%%/mysql/acc-create.sql
 %%MYSQL%%%%DATADIR%%/mysql/alias_db-create.sql
 %%MYSQL%%%%DATADIR%%/mysql/auth_db-create.sql
@@ -214,8 +214,8 @@
 %%PERL%%lib/kamailio/perl/Kamailio/VDB/Pair.pm
 %%PERL%%lib/kamailio/perl/Kamailio/VDB/ReqCond.pm
 %%PERL%%lib/kamailio/perl/Kamailio/VDB/Result.pm
-%%PERL%%lib/kamailio/perl/Kamailio/VDB/Value.pm
 %%PERL%%lib/kamailio/perl/Kamailio/VDB/VTab.pm
+%%PERL%%lib/kamailio/perl/Kamailio/VDB/Value.pm
 %%PGSQL%%%%DATADIR%%/postgres/acc-create.sql
 %%PGSQL%%%%DATADIR%%/postgres/alias_db-create.sql
 %%PGSQL%%%%DATADIR%%/postgres/auth_db-create.sql
@@ -264,6 +264,7 @@
 %%PGSQL%%lib/kamailio/kamctl/kamdbctl.pgsql
 %%PGSQL%%lib/kamailio/modules/db_postgres.so
 %%PORTDOCS%%%%DOCSDIR%%/INSTALL
+%%PORTDOCS%%%%DOCSDIR%%/README
 %%PORTDOCS%%%%DOCSDIR%%/modules/README.acc_diameter
 %%PORTDOCS%%%%DOCSDIR%%/modules/README.app_jsdt
 %%PORTDOCS%%%%DOCSDIR%%/modules/README.app_sqlang
@@ -350,7 +351,6 @@
 %%PORTDOCS%%%%DOCSDIR%%/modules/README.xhttp_rpc
 %%PORTDOCS%%%%DOCSDIR%%/modules/README.xlog
 %%PORTDOCS%%%%DOCSDIR%%/modules/README.xprint
-%%PORTDOCS%%%%DOCSDIR%%/README
 %%PRESENCE%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.presence
 %%PRESENCE%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.presence_conference
 %%PRESENCE%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.presence_dialoginfo
@@ -368,41 +368,45 @@
 %%PRESENCE%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.rls
 %%PRESENCE%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.xcap_client
 %%PRESENCE%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.xcap_server
+%%PRESENCE%%lib/kamailio/modules/presence.so
 %%PRESENCE%%lib/kamailio/modules/presence_conference.so
 %%PRESENCE%%lib/kamailio/modules/presence_dialoginfo.so
 %%PRESENCE%%lib/kamailio/modules/presence_mwi.so
 %%PRESENCE%%lib/kamailio/modules/presence_profile.so
 %%PRESENCE%%lib/kamailio/modules/presence_reginfo.so
 %%PRESENCE%%lib/kamailio/modules/presence_xml.so
-%%PRESENCE%%lib/kamailio/modules/presence.so
+%%PRESENCE%%lib/kamailio/modules/pua.so
 %%PRESENCE%%lib/kamailio/modules/pua_bla.so
 %%PRESENCE%%lib/kamailio/modules/pua_dialoginfo.so
 %%PRESENCE%%lib/kamailio/modules/pua_reginfo.so
 %%PRESENCE%%lib/kamailio/modules/pua_rpc.so
 %%PRESENCE%%lib/kamailio/modules/pua_usrloc.so
 %%PRESENCE%%lib/kamailio/modules/pua_xmpp.so
-%%PRESENCE%%lib/kamailio/modules/pua.so
 %%PRESENCE%%lib/kamailio/modules/rls.so
 %%PRESENCE%%lib/kamailio/modules/xcap_client.so
 %%PRESENCE%%lib/kamailio/modules/xcap_server.so
-%%RADIUS%%%%ETCDIR%%/dictionary.kamailio.sample
+%%PYTHON3%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.app_python3
+%%PYTHON3%%lib/kamailio/modules/app_python3.so
 %%RADIUS%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.acc_radius
 %%RADIUS%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.auth_radius
 %%RADIUS%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.misc_radius
 %%RADIUS%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.peering
+%%RADIUS%%@sample %%ETCDIR%%/dictionary.kamailio.sample
 %%RADIUS%%lib/kamailio/modules/acc_radius.so
 %%RADIUS%%lib/kamailio/modules/auth_radius.so
 %%RADIUS%%lib/kamailio/modules/misc_radius.so
 %%RADIUS%%lib/kamailio/modules/peering.so
 %%SCTP%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.sctp
 %%SCTP%%lib/kamailio/modules/sctp.so
-%%TLS%%%%ETCDIR%%/tls.cfg.sample
 %%TLS%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.tls
+%%TLS%%@sample %%ETCDIR%%/tls.cfg.sample
 %%TLS%%lib/kamailio/modules/tls.so
 %%UNIXODBC%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.db_unixodbc
 %%UNIXODBC%%lib/kamailio/modules/db_unixodbc.so
 %%WEBSOCKET%%%%PORTDOCS%%%%DOCSDIR%%/modules/README.websocket
 %%WEBSOCKET%%lib/kamailio/modules/websocket.so
+@sample %%ETCDIR%%/kamailio.cfg.sample
+@sample %%ETCDIR%%/kamctlrc.sample
 lib/kamailio/kamctl/kamctl.base
 lib/kamailio/kamctl/kamctl.ctlbase
 lib/kamailio/kamctl/kamctl.rpcfifo
@@ -421,9 +425,9 @@ lib/kamailio/modules/acc_diameter.so
 lib/kamailio/modules/app_jsdt.so
 lib/kamailio/modules/app_sqlang.so
 lib/kamailio/modules/async.so
+lib/kamailio/modules/auth.so
 lib/kamailio/modules/auth_diameter.so
 lib/kamailio/modules/auth_xkeys.so
-lib/kamailio/modules/auth.so
 lib/kamailio/modules/avp.so
 lib/kamailio/modules/benchmark.so
 lib/kamailio/modules/blst.so
@@ -438,8 +442,8 @@ lib/kamailio/modules/counters.so
 lib/kamailio/modules/ctl.so
 lib/kamailio/modules/debugger.so
 lib/kamailio/modules/diversion.so
-lib/kamailio/modules/dmq_usrloc.so
 lib/kamailio/modules/dmq.so
+lib/kamailio/modules/dmq_usrloc.so
 lib/kamailio/modules/domainpolicy.so
 lib/kamailio/modules/enum.so
 lib/kamailio/modules/evrexec.so
@@ -461,8 +465,8 @@ lib/kamailio/modules/nosip.so
 lib/kamailio/modules/path.so
 lib/kamailio/modules/pdb.so
 lib/kamailio/modules/pike.so
-lib/kamailio/modules/print_lib.so
 lib/kamailio/modules/print.so
+lib/kamailio/modules/print_lib.so
 lib/kamailio/modules/pv.so
 lib/kamailio/modules/qos.so
 lib/kamailio/modules/ratelimit.so
@@ -499,8 +503,8 @@ lib/kamailio/modules/topoh.so
 lib/kamailio/modules/topos.so
 lib/kamailio/modules/tsilo.so
 lib/kamailio/modules/uac_redirect.so
-lib/kamailio/modules/xhttp_rpc.so
 lib/kamailio/modules/xhttp.so
+lib/kamailio/modules/xhttp_rpc.so
 lib/kamailio/modules/xlog.so
 lib/kamailio/modules/xprint.so
 man/man5/kamailio.cfg.5.gz



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910030926.x939QBU6062848>