icu: Backport C++11 math patch
authorRosen Penev <redacted>
Thu, 19 Dec 2019 21:29:41 +0000 (13:29 -0800)
committerRosen Penev <redacted>
Fri, 20 Dec 2019 00:03:32 +0000 (16:03 -0800)
Fixes compilation with uClibc-ng.

Signed-off-by: Rosen Penev <redacted>
libs/icu/Makefile
libs/icu/patches/010-ICU-20877-i18n-Don-t-use-C-11-math.patch [new file with mode: 0644]

index ba42cfff33a5f8f4c9c7608d2bf140af065fb08e..277ab05a03e9222d37a4a82d3ef427e92e05e77c 100644 (file)
@@ -11,7 +11,7 @@ PKG_NAME:=icu4c
 MAJOR_VERSION:=65
 MINOR_VERSION:=1
 PKG_VERSION:=$(MAJOR_VERSION).$(MINOR_VERSION)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(MAJOR_VERSION)_$(MINOR_VERSION)-src.tgz
 PKG_SOURCE_URL:=https://github.com/unicode-org/icu/releases/download/release-$(MAJOR_VERSION)-$(MINOR_VERSION)
diff --git a/libs/icu/patches/010-ICU-20877-i18n-Don-t-use-C-11-math.patch b/libs/icu/patches/010-ICU-20877-i18n-Don-t-use-C-11-math.patch
new file mode 100644 (file)
index 0000000..38cb669
--- /dev/null
@@ -0,0 +1,40 @@
+From 8fda72f6d8e442c5382f21cdd884e2c962bb53bd Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Wed, 11 Dec 2019 13:25:32 -0800
+Subject: [PATCH] ICU-20877 i18n: Don't use C++11 math
+
+It's not available with some libc implementations. Specifically,
+BIONIC and uClibc-ng. uprv_ variants are available.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ i18n/decimfmt.cpp               | 2 +-
+ i18n/number_decimalquantity.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/i18n/decimfmt.cpp b/i18n/decimfmt.cpp
+index 4015250e273..0cbaca7e099 100644
+--- a/i18n/decimfmt.cpp
++++ b/i18n/decimfmt.cpp
+@@ -1801,7 +1801,7 @@ bool DecimalFormat::fastFormatDouble(double input, UnicodeString& output) const
+         return false;
+     }
+     if (std::isnan(input)
+-            || std::trunc(input) != input
++            || uprv_trunc(input) != input
+             || input <= INT32_MIN
+             || input > INT32_MAX) {
+         return false;
+diff --git a/i18n/number_decimalquantity.cpp b/i18n/number_decimalquantity.cpp
+index abbc23de032..778feb141b4 100644
+--- a/i18n/number_decimalquantity.cpp
++++ b/i18n/number_decimalquantity.cpp
+@@ -452,7 +452,7 @@ void DecimalQuantity::_setToDoubleFast(double n) {
+         for (; i <= -22; i += 22) n /= 1e22;
+         n /= DOUBLE_MULTIPLIERS[-i];
+     }
+-    auto result = static_cast<int64_t>(std::round(n));
++    auto result = static_cast<int64_t>(uprv_round(n));
+     if (result != 0) {
+         _setToLong(result);
+         scale -= fracLength;
git clone https://git.99rst.org/PROJECT