aboutsummaryrefslogtreecommitdiff
path: root/libraries/goffice
diff options
context:
space:
mode:
authorJim Diamond <zsd@jdvb.ca>2023-12-24 18:46:05 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2023-12-29 18:49:44 +0700
commit4c86c5d9a4a0ab0891a1cfcf842d31ea7551e72a (patch)
treeb4ead04a7639012e1f89b1a66bff1aa655d54f00 /libraries/goffice
parent3882f380b9cf332e3f919e09757451e831d5d247 (diff)
libraries/goffice: Updated for version 0.10.56.
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'libraries/goffice')
-rw-r--r--libraries/goffice/goffice.SlackBuild20
-rw-r--r--libraries/goffice/goffice.info6
-rw-r--r--libraries/goffice/import-ryu97
-rw-r--r--libraries/goffice/patches/NEWS.patch11
-rw-r--r--libraries/goffice/patches/configure.ac.patch29
-rw-r--r--libraries/goffice/patches/go-dtoa.c.patch19
-rw-r--r--libraries/goffice/patches/go-ryu.c.patch204
-rw-r--r--libraries/goffice/patches/go-ryu.h.patch12
8 files changed, 394 insertions, 4 deletions
diff --git a/libraries/goffice/goffice.SlackBuild b/libraries/goffice/goffice.SlackBuild
index c30b167ba16d1..3cd6100de9a49 100644
--- a/libraries/goffice/goffice.SlackBuild
+++ b/libraries/goffice/goffice.SlackBuild
@@ -31,7 +31,7 @@
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=goffice
-VERSION=${VERSION:-0.10.55}
+VERSION=${VERSION:-0.10.56}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -56,12 +56,18 @@ OUTPUT=${OUTPUT:-/tmp}
if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
+ CONFIG_ARGS="--without-long-double"
+ NEED_PATCHES=T
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+ CONFIG_ARGS=
+ NEED_PATCHES=F
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
+ CONFIG_ARGS=
+ NEED_PATCHES=F
fi
set -e
@@ -72,6 +78,17 @@ cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
+
+if [ "$NEED_PATCHES" = T ]
+then
+ for i in $CWD/patches/*
+ do
+ patch -p0 < $i
+ done
+ cp $CWD/import-ryu tools/
+ chmod 755 tools/import-ryu
+fi
+
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
@@ -82,6 +99,7 @@ find -L . \
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
+ $CONFIG_ARGS \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
diff --git a/libraries/goffice/goffice.info b/libraries/goffice/goffice.info
index 325742288ae2e..209e7365ab144 100644
--- a/libraries/goffice/goffice.info
+++ b/libraries/goffice/goffice.info
@@ -1,8 +1,8 @@
PRGNAM="goffice"
-VERSION="0.10.55"
+VERSION="0.10.56"
HOMEPAGE="https://download.gnome.org/sources/goffice/"
-DOWNLOAD="https://download.gnome.org/sources/goffice/0.10/goffice-0.10.55.tar.xz"
-MD5SUM="c3e5f9e2fcdd63e4cd50721610abefc2"
+DOWNLOAD="https://download.gnome.org/sources/goffice/0.10/goffice-0.10.56.tar.xz"
+MD5SUM="50555440e0e4ccef4651193e5e0b5f62"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
diff --git a/libraries/goffice/import-ryu b/libraries/goffice/import-ryu
new file mode 100644
index 0000000000000..e99f022e0be56
--- /dev/null
+++ b/libraries/goffice/import-ryu
@@ -0,0 +1,97 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+my $ryu = $ARGV[0];
+
+my @files = (# "ryu.h",
+ "common.h",
+ "digit_table.h",
+ "d2s_intrinsics.h",
+ "d2s_small_table.h",
+ 'd2s.c',
+ 'WITH_LONG_DOUBLE',
+ 'ryu_generic_128.h',
+ 'generic_128.h',
+ 'generic_128.c');
+
+print "#define RYU_OPTIMIZE_SIZE 1\n\n";
+print "#define bool int\n\n";
+print "#include \"go-ryu.h\"\n";
+print "#include <inttypes.h>\n";
+print "\n";
+
+my $with_long_double = 0;
+
+foreach my $f (@files) {
+ if ($f eq 'WITH_LONG_DOUBLE') {
+ $with_long_double = 1;
+ next;
+ }
+
+ my $fn = "$ryu/ryu/$f";
+
+ my $in_conditional = 0;
+
+ print STDERR "Importing $f...\n";
+ open my $fh, "<", $fn or die "$0: cannot read $fn:$!\n";
+
+ print "#ifdef GOFFICE_WITH_LONG_DOUBLE\n" if $with_long_double;
+
+ print "// File $f imported from ryu\n";
+ while (<$fh>) {
+ next if /^\s*#\s*include\s*"ryu.*"/;
+
+ s/\b((float|double|long_double)_to_fd128|generic_binary_to_decimal|generic_to_chars|(d|f)2(s|exp|fixed)(|_buffered_n|_buffered))\b/go_ryu_$1/g;
+
+ if (/\b(go_ryu_d2s_buffered|go_ryu_d2s|go_ryu_f2s_buffered_n|go_ryu_f2s_buffered|go_ryu_f2s|go_ryu_d2fixed_buffered_n|go_ryu_d2fixed_buffered|go_ryu_d2fixed|go_ryu_d2exp_buffered_n|go_ryu_d2exp_buffered|go_ryu_d2exp)\s*\([a-z]+\s.*\)(;|\s*\{)$/) {
+ print "#if 0\n";
+ $_ = "static $_";
+ $in_conditional = 1;
+ }
+
+ if (/\b(go_ryu_long_double_to_fd128|go_ryu_generic_to_chars)\s*\([a-z]+\s.*\)(;|\s*\{)$/) {
+ $_ = "static $_";
+ }
+
+ if (/struct floating_decimal_128 go_ryu_generic_binary_to_decimal\(/) {
+ $_ = "static $_";
+ }
+
+
+ if ($f =~ /128/) {
+ s/\b(pow5bits|pow5Factor|multipleOfPowerOf[25]|log10Pow[25]|copy_special_str|POW5_TABLE_SIZE)\b/$1l/g;
+
+ if (/go_ryu_float_to_fd128\(float/) {
+ print "#if 0\n";
+ $_ = "static $_";
+ $in_conditional = 1;
+ }
+
+ if (/go_ryu_double_to_fd128\(double/) {
+ print "#if 0\n";
+ $_ = "static $_";
+ $in_conditional = 1;
+ }
+ }
+
+ if ($in_conditional && (/^[a-z].*\);$/ || /^}/)) {
+ $_ = "$_#endif\n";
+ $in_conditional = 0;
+ }
+
+ print;
+ }
+ print "// End of file $f imported from ryu\n";
+ print "#endif // GOFFICE_WITH_LONG_DOUBLE\n" if $with_long_double;
+ print "\n";
+
+ die "Trouble" if $in_conditional;
+}
+
+print "\n";
+print "#ifdef GOFFICE_WITH_LONG_DOUBLE\n";
+print "int go_ryu_ld2s_buffered_n (long double d, char *dst) {\n";
+print " struct floating_decimal_128 fd128 = go_ryu_long_double_to_fd128(d);\n";
+print " return go_ryu_generic_to_chars(fd128, dst);\n";
+print "}\n";
+print "#endif\n";
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
+
+ /* ------------------------------------------------------------------------- */
+