From owner-dev-commits-ports-all@freebsd.org Sat May 8 09:57:28 2021 Return-Path: Delivered-To: dev-commits-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF8A062FF92; Sat, 8 May 2021 09:57:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FcjRD5gp7z4jdX; Sat, 8 May 2021 09:57:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1BF51CE85; Sat, 8 May 2021 09:57:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1489vSpJ001401; Sat, 8 May 2021 09:57:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1489vSie001400; Sat, 8 May 2021 09:57:28 GMT (envelope-from git) Date: Sat, 8 May 2021 09:57:28 GMT Message-Id: <202105080957.1489vSie001400@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Matthias Andree Subject: git: bce7a5281d73 - main - math/Imath: relax user to C++11, regression fix MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mandree X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bce7a5281d73fdb32cea90cd144056d78cea8bc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the ports repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2021 09:57:29 -0000 The branch main has been updated by mandree: URL: https://cgit.FreeBSD.org/ports/commit/?id=bce7a5281d73fdb32cea90cd144056d78cea8bc2 commit bce7a5281d73fdb32cea90cd144056d78cea8bc2 Author: Matthias Andree AuthorDate: 2021-05-08 09:52:43 +0000 Commit: Matthias Andree CommitDate: 2021-05-08 09:52:43 +0000 math/Imath: relax user to C++11, regression fix Cherry-pick an upstream fix to relax users to C++11, only the Imath code itself requires C++14. Cherry-pick an upstream fix for a regression in succf()/predf(). While here, run tests in parallel and clean up for portclippy. --- math/Imath/Makefile | 9 +- math/Imath/files/patch-1c8a010f9 | 49 +++++++++++ math/Imath/files/patch-6ddc8294f | 183 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+), 3 deletions(-) diff --git a/math/Imath/Makefile b/math/Imath/Makefile index 7667dcba655d..734e1a9770d9 100644 --- a/math/Imath/Makefile +++ b/math/Imath/Makefile @@ -2,6 +2,7 @@ PORTNAME= Imath PORTVERSION= 3.0.1 +PORTREVISION= 1 CATEGORIES= math devel graphics MAINTAINER= mandree@FreeBSD.org @@ -18,6 +19,8 @@ USE_LDCONFIG= yes CMAKE_ARGS+= -DCMAKE_DEBUG_POSTFIX= \ -DCMAKE_INSTALL_PREFIX=${PREFIX} +PATCH_STRIP= -p1 + PLIST_SUB= MAJORVER=${_MAJORVER} \ MINVER=${_MINVER} \ PLVER=${_PLVER} \ @@ -31,11 +34,11 @@ OPTIONS_SUB= yes LARGE_STACK_DESC= Enable sys-dependent large stack optimizations LARGE_STACK_CMAKE_BOOL= IMATH_ENABLE_LARGE_STACK +PYTHON_BUILD_DEPENDS= ${PYNUMPY} PYTHON_LIB_DEPENDS= ${PY_BOOST} +PYTHON_RUN_DEPENDS= ${PYNUMPY} PYTHON_USES= python PYTHON_CMAKE_BOOL= PYTHON -PYTHON_BUILD_DEPENDS= ${PYNUMPY} -PYTHON_RUN_DEPENDS= ${PYNUMPY} _MAJORVER= 3_0 _VER= 27 @@ -51,6 +54,6 @@ post-install: ${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR} do-test: - cd ${BUILD_WRKSRC} && ctest + cd ${BUILD_WRKSRC} && ctest -j ${MAKE_JOBS_NUMBER} .include diff --git a/math/Imath/files/patch-1c8a010f9 b/math/Imath/files/patch-1c8a010f9 new file mode 100644 index 000000000000..d360dfcc1589 --- /dev/null +++ b/math/Imath/files/patch-1c8a010f9 @@ -0,0 +1,49 @@ +From 1c8a010f9c48fb9c8dd5330337936802c3dee2bd Mon Sep 17 00:00:00 2001 +From: Larry Gritz +Date: Thu, 15 Apr 2021 17:41:11 -0700 +Subject: [PATCH] Don't impose C++14 on downstream projects (#137) + +We were setting + + target_compile_features(${objlib} PUBLIC cxx_std_${IMATH_CXX_STANDARD}) + +The PUBLIC forced downstream projects that consume the +ImathConfig*.cmake exports to use C++ standard at least as recent as +what Imath used to build (which defaults to 14). + +But this is unnecessary. There's nothing in Imath's headers that +requires anything beyond C++11. So this patch uses a more fine-grained +setting of target properties to express this more correctly. Now it +will be fine for a C++11 project to consume Imath (via its exported +configs) even if that Imath happened to be built with C++14. + +This change is exactly the same as +https://github.com/AcademySoftwareFoundation/openexr/pull/995 + +Signed-off-by: Larry Gritz +--- + config/LibraryDefine.cmake | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/config/LibraryDefine.cmake b/config/LibraryDefine.cmake +index 7770d71..faf430e 100644 +--- a/config/LibraryDefine.cmake ++++ b/config/LibraryDefine.cmake +@@ -14,7 +14,16 @@ function(IMATH_DEFINE_LIBRARY libname) + ${IMATH_CURLIB_HEADERS} + ${IMATH_CURLIB_SOURCES}) + +- target_compile_features(${objlib} PUBLIC cxx_std_${IMATH_CXX_STANDARD}) ++ # Use ${IMATH_CXX_STANDARD} to determine the standard we use to compile ++ # Imath itself. But the headers only require C++11 features, so that's ++ # all we need to pass on as interface reqirements to downstream projects. ++ # For example, it's fine for an Imath built with C++14 to be called from ++ # an app that is compiled with C++11; Imath needn't force the app to ++ # also use C++14. ++ target_compile_features(${objlib} ++ PRIVATE cxx_std_${IMATH_CXX_STANDARD} ++ INTERFACE cxx_std_11 ) ++ + if(IMATH_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS) + target_compile_definitions(${objlib} PRIVATE ${IMATH_CURLIB_PRIV_EXPORT}) + if(WIN32) diff --git a/math/Imath/files/patch-6ddc8294f b/math/Imath/files/patch-6ddc8294f new file mode 100644 index 000000000000..eeaeae4d0e88 --- /dev/null +++ b/math/Imath/files/patch-6ddc8294f @@ -0,0 +1,183 @@ +From 6ddc8294f319dfd6ac27b511f65f5900f819eca5 Mon Sep 17 00:00:00 2001 +From: Cary Phillips +Date: Fri, 7 May 2021 14:27:47 -0700 +Subject: [PATCH] Fix regression in succf()/predf() (#140) + +And add more thorough test. + +Signed-off-by: Cary Phillips +--- + src/Imath/ImathFun.cpp | 4 +- + src/ImathTest/testFun.cpp | 86 +++++++++++++++++++++++++++++---------- + 2 files changed, 67 insertions(+), 23 deletions(-) + +diff --git a/src/Imath/ImathFun.cpp b/src/Imath/ImathFun.cpp +index 62ecadf..793927c 100644 +--- a/src/Imath/ImathFun.cpp ++++ b/src/Imath/ImathFun.cpp +@@ -27,7 +27,7 @@ succf (float f) noexcept + + u.i = 0x00000001; + } +- else if (u.i > 0) ++ else if (u.f > 0) + { + // Positive float, normalized or denormalized. + // Incrementing the largest positive float +@@ -65,7 +65,7 @@ predf (float f) noexcept + + u.i = 0x80000001; + } +- else if (u.i > 0) ++ else if (u.f > 0) + { + // Positive float, normalized or denormalized. + +diff --git a/src/ImathTest/testFun.cpp b/src/ImathTest/testFun.cpp +index abb2bd3..56db842 100644 +--- a/src/ImathTest/testFun.cpp ++++ b/src/ImathTest/testFun.cpp +@@ -8,6 +8,10 @@ + #endif + + #include "ImathFun.h" ++#if __cplusplus >= 202002L ++# include ++#endif ++#include + #include + #include + #include +@@ -18,16 +22,32 @@ using namespace std; + #if ULONG_MAX == 18446744073709551615LU + typedef long unsigned int Int64; + #else +-typedef long long unsigned int Int64; ++ typedef long long unsigned int Int64; ++#endif ++ ++#if __cplusplus < 202002L ++ template ++ static inline To ++ bit_cast (From from) ++ { ++ static_assert (sizeof (From) == sizeof (To), "Type sizes do not match"); ++ union ++ { ++ From f; ++ To t; ++ } u; ++ u.f = from; ++ return u.t; ++ } + #endif + + void +-testf (float f) ++testf (float f, bool changeExpected = true) + { + printf ("\n"); + +- float sf = IMATH_INTERNAL_NAMESPACE::succf (f); +- float pf = IMATH_INTERNAL_NAMESPACE::predf (f); ++ float sf = IMATH_INTERNAL_NAMESPACE::succf (f); ++ float pf = IMATH_INTERNAL_NAMESPACE::predf (f); + float spf = IMATH_INTERNAL_NAMESPACE::succf (IMATH_INTERNAL_NAMESPACE::predf (f)); + float psf = IMATH_INTERNAL_NAMESPACE::predf (IMATH_INTERNAL_NAMESPACE::succf (f)); + +@@ -36,15 +56,29 @@ testf (float f) + printf ("pf %.9g\n", pf); + printf ("spf %.9g\n", spf); + printf ("psf %.9g\n", psf); ++ ++ fflush (stdout); ++ ++ if (changeExpected) ++ { ++ assert (pf < f); ++ assert (f < sf); ++ } ++ else ++ { ++ // No bit change expected if input was inf or NaN ++ assert (bit_cast (pf) == bit_cast (f)); ++ assert (bit_cast (sf) == bit_cast (f)); ++ } + } + + void +-testd (double d) ++testd (double d, bool changeExpected = true) + { + printf ("\n"); + +- double sd = IMATH_INTERNAL_NAMESPACE::succd (d); +- double pd = IMATH_INTERNAL_NAMESPACE::predd (d); ++ double sd = IMATH_INTERNAL_NAMESPACE::succd (d); ++ double pd = IMATH_INTERNAL_NAMESPACE::predd (d); + double spd = IMATH_INTERNAL_NAMESPACE::succd (IMATH_INTERNAL_NAMESPACE::predd (d)); + double psd = IMATH_INTERNAL_NAMESPACE::predd (IMATH_INTERNAL_NAMESPACE::succd (d)); + +@@ -53,6 +87,20 @@ testd (double d) + printf ("pd %.18lg\n", pd); + printf ("spd %.18lg\n", spd); + printf ("psd %.18lg\n", psd); ++ ++ fflush (stdout); ++ ++ if (changeExpected) ++ { ++ assert (pd < d); ++ assert (d < sd); ++ } ++ else ++ { ++ // No bit change expected if input was inf or NaN ++ assert (bit_cast (pd) == bit_cast (d)); ++ assert (bit_cast (sd) == bit_cast (d)); ++ } + } + + void +@@ -196,15 +244,13 @@ testFun() + testf (7); + testf (0.7); + +- union +- { +- float f; +- int i; +- } u; ++ union {float f; int i;} u; + u.i = 0x7f800000; // inf +- testf (u.f); ++ testf (u.f, false); ++ u.i = 0xff800000; // -inf ++ testf (u.f, false); + u.i = 0x7f800001; // nan +- testf (u.f); ++ testf (u.f, false); + u.i = 0x7f7fffff; // FLT_MAX + testf (u.f); + u.i = 0xff7fffff; // -FLT_MAX +@@ -218,15 +264,13 @@ testFun() + testd (7); + testd (0.7); + +- union +- { +- double d; +- Int64 i; +- } v; ++ union {double d; Int64 i;} v; + v.i = 0x7ff0000000000000ULL; // inf +- testd (v.d); ++ testd (v.d, false); ++ v.i = 0xfff0000000000000ULL; // -inf ++ testd (v.d, false); + v.i = 0x7ff0000000000001ULL; // NAN +- testd (v.d); ++ testd (v.d, false); + v.i = 0x7fefffffffffffffULL; // FLT_MAX + testd (v.d); + v.i = 0xffefffffffffffffULL; // -FLT_MAX