From 580d480f750618f8affeb77abbb956e6eeaee0ce Mon Sep 17 00:00:00 2001 From: toge Date: Fri, 5 Dec 2025 07:28:53 +0900 Subject: [PATCH] [s2geometry] update to 0.13.1 (#48676) --- ports/s2geometry/fix-msvc-build.patch | 51 +++++++++++++++++++++++++++ ports/s2geometry/portfile.cmake | 6 ++-- ports/s2geometry/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/s-/s2geometry.json | 5 +++ 5 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 ports/s2geometry/fix-msvc-build.patch diff --git a/ports/s2geometry/fix-msvc-build.patch b/ports/s2geometry/fix-msvc-build.patch new file mode 100644 index 0000000000..a9ccc8175b --- /dev/null +++ b/ports/s2geometry/fix-msvc-build.patch @@ -0,0 +1,51 @@ +diff --git a/src/s2/util/math/exactfloat/exactfloat.cc b/src/s2/util/math/exactfloat/exactfloat.cc +index bd807e2..27aee43 100644 +--- a/src/s2/util/math/exactfloat/exactfloat.cc ++++ b/src/s2/util/math/exactfloat/exactfloat.cc +@@ -151,8 +151,8 @@ ExactFloat::ExactFloat(double v) { + // by the number of mantissa bits in a double (53, including the leading + // "1") then the result is always an integer. + int exp; +- double f = frexp(fabs(v), &exp); +- uint64_t m = static_cast(ldexp(f, kDoubleMantissaBits)); ++ double f = std::frexp(std::fabs(v), &exp); ++ uint64_t m = static_cast(std::ldexp(f, kDoubleMantissaBits)); + BN_ext_set_uint64(bn_.get(), m); + bn_exp_ = exp - kDoubleMantissaBits; + Canonicalize(); +@@ -163,7 +163,7 @@ ExactFloat::ExactFloat(int v) { + sign_ = (v >= 0) ? 1 : -1; + // Note that this works even for INT_MIN because the parameter type for + // BN_set_word() is unsigned. +- ABSL_CHECK(BN_set_word(bn_.get(), abs(v))); ++ ABSL_CHECK(BN_set_word(bn_.get(), std::abs(v))); + bn_exp_ = 0; + Canonicalize(); + } +@@ -239,7 +239,7 @@ ExactFloat::operator double() const { + double ExactFloat::ToDoubleHelper() const { + ABSL_DCHECK_LE(BN_num_bits(bn_.get()), kDoubleMantissaBits); + if (!isnormal(*this)) { +- if (is_zero()) return copysign(0, sign_); ++ if (is_zero()) return std::copysign(0, sign_); + if (isinf(*this)) { + return std::copysign(std::numeric_limits::infinity(), sign_); + } +@@ -248,7 +248,7 @@ double ExactFloat::ToDoubleHelper() const { + uint64_t d_mantissa = BN_ext_get_uint64(bn_.get()); + // We rely on ldexp() to handle overflow and underflow. (It will return a + // signed zero or infinity if the result is too small or too large.) +- return sign_ * ldexp(static_cast(d_mantissa), bn_exp_); ++ return sign_ * std::ldexp(static_cast(d_mantissa), bn_exp_); + } + + ExactFloat ExactFloat::RoundToMaxPrec(int max_prec, RoundingMode mode) const { +@@ -336,7 +336,7 @@ int ExactFloat::NumSignificantDigitsForPrec(int prec) { + // + // Since either of these bounds can be too large by 0, 1, or 2 digits, we + // stick with the simpler first bound. +- return static_cast(1 + ceil(prec * (M_LN2 / M_LN10))); ++ return static_cast(1 + std::ceil(prec * (M_LN2 / M_LN10))); + } + + // Numbers are always formatted with at least this many significant digits. diff --git a/ports/s2geometry/portfile.cmake b/ports/s2geometry/portfile.cmake index 2ccf9a15c0..c351f67d43 100644 --- a/ports/s2geometry/portfile.cmake +++ b/ports/s2geometry/portfile.cmake @@ -5,9 +5,11 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO google/s2geometry - REF v0.11.1 - SHA512 c500029c6e9cc412a29a8a74961688b0a504f60b1a7698ef84c0d0ae760e3c3f05e7068fb1154c9755d907f82e3bc09f8bf1d0ff629cbd3bad6e70169187dd37 + REF v${VERSION} + SHA512 4ddfff2f44c0e98b2a110da57335fe119788f32e3924c8bdbe9afffbad5e037fdfe64f88f664b025a86134e17f14f6195107035b258fde06f946972f1f0456a8 HEAD_REF main + PATCHES + fix-msvc-build.patch ) vcpkg_cmake_configure( diff --git a/ports/s2geometry/vcpkg.json b/ports/s2geometry/vcpkg.json index a0def43e8e..7c19b305c1 100644 --- a/ports/s2geometry/vcpkg.json +++ b/ports/s2geometry/vcpkg.json @@ -1,6 +1,6 @@ { "name": "s2geometry", - "version": "0.11.1", + "version": "0.13.1", "description": "S2 is a library for spherical geometry that aims to have the same robustness, flexibility, and performance as the very best planar geometry libraries.", "homepage": "https://s2geometry.io", "license": "Apache-2.0", diff --git a/versions/baseline.json b/versions/baseline.json index 4ca1f1425b..15d9863e5a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8741,7 +8741,7 @@ "port-version": 10 }, "s2geometry": { - "baseline": "0.11.1", + "baseline": "0.13.1", "port-version": 0 }, "s2n": { diff --git a/versions/s-/s2geometry.json b/versions/s-/s2geometry.json index a0760cc9dc..790658f1a3 100644 --- a/versions/s-/s2geometry.json +++ b/versions/s-/s2geometry.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "075153dd71960e6d2befa9a18ad1217d976e9168", + "version": "0.13.1", + "port-version": 0 + }, { "git-tree": "3fd94490409a17aef62732c674d5e12b4804fdd8", "version": "0.11.1",