git: a91364449db6 - main - www/srt: Add options that define what encryption library to use

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 17 Jun 2022 04:03:53 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a91364449db6feed6fd47b86b0dcf4bca300c671

commit a91364449db6feed6fd47b86b0dcf4bca300c671
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-06-17 03:48:00 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-06-17 04:03:49 +0000

    www/srt: Add options that define what encryption library to use
---
 www/srt/Makefile | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/www/srt/Makefile b/www/srt/Makefile
index 2290a87910b0..c9865437080f 100644
--- a/www/srt/Makefile
+++ b/www/srt/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	srt
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.5.0
+PORTREVISION=	1
 CATEGORIES=	www
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -11,7 +12,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 RUN_DEPENDS=	bash:shells/bash
 
-USES=		cmake:testing compiler:c++11-lang shebangfix ssl
+USES=		cmake:testing compiler:c++11-lang shebangfix
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	Haivision
@@ -20,4 +21,27 @@ SHEBANG_FILES=	scripts/srt-ffplay
 
 CMAKE_TESTING_ON=	ENABLE_TESTING ENABLE_UNITTESTS # 2 tests are known to fail: https://github.com/Haivision/srt/issues/2389, https://github.com/Haivision/srt/issues/2390
 
+OPTIONS_RADIO=			ENCRYPTION
+OPTIONS_RADIO_ENCRYPTION=	NO_ENCRYPTION OPENSSL GNUTLS MBEDTLS
+OPTIONS_DEFAULT=		OPENSSL
+
+NO_ENCRYPTION_DESC=		No encryption
+NO_ENCRYPTION_CMAKE_ON=		-DENABLE_ENCRYPTION=OFF
+
+OPENSSL_CMAKE_ON=		-DUSE_ENCLIB=openssl
+OPENSSL_USES=			ssl
+
+GNUTLS_CMAKE_ON=		-DUSE_ENCLIB=gnutls
+GNUTLS_LIB_DEPENDS=		libgnutls.so:security/gnutls \
+				libnettle.so:security/nettle
+
+MBEDTLS_CMAKE_ON=		-DUSE_ENCLIB=mbedtls
+MBEDTLS_LIB_DEPENDS=		libmbedtls.so:security/mbedtls
+
+post-install-OPENSSL-on:
+	# fix .pc files
+	@${REINPLACE_CMD} -e 's|Requires.private: openssl libcrypto|Requires.private:|; s|Libs.private:.*|& -lssl -lcrypto|' \
+		${STAGEDIR}${PREFIX}/libdata/pkgconfig/srt.pc \
+		${STAGEDIR}${PREFIX}/libdata/pkgconfig/haisrt.pc
+
 .include <bsd.port.mk>