1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

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)
This commit is contained in:
Daniel Engberg 2023-11-17 20:30:06 +01:00
parent d131558deb
commit 0e851e515d

View File

@ -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
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
LDFLAGS+= -Wl,-soname,libdSFMT.so.0
USE_LDCONFIG= yes
OPTIONS_DEFINE= DOCS
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
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