git: 79a0481d1c47 - main - security/s2n-tls: Various improvements

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Tue, 13 Sep 2022 15:17:24 UTC
The branch main has been updated by eduardo:

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

commit 79a0481d1c47b13fa8aa7b97803bea264e1fd13f
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2022-09-13 15:08:48 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2022-09-13 15:16:48 +0000

    security/s2n-tls: Various improvements
    
     - Define LICENSE_FILE
     - Use ports framework for unit testing
     - Add option for assembly optimization and LTO
     - Disable building tests by default
     - Disable assembly optimization by default (requires AVX2 and BMI2 support without runtime detection)
     - Use CMake helpers provided by framework
     - Rename s2n -> s2n-tls to match upstream name
    
    PR:             266397
---
 MOVED                                            |  1 +
 security/Makefile                                |  2 +-
 security/{s2n => s2n-tls}/Makefile               | 24 +++++++++++++++---------
 security/{s2n => s2n-tls}/distinfo               |  0
 security/{s2n => s2n-tls}/files/patch-bin_s2nd.c |  0
 security/{s2n => s2n-tls}/files/pkg-message.in   |  0
 security/{s2n => s2n-tls}/pkg-descr              |  0
 security/{s2n => s2n-tls}/pkg-plist              |  0
 8 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/MOVED b/MOVED
index 9cef5e7aa841..96d6c963bc58 100644
--- a/MOVED
+++ b/MOVED
@@ -17556,3 +17556,4 @@ graphics/drm-54-kmod|graphics/drm-510-kmod|2022-09-07|Obsolete, use graphics/drm
 archivers/ppmd-7z|archivers/7-zip|2022-09-11|ppmd-7z was a mis-named p7zip project that is unmaintained and has numerous vulnerabilities, users should use 7-zip instead
 science/R-cran-AMORE||2022-09-12|Has expired: Upstream no longer maintained
 www/moodle310|www/moodle311|2022-09-12|Has expired: Upstream no longer maintained, upgrade to next LTS
+security/s2n|security/s2n-tls|2022-09-13|Moved to match upstream name
diff --git a/security/Makefile b/security/Makefile
index f431c2eac45e..f2313d2c6fb5 100644
--- a/security/Makefile
+++ b/security/Makefile
@@ -1153,7 +1153,7 @@
     SUBDIR += rubygem-webauthn
     SUBDIR += rubygem-webpush
     SUBDIR += rustscan
-    SUBDIR += s2n
+    SUBDIR += s2n-tls
     SUBDIR += safesh
     SUBDIR += samhain
     SUBDIR += samhain-client
diff --git a/security/s2n/Makefile b/security/s2n-tls/Makefile
similarity index 64%
rename from security/s2n/Makefile
rename to security/s2n-tls/Makefile
index d0267dbb2dac..8c2480eff0e7 100644
--- a/security/s2n/Makefile
+++ b/security/s2n-tls/Makefile
@@ -1,6 +1,7 @@
-PORTNAME=	s2n
+PORTNAME=	s2n-tls
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.3.20
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	security
 
@@ -9,29 +10,34 @@ COMMENT=	C99 implementation of the TLS/SSL protocols
 WWW=		https://github.com/aws/s2n-tls
 
 LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		cmake ssl
+USES=		cmake:testing ssl
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	aws
-GH_PROJECT=	s2n-tls
 
 USE_LDCONFIG=	yes
-CMAKE_ARGS+=	-DBUILD_SHARED_LIBS=ON
+CMAKE_OFF=	BUILD_TESTING
+CMAKE_ON=	BUILD_SHARED_LIBS
 
 SUB_FILES=	pkg-message
 
-OPTIONS_DEFINE=	DOCS EXAMPLES TEST
+OPTIONS_DEFINE=	DOCS EXAMPLES LTO
+OPTIONS_DEFINE_amd64=	ASM
+OPTIONS_DEFAULT=	LTO
+
+ASM_DESC=	Enable PQ crypto assembly (reqs AVX2 and BMI2 support)
+
+ASM_CMAKE_OFF=	-DS2N_NO_PQ_ASM=1
+LTO_CMAKE_BOOL=	S2N_LTO
 
 .include <bsd.port.options.mk>
 
 .if ${ARCH} != aarch64 && ${ARCH} != amd64 && ${ARCH} != arm && ${ARCH} != armv6 && ${ARCH} != armv7 && ${ARCH} != i386
-CMAKE_ARGS+=	-DS2N_NO_PQ:BOOL=ON
+CMAKE_ON+=	S2N_NO_PQ
 .endif
 
-post-build-TEST-on:
-	(cd ${WRKDIR}/.build && ninja test)
-
 post-install:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
 	${CP} -r ${WRKSRC}/docs/* ${STAGEDIR}${DOCSDIR}
diff --git a/security/s2n/distinfo b/security/s2n-tls/distinfo
similarity index 100%
rename from security/s2n/distinfo
rename to security/s2n-tls/distinfo
diff --git a/security/s2n/files/patch-bin_s2nd.c b/security/s2n-tls/files/patch-bin_s2nd.c
similarity index 100%
rename from security/s2n/files/patch-bin_s2nd.c
rename to security/s2n-tls/files/patch-bin_s2nd.c
diff --git a/security/s2n/files/pkg-message.in b/security/s2n-tls/files/pkg-message.in
similarity index 100%
rename from security/s2n/files/pkg-message.in
rename to security/s2n-tls/files/pkg-message.in
diff --git a/security/s2n/pkg-descr b/security/s2n-tls/pkg-descr
similarity index 100%
rename from security/s2n/pkg-descr
rename to security/s2n-tls/pkg-descr
diff --git a/security/s2n/pkg-plist b/security/s2n-tls/pkg-plist
similarity index 100%
rename from security/s2n/pkg-plist
rename to security/s2n-tls/pkg-plist