pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

coturn: Merge improvements from net/coturn



Module Name:	pkgsrc-wip
Committed By:	Greg Troxel <gdt%lexort.com@localhost>
Pushed By:	gdt
Date:		Thu Jan 23 12:00:59 2025 -0500
Changeset:	28446465182375ba9882e491357be6ab8a94b130

Modified Files:
	coturn/Makefile
	coturn/files/turnserver.sh
	coturn/options.mk

Log Message:
coturn: Merge improvements from net/coturn

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=28446465182375ba9882e491357be6ab8a94b130

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 coturn/Makefile            | 48 ++++++++++++++++++++++++++--------------------
 coturn/files/turnserver.sh | 31 +++++++++++++++++++++++++-----
 coturn/options.mk          | 26 ++++++++++++-------------
 3 files changed, 66 insertions(+), 39 deletions(-)

diffs:
diff --git a/coturn/Makefile b/coturn/Makefile
index 93a8b996df..af8e34108e 100644
--- a/coturn/Makefile
+++ b/coturn/Makefile
@@ -1,10 +1,9 @@
 # $NetBSD$
 
 DISTNAME=	coturn-4.6.3
-PKGREVISION=	5
+PKGREVISION=	6
 CATEGORIES=	net
 MASTER_SITES=	${MASTER_SITE_GITHUB:=coturn/}
-GITHUB_PROJECT=	coturn
 
 MAINTAINER=	kethzer.dr%gmail.com@localhost
 #MAINTAINER+=	gdt%NetBSD.org@localhost
@@ -12,20 +11,32 @@ HOMEPAGE=	https://github.com/coturn/coturn
 COMMENT=	TURN and STUN server (for VoIP/webrtc)
 LICENSE=	modified-bsd
 
-USE_LANGUAGES=	c c++
+USE_LANGUAGES=		c c++
+USE_LIBTOOL=		yes
+USE_TOOLS+=		pkg-config
+HAS_CONFIGURE=		yes
+CONFIGURE_ARGS+=	--disable-rpath
+CONFIGURE_ARGS+=	--localstatedir ${VARBASE}/turnserver
+CONFIGURE_ARGS+=	--prefix ${PREFIX}
 
-USE_TOOLS+=	pkg-config
-USE_LIBTOOL=	yes
+# Pass cflags/libs
+CONFIGURE_ENV+=		LIBEVENT_OPENSSL_CFLAGS="-I${BUILDLINK_PREFIX.libevent}/include"
+CONFIGURE_ENV+=		LIBEVENT_OPENSSL_LIBS="-L${BUILDLINK_PREFIX.libevent}/lib -levent_openssl -levent"
 
-HAS_CONFIGURE=	yes
+# \todo File a bug upstream, or explain why the warning is wrong.
+CFLAGS+=	-Wno-stringop-truncation
 
-.include "../../mk/bsd.prefs.mk"
-.include "options.mk"
+COTURN_CONFIG=	${PKG_SYSCONFDIR}/turnserver.conf
+COTURN_EGDIR=	${PREFIX}/share/examples/coturn
+CONF_FILES=	${COTURN_EGDIR}/etc/turnserver.conf ${COTURN_CONFIG}
+
+BUILD_DEFS+=	VARBASE
+RCD_SCRIPTS=	turnserver
 
 COTURN_USER?=	coturn
 COTURN_GROUP?=	${COTURN_USER}
 COTURN_DATA?=	${VARBASE}/db/coturn
-BUILD_DEFS+=	COTURN_USER COTURN_GROUP COTURN_DATA VARBASE
+BUILD_DEFS+=	COTURN_USER COTURN_GROUP COTURN_DATA
 
 OWN_DIRS_PERMS+=		${COTURN_DATA} ${COTURN_USER} ${COTURN_GROUP} 0770
 
@@ -37,18 +48,10 @@ PKG_GECOS.${COTURN_USER}=	coturn daemon user
 PKG_HOME.${COTURN_USER}=	${COTURN_DATA}
 PKG_SHELL.${COTURN_USER}=	${NOLOGIN}
 
-RCD_SCRIPTS=		turnserver
-
 FILES_SUBST+=	COTURN_USER=${COTURN_USER:Q}
 FILES_SUBST+=	COTURN_GROUP=${COTURN_GROUP:Q}
 FILES_SUBST+=	PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
 
-# Pass cflags/libs
-CONFIGURE_ENV+=		PTHREAD_LIBS=-pthread TURN_DISABLE_RPATH=1
-CONFIGURE_ENV+=		LIBEVENT_OPENSSL_CFLAGS="-I${BUILDLINK_PREFIX.libevent}/include"
-CONFIGURE_ENV+=		LIBEVENT_OPENSSL_LIBS="-L${BUILDLINK_PREFIX.libevent}/lib -levent_openssl -levent"
-
-CONFIGURE_ARGS+=	--prefix=${PREFIX}
 # Use coturn as docs/examples subdir name.  \todo No command-line argument?
 CONFIGURE_ENV+=		PORTNAME=coturn
 # Defaults to ${PREFIX}/etc; respect pkgsrc tunable.
@@ -56,14 +59,17 @@ CONFIGURE_ARGS+=	--confdir=${PKG_SYSCONFDIR}
 # Defaults to ${PREFIX}/var; give it a subdirectory.
 CONFIGURE_ARGS+=	--localstatedir=${COTURN_DATA}
 
-# \todo Why is there a db installed in /var?  Won't that overwrite the user's database?
+# \todo Why is there a db installed in /var?  If not within PREFIX we don't pick it up,
+# but it seems like a bug.
+
+.include "options.mk"
 
+# upstream installs both a .conf.default in etcdir, and the
+# pkgsrc-right-way .conf in egdir.
 post-install:
 	${RM} ${DESTDIR}${PKG_SYSCONFDIR}/turnserver.conf.default
 
-CONF_FILES+=		${PREFIX}/share/examples/coturn/etc/turnserver.conf ${PKG_SYSCONFDIR}/turnserver.conf
 
-
-.include "../../security/openssl/buildlink3.mk"
 .include "../../devel/libevent/buildlink3.mk"
+.include "../../security/openssl/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/coturn/files/turnserver.sh b/coturn/files/turnserver.sh
index f8db7a0c33..b427ca168f 100644
--- a/coturn/files/turnserver.sh
+++ b/coturn/files/turnserver.sh
@@ -14,20 +14,41 @@
 # turnserver_config (path):	Set to @PREFIX@/etc/turnserver.conf
 #				by default.
 
-. /etc/rc.subr
+if [ -f @SYSCONFBASE@/rc.subr ]; then
+  . @SYSCONFBASE@/rc.subr
+fi
 
 name="turnserver"
-rcvar=$name
+rcvar=${name}
+
+if [ -f @SYSCONFBASE@/rc.subr -a -d @SYSCONFBASE@/rc.d -a -f @SYSCONFBASE@/rc.d/DAEMON ]; then
+	load_rc_config $name
+elif [ -f @SYSCONFBASE@/rc.conf ]; then
+	. @SYSCONFBASE@/rc.conf
+fi
 
 : ${turnserver:=no}
 : ${turnserver_config=@PKG_SYSCONFDIR@/turnserver.conf}
 : ${coturn_user:=@COTURN_USER@}
 : ${coturn_group:=@COTURN_GROUP@}
 
-load_rc_config $name
-
+pidfile="@VARBASE@/run/${name}.pid"
 command="@PREFIX@/bin/${name}"
 command_args="--daemon --proc-user ${coturn_user} --proc-group ${coturn_user} -c ${turnserver_config}"
 required_files=${turnserver_config}
 
-run_rc_command "$1"
+if [ -f @SYSCONFBASE@/rc.subr -a -d @SYSCONFBASE@/rc.d -a -f @SYSCONFBASE@/rc.d/DAEMON ]; then
+	run_rc_command "$1"
+else
+	case "$1" in
+	stop)
+		if [ -r "${pidfile}" ]; then
+			@ECHO@ "Stopping ${name}."
+			kill `@CAT@ ${pidfile}`
+		fi
+		;;
+	*)
+		${command} ${command_args}
+		;;
+	esac
+fi
diff --git a/coturn/options.mk b/coturn/options.mk
index 54e2c29976..f8e20f7454 100644
--- a/coturn/options.mk
+++ b/coturn/options.mk
@@ -1,31 +1,31 @@
-# $NetBSD$
+# $NetBSD: options.mk,v 1.2 2025/01/23 16:24:02 adam Exp $
 
-PKG_OPTIONS_VAR=		PKG_OPTIONS.coturn
-PKG_SUPPORTED_OPTIONS=		hiredis mysql pgsql sqlite redis
-
-PKG_SUGGESTED_OPTIONS=		sqlite
+PKG_OPTIONS_VAR=	PKG_OPTIONS.coturn
+PKG_SUPPORTED_OPTIONS=	mysql pgsql sqlite redis
+PKG_SUGGESTED_OPTIONS=	sqlite
 
 .include "../../mk/bsd.options.mk"
 
-.if !empty(PKG_OPTIONS:Mhiredis)
+.if !empty(PKG_OPTIONS:Mredis)
 .include "../../databases/hiredis/buildlink3.mk"
+.else
+CONFIGURE_ENV+=		TURN_NO_HIREDIS=1
 .endif
 
 .if !empty(PKG_OPTIONS:Mmysql)
 .include "../../mk/mysql.buildlink3.mk"
+.else
+CONFIGURE_ENV+=		TURN_NO_MYSQL=1
 .endif
 
 .if !empty(PKG_OPTIONS:Mpgsql)
 .include "../../mk/pgsql.buildlink3.mk"
-# \todo Check/justify these settings.
-DBLIBS+=	${BUILDLINK_PREFIX.postgresql-lib}
-CONFIGURE_ENV+=	POSTCFLAGS="-I${PREFIX}/include/postgresql"
+.else
+CONFIGURE_ENV+=		TURN_NO_PQ=1
 .endif
 
 .if !empty(PKG_OPTIONS:Msqlite)
 .include "../../databases/sqlite3/buildlink3.mk"
-.endif
-
-.if !empty(PKG_OPTIONS:Mredis)
-DEPENDS+=	redis-[0-9]*:../../databases/redis
+.else
+CONFIGURE_ENV+=		TURN_NO_SQLITE=1
 .endif


Home | Main Index | Thread Index | Old Index