Sat Oct 8 20:02:06 2022 UTC ()
geography/R-s2: import fix for "not old" openssl on 32-bit hosts.

Ref.
https://github.com/r-spatial/s2/commit/3e791194ceb348a81d6317438e2bfe9e4a2ff1e3


(he)
diff -r1.2 -r1.3 pkgsrc/geography/R-s2/Makefile
diff -r1.3 -r1.4 pkgsrc/geography/R-s2/distinfo
diff -r0 -r1.1 pkgsrc/geography/R-s2/patches/patch-src_s2_util_math_exactfloat_exactfloat.cc

cvs diff -r1.2 -r1.3 pkgsrc/geography/R-s2/Makefile (expand / switch to unified diff)

--- pkgsrc/geography/R-s2/Makefile 2022/08/22 22:21:53 1.2
+++ pkgsrc/geography/R-s2/Makefile 2022/10/08 20:02:06 1.3
@@ -1,17 +1,19 @@ @@ -1,17 +1,19 @@
1# $NetBSD: Makefile,v 1.2 2022/08/22 22:21:53 tnn Exp $ 1# $NetBSD: Makefile,v 1.3 2022/10/08 20:02:06 he Exp $
2 2
3R_PKGNAME= s2 3R_PKGNAME= s2
4R_PKGVER= 1.0.6 4R_PKGVER= 1.0.6
 5PKGREVISION= 1
5CATEGORIES= geography 6CATEGORIES= geography
6 7
7MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
8COMMENT= Spherical Geometry Operators Using the S2 Geometry Library 9COMMENT= Spherical Geometry Operators Using the S2 Geometry Library
9LICENSE= apache-2.0 10LICENSE= apache-2.0
10 11
11USE_LANGUAGES= c c++ 12USE_LANGUAGES= c c++
12 13
13.include "../../math/R/Makefile.extension" 14.include "../../math/R/Makefile.extension"
14.include "../../devel/R-Rcpp/buildlink3.mk" 15.include "../../devel/R-Rcpp/buildlink3.mk"
15.include "../../geography/R-wk/buildlink3.mk" 16.include "../../geography/R-wk/buildlink3.mk"
16.include "../../security/openssl/buildlink3.mk" 17.include "../../security/openssl/buildlink3.mk"
 18.include "../../mk/atomic64.mk"
17.include "../../mk/bsd.pkg.mk" 19.include "../../mk/bsd.pkg.mk"

cvs diff -r1.3 -r1.4 pkgsrc/geography/R-s2/distinfo (expand / switch to unified diff)

--- pkgsrc/geography/R-s2/distinfo 2021/10/26 10:45:07 1.3
+++ pkgsrc/geography/R-s2/distinfo 2022/10/08 20:02:06 1.4
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
1$NetBSD: distinfo,v 1.3 2021/10/26 10:45:07 nia Exp $ 1$NetBSD: distinfo,v 1.4 2022/10/08 20:02:06 he Exp $
2 2
3BLAKE2s (R/s2_1.0.6.tar.gz) = abef7cb812ef604615cf4741c66cc4062796708c3ae8191b91d236303c436fda 3BLAKE2s (R/s2_1.0.6.tar.gz) = abef7cb812ef604615cf4741c66cc4062796708c3ae8191b91d236303c436fda
4SHA512 (R/s2_1.0.6.tar.gz) = 4529179020f7503217cdfe1d139135a79c622bc38472627d4a1f86181ba825e5dc5f833a9ffb9be6cb272647fb61765bd6b5db89b6f46015ebcf0e996b93b623 4SHA512 (R/s2_1.0.6.tar.gz) = 4529179020f7503217cdfe1d139135a79c622bc38472627d4a1f86181ba825e5dc5f833a9ffb9be6cb272647fb61765bd6b5db89b6f46015ebcf0e996b93b623
5Size (R/s2_1.0.6.tar.gz) = 1605788 bytes 5Size (R/s2_1.0.6.tar.gz) = 1605788 bytes
 6SHA1 (patch-src_s2_util_math_exactfloat_exactfloat.cc) = 7dda8c6095ac4f07f2bdc0e9801bb055acf808e7

File Added: pkgsrc/geography/R-s2/patches/patch-src_s2_util_math_exactfloat_exactfloat.cc
$NetBSD: patch-src_s2_util_math_exactfloat_exactfloat.cc,v 1.1 2022/10/08 20:02:06 he Exp $

Import fix from upstream for newer openssl on 32-bit hosts, ref.

https://github.com/r-spatial/s2/commit/3e791194ceb348a81d6317438e2bfe9e4a2ff1e3

--- src/s2/util/math/exactfloat/exactfloat.cc.orig	2021-01-04 12:00:17.000000000 +0000
+++ src/s2/util/math/exactfloat/exactfloat.cc
@@ -93,6 +93,7 @@ inline static void BN_ext_set_uint64(BIG
 #endif
 }
 
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
 // Return the absolute value of a BIGNUM as a 64-bit unsigned integer.
 // Requires that BIGNUM fits into 64 bits.
 inline static uint64 BN_ext_get_uint64(const BIGNUM* bn) {
@@ -108,8 +109,6 @@ inline static uint64 BN_ext_get_uint64(c
 #endif
 }
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
-
 // Count the number of low-order zero bits in the given BIGNUM (ignoring its
 // sign).  Returns 0 if the argument is zero.
 static int BN_ext_count_low_zero_bits(const BIGNUM* bn) {
@@ -130,6 +129,22 @@ static int BN_ext_count_low_zero_bits(co
 
 #else  // OPENSSL_VERSION_NUMBER >= 0x10100000L
 
+// Return the absolute value of a BIGNUM as a 64-bit unsigned integer.
+// Requires that BIGNUM fits into 64 bits.
+inline static uint64 BN_ext_get_uint64(const BIGNUM* bn) {
+  uint64 r;
+#ifdef IS_LITTLE_ENDIAN
+  S2_CHECK_EQ(BN_bn2lebinpad(bn, reinterpret_cast<unsigned char*>(&r),
+                             sizeof(r)), sizeof(r));
+#elif IS_BIG_ENDIAN
+  S2_CHECK_EQ(BN_bn2binpad(bn, reinterpret_cast<unsigned char*>(&r),
+                           sizeof(r)), sizeof(r));
+#else
+#error one of IS_LITTLE_ENDIAN or IS_BIG_ENDIAN should be defined!
+#endif
+  return r;
+}
+
 static int BN_ext_count_low_zero_bits(const BIGNUM* bn) {
   // In OpenSSL >= 1.1, BIGNUM is an opaque type, so d and top
   // cannot be accessed.  The bytes must be copied out at a ~25%