git: 0e851e515db8 - main - math/dsfmt: Improve port

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Sat, 18 Nov 2023 09:27:16 UTC
The branch main has been updated by diizzy:

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

commit 0e851e515db85671a196c382a2cbfc0e3f32ec14
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-11-17 19:30:06 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-11-18 09:24:49 +0000

    math/dsfmt: Improve port
    
    * Rearrange Makefile to follow Porters Handbook more closely
    * Use USE_CSTD helper
    * Adjust CFLAGS
    * Use OPTIMIZED_CFLAGS option
    
    PR:             275042
    Reviewed by:    thierry (maintainer)
---
 math/dsfmt/Makefile | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/math/dsfmt/Makefile b/math/dsfmt/Makefile
index 6db9b98c10ef..63204795b35e 100644
--- a/math/dsfmt/Makefile
+++ b/math/dsfmt/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	dSFMT
-PORTVERSION=	2.2.5
 DISTVERSIONPREFIX=	v
+DISTVERSION=	2.2.5
+PORTREVISION=	1
 CATEGORIES=	math
 
 MAINTAINER=	thierry@FreeBSD.org
@@ -10,43 +11,44 @@ WWW=		http://www.math.sci.hiroshima-u.ac.jp/m-mat/MT/SFMT/
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-USES=		compiler
-
 USE_GITHUB=	yes
 GH_ACCOUNT=	MersenneTwister-Lab
+USE_LDCONFIG=	yes
 
-CSTD=		c99
-CFLAGS+=	-DDSFMT_MEXP=19937 -fPIC -DDSFMT_SHLIB ${OPTCFLAGS}	\
-		-finline-functions -fomit-frame-pointer -fno-strict-aliasing	\
-		-Wall -shared
-OPTCFLAGS?=	-O3
-CFLAGS_amd64=	-msse2 -DHAVE_SSE2
+USE_CSTD=	c99
+CFLAGS+=	-DNDEBUG -DDSFMT_MEXP=19937 -DDSFMT_DO_NOT_USE_OLD_NAMES \
+		-fPIC -DDSFMT_SHLIB -finline-functions -fomit-frame-pointer \
+		-fno-strict-aliasing -Wall -shared
+CFLAGS_amd64=	-DHAVE_SSE2
 LDFLAGS+=	-Wl,-soname,libdSFMT.so.0
-USE_LDCONFIG=	yes
 
-OPTIONS_DEFINE=	DOCS
+OPTIONS_DEFINE=		DOCS OPTIMIZED_CFLAGS
+OPTIONS_DEFAULT=	OPTIMIZED_CFLAGS
+
+OPTIMIZED_CFLAGS_CFLAGS=	-O3
 
 .include <bsd.port.pre.mk>
 
 .if ${ARCH} == amd64
 TEST_TARGET=	sse2-check
+MAKE_FLAGS=	SSE2FLAGS="-DHAVE_SSE2" -f
 .else
 TEST_TARGET=	std-check
 .endif
 
 do-build:
-	(cd ${WRKSRC} &&	\
-	${CC} ${CFLAGS} ${LDFLAGS} dSFMT.c -o libdSFMT.so.0)
+	(cd ${WRKSRC} && ${CC} ${CFLAGS} ${LDFLAGS} dSFMT.c -o libdSFMT.so.0)
 
 do-install:
 	${INSTALL_DATA} ${WRKSRC}/dSFMT.h ${STAGEDIR}${PREFIX}/include/
 	${INSTALL_LIB} ${WRKSRC}/libdSFMT.so.0 ${STAGEDIR}${PREFIX}/lib
-	(cd ${STAGEDIR}${PREFIX}/lib && ${LN} -s libdSFMT.so.0 libdSFMT.so)
+	${RLN} ${STAGEDIR}${PREFIX}/lib/libdSFMT.so.0 \
+		${STAGEDIR}${PREFIX}/lib/libdSFMT.so
 
 do-install-DOCS-on:
 	${MKDIR} ${STAGEDIR}${DOCSDIR}/html
 	${INSTALL_DATA} ${WRKSRC}/README.* ${STAGEDIR}${DOCSDIR}
-	cd ${WRKSRC}/html && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/html
+	(cd ${WRKSRC}/html && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR}/html)
 
 do-test:
 	${REINPLACE_CMD} -e '/^CC =/d;/^CCFLAGS =/d' ${WRKSRC}/Makefile