git: 515a9b9c7025 - main - math/sleef: Update to latest upstream commit (2021-04-05)

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Wed, 12 Apr 2023 08:45:30 UTC
The branch main has been updated by diizzy:

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

commit 515a9b9c7025c01f1782f3834df88a75fbebbc93
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-04-12 08:14:46 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-04-12 08:44:43 +0000

    math/sleef: Update to latest upstream commit (2021-04-05)
    
    This updates sleef to latest upstream commit
    85440a5e87dae36ca1b891de14bc83b441ae7c43 which fixes a bunch of things
    including AVX2 detection. DFT library is now disabled by default because
    it has issues indicated by issue reports in upstream repo. There are
    also some issues with unit tests and/or library itself which may
    results in bugs however unit tests works fine on 13.2-RELEASE amd64
    at least. Import patch from Debian to fix build of unit tests
    
    References:
    https://github.com/shibatch/sleef/issues/439
    https://salsa.debian.org/science-team/sleef/-/blob/master/debian/patches/disable-duplicate-mpfr-funcs.patch
    
    PR:             266784
    Reviewed by:    jmd (maintainer)
---
 math/sleef/Makefile                                |  9 +++--
 math/sleef/distinfo                                |  6 ++--
 .../files/patch-src_libm-tester_iutsimdmain.c      | 21 -----------
 .../files/patch-src_libm-tester_tester2simdsp.c    | 11 ------
 .../sleef/files/patch-src_libm-tester_testerutil.c | 42 +++++++++++++++++-----
 .../sleef/files/patch-src_libm-tester_testerutil.h | 10 ++++++
 math/sleef/pkg-plist                               | 15 ++++----
 7 files changed, 59 insertions(+), 55 deletions(-)

diff --git a/math/sleef/Makefile b/math/sleef/Makefile
index c0fbc978b690..58c39fbe3832 100644
--- a/math/sleef/Makefile
+++ b/math/sleef/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	sleef
-DISTVERSION=	3.5.0
-PORTREVISION=	3
+DISTVERSION=	3.5.1-62
+DISTVERSIONSUFFIX=	-g85440a5
 CATEGORIES=	math
 
 MAINTAINER=	jmd@FreeBSD.org
@@ -10,12 +10,15 @@ WWW=		https://sleef.org
 LICENSE=	BSL
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-USES=		cmake compiler:c11
+USES=		cmake:testing compiler:c11 pathfix
 USE_LDCONFIG=	yes
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	shibatch
 
+CMAKE_OFF=	BUILD_TESTS
+CMAKE_TESTING_ON=	BUILD_TESTS
+
 .include <bsd.port.options.mk>
 
 .if ${ARCH:Mpowerpc64*} || ${ARCH:Marmv?}
diff --git a/math/sleef/distinfo b/math/sleef/distinfo
index 43dde78c63ea..52040a5d61f5 100644
--- a/math/sleef/distinfo
+++ b/math/sleef/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1599336132
-SHA256 (shibatch-sleef-3.5.0_GH0.tar.gz) = 6b952560cec091477affcb18baf06bf50cef9f932ff6aba491a744ee8e77ffea
-SIZE (shibatch-sleef-3.5.0_GH0.tar.gz) = 1205317
+TIMESTAMP = 1664661522
+SHA256 (shibatch-sleef-3.5.1-62-g85440a5_GH0.tar.gz) = 6544ea223bdf6f5d7bfc58afb55942066125f5325b535dd0cb136248ece53c43
+SIZE (shibatch-sleef-3.5.1-62-g85440a5_GH0.tar.gz) = 1659120
diff --git a/math/sleef/files/patch-src_libm-tester_iutsimdmain.c b/math/sleef/files/patch-src_libm-tester_iutsimdmain.c
deleted file mode 100644
index 4adba3c77702..000000000000
--- a/math/sleef/files/patch-src_libm-tester_iutsimdmain.c
+++ /dev/null
@@ -1,21 +0,0 @@
---- src/libm-tester/iutsimdmain.c.orig	2021-11-18 16:48:35 UTC
-+++ src/libm-tester/iutsimdmain.c
-@@ -9,16 +9,16 @@
- #include <signal.h>
- #include <setjmp.h>
- 
--static jmp_buf sigjmp;
--
- int do_test(int argc, char **argv);
- int check_featureDP(double d);
- int check_featureSP(float d);
- 
- #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
-+static jmp_buf sigjmp;
- #define SETJMP(x) setjmp(x)
- #define LONGJMP longjmp
- #else
-+static sigjmp_buf sigjmp;
- #define SETJMP(x) sigsetjmp(x, 1)
- #define LONGJMP siglongjmp
- #endif
diff --git a/math/sleef/files/patch-src_libm-tester_tester2simdsp.c b/math/sleef/files/patch-src_libm-tester_tester2simdsp.c
deleted file mode 100644
index 888501278a4b..000000000000
--- a/math/sleef/files/patch-src_libm-tester_tester2simdsp.c
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/libm-tester/tester2simdsp.c.orig	2021-11-18 16:25:52 UTC
-+++ src/libm-tester/tester2simdsp.c
-@@ -828,7 +828,7 @@ int main(int argc,char **argv)
-       double u0 = countULPsp(t = vget(xacoshf(vd), e), frx);
-       
-       if ((fabs(d) < sqrt(FLT_MAX) && u0 > 1.0001) ||
--	  (d >=  sqrt(FLT_MAX) && !(u0 <= 1.0001 || (isinff(t) && t > 0))) ||
-+	  (d >=  sqrt(FLT_MAX) && !(u0 <= 1.0001 || (isinf(t) && t > 0))) ||
- 	  (d <= -sqrt(FLT_MAX) && !isnan(t))) {
- 	printf(ISANAME " acoshf arg=%.20g ulp=%.20g\n", d, u0);
- 	fflush(stdout); ecnt++;
diff --git a/math/sleef/files/patch-src_libm-tester_testerutil.c b/math/sleef/files/patch-src_libm-tester_testerutil.c
index b06eab3f5e06..88736d53aac8 100644
--- a/math/sleef/files/patch-src_libm-tester_testerutil.c
+++ b/math/sleef/files/patch-src_libm-tester_testerutil.c
@@ -1,11 +1,35 @@
---- src/libm-tester/testerutil.c.orig	2021-11-18 16:26:40 UTC
+--- src/libm-tester/testerutil.c.orig	2021-04-05 11:53:56 UTC
 +++ src/libm-tester/testerutil.c
-@@ -45,7 +45,7 @@ int isMinusZero(double x) { return x == 0 && copysign(
- double sign(double d) { return d < 0 ? -1 : 1; }
- int xisnan(double x) { return x != x; }
+@@ -289,32 +289,6 @@ double countULP2sp(float d, mpfr_t c0) {
  
--int isnumberf(float x) { return !isinff(x) && !isnanf(x); }
-+int isnumberf(float x) { return !isinf(x) && !isnanf(x); }
- int isPlusZerof(float x) { return x == 0 && copysignf(1, x) == 1; }
- int isMinusZerof(float x) { return x == 0 && copysignf(1, x) == -1; }
- float signf(float d) { return d < 0 ? -1 : 1; }
+ //
+ 
+-void mpfr_sinpi(mpfr_t ret, mpfr_t arg, mpfr_rnd_t rnd) {
+-  mpfr_t frpi, frd;
+-  mpfr_inits(frpi, frd, NULL);
+-
+-  mpfr_const_pi(frpi, GMP_RNDN);
+-  mpfr_set_d(frd, 1.0, GMP_RNDN);
+-  mpfr_mul(frpi, frpi, frd, GMP_RNDN);
+-  mpfr_mul(frd, frpi, arg, GMP_RNDN);
+-  mpfr_sin(ret, frd, GMP_RNDN);
+-
+-  mpfr_clears(frpi, frd, NULL);
+-}
+-
+-void mpfr_cospi(mpfr_t ret, mpfr_t arg, mpfr_rnd_t rnd) {
+-  mpfr_t frpi, frd;
+-  mpfr_inits(frpi, frd, NULL);
+-
+-  mpfr_const_pi(frpi, GMP_RNDN);
+-  mpfr_set_d(frd, 1.0, GMP_RNDN);
+-  mpfr_mul(frpi, frpi, frd, GMP_RNDN);
+-  mpfr_mul(frd, frpi, arg, GMP_RNDN);
+-  mpfr_cos(ret, frd, GMP_RNDN);
+-
+-  mpfr_clears(frpi, frd, NULL);
+-}
+-
+ void mpfr_lgamma_nosign(mpfr_t ret, mpfr_t arg, mpfr_rnd_t rnd) {
+   int s;
+   mpfr_lgamma(ret, &s, arg, rnd);
diff --git a/math/sleef/files/patch-src_libm-tester_testerutil.h b/math/sleef/files/patch-src_libm-tester_testerutil.h
new file mode 100644
index 000000000000..7180c654214f
--- /dev/null
+++ b/math/sleef/files/patch-src_libm-tester_testerutil.h
@@ -0,0 +1,10 @@
+--- src/libm-tester/testerutil.h.orig	2021-04-05 11:53:56 UTC
++++ src/libm-tester/testerutil.h
+@@ -90,7 +90,5 @@ int cmpDenormsp(float x, mpfr_t fry);
+ double countULPsp(float d, mpfr_t c);
+ double countULP2sp(float d, mpfr_t c);
+ 
+-void mpfr_sinpi(mpfr_t ret, mpfr_t arg, mpfr_rnd_t rnd);
+-void mpfr_cospi(mpfr_t ret, mpfr_t arg, mpfr_rnd_t rnd);
+ void mpfr_lgamma_nosign(mpfr_t ret, mpfr_t arg, mpfr_rnd_t rnd);
+ #endif
diff --git a/math/sleef/pkg-plist b/math/sleef/pkg-plist
index 0fed0d7d0654..401838754a81 100644
--- a/math/sleef/pkg-plist
+++ b/math/sleef/pkg-plist
@@ -1,12 +1,11 @@
 include/sleef.h
-include/sleefdft.h
+lib/cmake/sleef/sleefConfig.cmake
+lib/cmake/sleef/sleefConfigVersion.cmake
+lib/cmake/sleef/sleefTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/sleef/sleefTargets.cmake
 lib/libsleef.so
 lib/libsleef.so.3
-lib/libsleef.so.3.5.0
-lib/libsleefdft.so
-lib/libsleefdft.so.3
-lib/libsleefdft.so.3.5.0
-%%GNUABI%%lib/libsleefgnuabi.so
-%%GNUABI%%lib/libsleefgnuabi.so.3
-%%GNUABI%%lib/libsleefgnuabi.so.3.5
+lib/libsleef.so.3.6.0
 libdata/pkgconfig/sleef.pc
+%%GNUABI%%lib/libsleefgnuabi.so.3
+%%GNUABI%%lib/libsleefgnuabi.so.3.6