diff options
Diffstat (limited to 'libraries/goffice/patches')
-rw-r--r-- | libraries/goffice/patches/NEWS.patch | 11 | ||||
-rw-r--r-- | libraries/goffice/patches/configure.ac.patch | 29 | ||||
-rw-r--r-- | libraries/goffice/patches/go-dtoa.c.patch | 19 | ||||
-rw-r--r-- | libraries/goffice/patches/go-ryu.c.patch | 204 | ||||
-rw-r--r-- | libraries/goffice/patches/go-ryu.h.patch | 12 |
5 files changed, 275 insertions, 0 deletions
diff --git a/libraries/goffice/patches/NEWS.patch b/libraries/goffice/patches/NEWS.patch new file mode 100644 index 0000000000000..773bb5a77bd44 --- /dev/null +++ b/libraries/goffice/patches/NEWS.patch @@ -0,0 +1,11 @@ +--- NEWS 2023-12-27 18:37:51.129423722 -0400 ++++ NEWS.patched 2023-12-27 18:36:14.000000000 -0400 +@@ -1,3 +1,8 @@ ++goffice 0.10.57: ++ ++ * Excise long double parts of ryu unless --with-long-double. ++ ++-------------------------------------------------------------------------- + goffice 0.10.56: + + B.S.: diff --git a/libraries/goffice/patches/configure.ac.patch b/libraries/goffice/patches/configure.ac.patch new file mode 100644 index 0000000000000..1b82b292151a9 --- /dev/null +++ b/libraries/goffice/patches/configure.ac.patch @@ -0,0 +1,29 @@ +--- configure.ac 2023-05-19 22:19:44.000000000 -0300 ++++ configure.ac.fixed 2023-12-27 16:38:43.520064640 -0400 +@@ -560,14 +560,23 @@ + GOFFICE_CHECK_FUNC(acosh) + GOFFICE_CHECK_FUNC(atanh) + ++AC_TYPE_LONG_DOUBLE ++dnl go-ryu needs __uint128_t for long double support. ++AC_CHECK_TYPES([__uint128_t], [], [], [[#include <inttypes.h> ++#include <stdint.h>]]) ++if test $ac_cv_type_long_double.$ac_cv_type___uint128_t = yes.yes; then ++ with_long_double_default=yes ++else ++ with_long_double_default=no ++fi ++ + float_msg=no + AC_ARG_WITH(long-double, + [ --without-long-double disable support for long double], +- , [ with_long_double=yes]) ++ , [ with_long_double=$with_long_double_default]) + + if test "x$with_long_double" = "xyes"; then +- AC_TYPE_LONG_DOUBLE +- if test $ac_cv_type_long_double = yes; then ++ if test $with_long_double_default = yes; then + have_mandatory_funcs=yes + need_sunmath=0 + ss_ccprog=`echo $CC | sed -e 's/ .*//'` diff --git a/libraries/goffice/patches/go-dtoa.c.patch b/libraries/goffice/patches/go-dtoa.c.patch new file mode 100644 index 0000000000000..525d2893b8a6c --- /dev/null +++ b/libraries/goffice/patches/go-dtoa.c.patch @@ -0,0 +1,19 @@ +--- goffice/math/go-dtoa.c 2023-05-21 13:08:07.000000000 -0300 ++++ goffice/math/go-dtoa.c.patched 2023-12-27 19:28:35.623167312 -0400 +@@ -464,9 +464,14 @@ + GString const *dec = go_locale_get_decimal(); + + g_string_set_size (dst, 53 + oldlen + dec->len); +- if (is_long) ++ if (is_long) { ++#ifdef GOFFICE_WITH_LONG_DOUBLE + n = go_ryu_ld2s_buffered_n (d, dst->str + oldlen); +- else ++#else ++ g_critical ("Compiled with long-double, then asked to use it"); ++ return; ++#endif ++ } else + n = go_ryu_d2s_buffered_n ((double)d, dst->str + oldlen); + g_string_set_size (dst, oldlen + n); + dpos = strchr (dst->str + oldlen, '.'); diff --git a/libraries/goffice/patches/go-ryu.c.patch b/libraries/goffice/patches/go-ryu.c.patch new file mode 100644 index 0000000000000..6d0513c7521ee --- /dev/null +++ b/libraries/goffice/patches/go-ryu.c.patch @@ -0,0 +1,204 @@ +--- goffice/math/go-ryu.c 2023-05-20 20:02:02.000000000 -0300 ++++ goffice/math/go-ryu.c.patched 2023-12-27 19:28:35.623167312 -0400 +@@ -3,55 +3,8 @@ + #define bool int + + #include "go-ryu.h" +-// File ryu.h imported from ryu +-// Copyright 2018 Ulf Adams +-// +-// The contents of this file may be used under the terms of the Apache License, +-// Version 2.0. +-// +-// (See accompanying file LICENSE-Apache or copy at +-// http://www.apache.org/licenses/LICENSE-2.0) +-// +-// Alternatively, the contents of this file may be used under the terms of +-// the Boost Software License, Version 1.0. +-// (See accompanying file LICENSE-Boost or copy at +-// https://www.boost.org/LICENSE_1_0.txt) +-// +-// Unless required by applicable law or agreed to in writing, this software +-// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-// KIND, either express or implied. +-#ifndef RYU_H +-#define RYU_H +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- + #include <inttypes.h> + +-int go_ryu_d2s_buffered_n(double f, char* result); +-void go_ryu_d2s_buffered(double f, char* result); +-char* go_ryu_d2s(double f); +- +-int go_ryu_f2s_buffered_n(float f, char* result); +-void go_ryu_f2s_buffered(float f, char* result); +-char* go_ryu_f2s(float f); +- +-int go_ryu_d2fixed_buffered_n(double d, uint32_t precision, char* result); +-void go_ryu_d2fixed_buffered(double d, uint32_t precision, char* result); +-char* go_ryu_d2fixed(double d, uint32_t precision); +- +-int go_ryu_d2exp_buffered_n(double d, uint32_t precision, char* result); +-void go_ryu_d2exp_buffered(double d, uint32_t precision, char* result); +-char* go_ryu_d2exp(double d, uint32_t precision); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif // RYU_H +-// End of file ryu.h imported from ryu +- + // File common.h imported from ryu + // Copyright 2018 Ulf Adams + // +@@ -1242,20 +1195,25 @@ + return to_chars(v, ieeeSign, result); + } + +-void go_ryu_d2s_buffered(double f, char* result) { ++#if 0 ++static void go_ryu_d2s_buffered(double f, char* result) { + const int index = go_ryu_d2s_buffered_n(f, result); + + // Terminate the string. + result[index] = '\0'; + } ++#endif + +-char* go_ryu_d2s(double f) { ++#if 0 ++static char* go_ryu_d2s(double f) { + char* const result = (char*) malloc(25); + go_ryu_d2s_buffered(f, result); + return result; + } ++#endif + // End of file d2s.c imported from ryu + ++#ifdef GOFFICE_WITH_LONG_DOUBLE + // File ryu_generic_128.h imported from ryu + // Copyright 2018 Ulf Adams + // +@@ -1303,16 +1261,20 @@ + bool sign; + }; + +-struct floating_decimal_128 go_ryu_float_to_fd128(float f); +-struct floating_decimal_128 go_ryu_double_to_fd128(double d); ++#if 0 ++static struct floating_decimal_128 go_ryu_float_to_fd128(float f); ++#endif ++#if 0 ++static struct floating_decimal_128 go_ryu_double_to_fd128(double d); ++#endif + + // According to wikipedia (https://en.wikipedia.org/wiki/Long_double), this likely only works on + // x86 with specific compilers (clang?). May need an ifdef. +-struct floating_decimal_128 go_ryu_long_double_to_fd128(long double d); ++static struct floating_decimal_128 go_ryu_long_double_to_fd128(long double d); + + // Converts the given binary floating point number to the shortest decimal floating point number + // that still accurately represents it. +-struct floating_decimal_128 go_ryu_generic_binary_to_decimal( ++static struct floating_decimal_128 go_ryu_generic_binary_to_decimal( + const __uint128_t bits, const uint32_t mantissaBits, const uint32_t exponentBits, const bool explicitLeadingBit); + + // Converts the given decimal floating point number to a string, writing to result, and returning +@@ -1322,7 +1284,7 @@ + // Maximal char buffer requirement: + // sign + mantissa digits + decimal dot + 'E' + exponent sign + exponent digits + // = 1 + 39 + 1 + 1 + 1 + 10 = 53 +-int go_ryu_generic_to_chars(const struct floating_decimal_128 v, char* const result); ++static int go_ryu_generic_to_chars(const struct floating_decimal_128 v, char* const result); + + #ifdef __cplusplus + } +@@ -1330,7 +1292,9 @@ + + #endif // RYU_GENERIC_128_H + // End of file ryu_generic_128.h imported from ryu ++#endif // GOFFICE_WITH_LONG_DOUBLE + ++#ifdef GOFFICE_WITH_LONG_DOUBLE + // File generic_128.h imported from ryu + // Copyright 2018 Ulf Adams + // +@@ -1852,7 +1816,9 @@ + + #endif // RYU_GENERIC128_H + // End of file generic_128.h imported from ryu ++#endif // GOFFICE_WITH_LONG_DOUBLE + ++#ifdef GOFFICE_WITH_LONG_DOUBLE + // File generic_128.c imported from ryu + // Copyright 2018 Ulf Adams + // +@@ -1903,25 +1869,29 @@ + #define FLOAT_MANTISSA_BITS 23 + #define FLOAT_EXPONENT_BITS 8 + +-struct floating_decimal_128 go_ryu_float_to_fd128(float f) { ++#if 0 ++static struct floating_decimal_128 go_ryu_float_to_fd128(float f) { + uint32_t bits = 0; + memcpy(&bits, &f, sizeof(float)); + return go_ryu_generic_binary_to_decimal(bits, FLOAT_MANTISSA_BITS, FLOAT_EXPONENT_BITS, false); + } ++#endif + + #define DOUBLE_MANTISSA_BITS 52 + #define DOUBLE_EXPONENT_BITS 11 + +-struct floating_decimal_128 go_ryu_double_to_fd128(double d) { ++#if 0 ++static struct floating_decimal_128 go_ryu_double_to_fd128(double d) { + uint64_t bits = 0; + memcpy(&bits, &d, sizeof(double)); + return go_ryu_generic_binary_to_decimal(bits, DOUBLE_MANTISSA_BITS, DOUBLE_EXPONENT_BITS, false); + } ++#endif + + #define LONG_DOUBLE_MANTISSA_BITS 64 + #define LONG_DOUBLE_EXPONENT_BITS 15 + +-struct floating_decimal_128 go_ryu_long_double_to_fd128(long double d) { ++static struct floating_decimal_128 go_ryu_long_double_to_fd128(long double d) { + uint128_t bits = 0; + memcpy(&bits, &d, sizeof(long double)); + #ifdef RYU_DEBUG +@@ -1934,7 +1904,7 @@ + return go_ryu_generic_binary_to_decimal(bits, LONG_DOUBLE_MANTISSA_BITS, LONG_DOUBLE_EXPONENT_BITS, true); + } + +-struct floating_decimal_128 go_ryu_generic_binary_to_decimal( ++static struct floating_decimal_128 go_ryu_generic_binary_to_decimal( + const uint128_t bits, const uint32_t mantissaBits, const uint32_t exponentBits, const bool explicitLeadingBit) { + #ifdef RYU_DEBUG + printf("IN="); +@@ -2147,7 +2117,7 @@ + return fd.sign + 8; + } + +-int go_ryu_generic_to_chars(const struct floating_decimal_128 v, char* const result) { ++static int go_ryu_generic_to_chars(const struct floating_decimal_128 v, char* const result) { + if (v.exponent == FD128_EXCEPTIONAL_EXPONENT) { + return copy_special_strl(result, v); + } +@@ -2200,9 +2170,12 @@ + return index; + } + // End of file generic_128.c imported from ryu ++#endif // GOFFICE_WITH_LONG_DOUBLE + + ++#ifdef GOFFICE_WITH_LONG_DOUBLE + int go_ryu_ld2s_buffered_n (long double d, char *dst) { + struct floating_decimal_128 fd128 = go_ryu_long_double_to_fd128(d); + return go_ryu_generic_to_chars(fd128, dst); + } ++#endif diff --git a/libraries/goffice/patches/go-ryu.h.patch b/libraries/goffice/patches/go-ryu.h.patch new file mode 100644 index 0000000000000..623da14e36f4e --- /dev/null +++ b/libraries/goffice/patches/go-ryu.h.patch @@ -0,0 +1,12 @@ +--- goffice/math/go-ryu.h 2023-05-20 19:48:32.000000000 -0300 ++++ goffice/math/go-ryu.h.patched 2023-12-27 19:28:35.623167312 -0400 +@@ -9,7 +9,9 @@ + /* ------------------------------------------------------------------------- */ + + int go_ryu_d2s_buffered_n (double d, char *dst); ++#ifdef GOFFICE_WITH_LONG_DOUBLE + int go_ryu_ld2s_buffered_n (long double d, char *dst); ++#endif + + /* ------------------------------------------------------------------------- */ + |