summaryrefslogtreecommitdiff
path: root/geography
diff options
context:
space:
mode:
authorhe <he@pkgsrc.org>2022-10-08 20:02:06 +0000
committerhe <he@pkgsrc.org>2022-10-08 20:02:06 +0000
commit71e9ba2a537baecaccb9bc4436f3e424e4060758 (patch)
tree078b93ebdfde54887e390660b437eca54a633432 /geography
parentbc0b9611f41a203b9af1a199ebca8dee136c2764 (diff)
downloadpkgsrc-71e9ba2a537baecaccb9bc4436f3e424e4060758.tar.gz
geography/R-s2: import fix for "not old" openssl on 32-bit hosts.
Ref. https://github.com/r-spatial/s2/commit/3e791194ceb348a81d6317438e2bfe9e4a2ff1e3
Diffstat (limited to 'geography')
-rw-r--r--geography/R-s2/Makefile4
-rw-r--r--geography/R-s2/distinfo3
-rw-r--r--geography/R-s2/patches/patch-src_s2_util_math_exactfloat_exactfloat.cc48
3 files changed, 53 insertions, 2 deletions
diff --git a/geography/R-s2/Makefile b/geography/R-s2/Makefile
index d153a25239d..9f1aad7b749 100644
--- a/geography/R-s2/Makefile
+++ b/geography/R-s2/Makefile
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.2 2022/08/22 22:21:53 tnn Exp $
+# $NetBSD: Makefile,v 1.3 2022/10/08 20:02:06 he Exp $
R_PKGNAME= s2
R_PKGVER= 1.0.6
+PKGREVISION= 1
CATEGORIES= geography
MAINTAINER= pkgsrc-users@NetBSD.org
@@ -14,4 +15,5 @@ USE_LANGUAGES= c c++
.include "../../devel/R-Rcpp/buildlink3.mk"
.include "../../geography/R-wk/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
+.include "../../mk/atomic64.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/geography/R-s2/distinfo b/geography/R-s2/distinfo
index 65ad5e331f7..98f7ab829d6 100644
--- a/geography/R-s2/distinfo
+++ b/geography/R-s2/distinfo
@@ -1,5 +1,6 @@
-$NetBSD: distinfo,v 1.3 2021/10/26 10:45:07 nia Exp $
+$NetBSD: distinfo,v 1.4 2022/10/08 20:02:06 he Exp $
BLAKE2s (R/s2_1.0.6.tar.gz) = abef7cb812ef604615cf4741c66cc4062796708c3ae8191b91d236303c436fda
SHA512 (R/s2_1.0.6.tar.gz) = 4529179020f7503217cdfe1d139135a79c622bc38472627d4a1f86181ba825e5dc5f833a9ffb9be6cb272647fb61765bd6b5db89b6f46015ebcf0e996b93b623
Size (R/s2_1.0.6.tar.gz) = 1605788 bytes
+SHA1 (patch-src_s2_util_math_exactfloat_exactfloat.cc) = 7dda8c6095ac4f07f2bdc0e9801bb055acf808e7
diff --git a/geography/R-s2/patches/patch-src_s2_util_math_exactfloat_exactfloat.cc b/geography/R-s2/patches/patch-src_s2_util_math_exactfloat_exactfloat.cc
new file mode 100644
index 00000000000..c29488f76ed
--- /dev/null
+++ b/geography/R-s2/patches/patch-src_s2_util_math_exactfloat_exactfloat.cc
@@ -0,0 +1,48 @@
+$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%