mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-02 01:18:08 +01:00
Merge pull request #522 from fosslinux/mpfr-fixup
mpfr: remove pregenerated files
This commit is contained in:
commit
63b24502c7
3 changed files with 62 additions and 6 deletions
|
|
@ -49,13 +49,13 @@ f6c65eef86aa9f5317396a8443b25ed87a18f72d07dfd2231a594aa2c1a68942 findutils-4.2.
|
|||
2ba6bfb20ab603787a95bf293742f36cfd8270c616073a880bc6d0c703e2c870 flex-2.5.33_0.tar.bz2
|
||||
9e898068d570b5cfa016f0e14819d7f7a6577bae9177ef1e9bb62866d5b0f0b9 flex-2.6.4_0.tar.bz2
|
||||
c925739472260498342ba6dc3263da937abf5237e7e9102622bf5657ec98094a gawk-3.0.4_0.tar.bz2
|
||||
14c3c0b85ec7f98654496931b9ac0e0cea2f4d466724f1b72dbd5e6e68cf0b02 gawk-5.3.0_0.tar.bz2
|
||||
ce0a69589791196818d59ee49a76391741999ce9fcb6ab72bdbd6d5197df0cf3 gawk-5.3.0_0.tar.bz2
|
||||
b4fafdabdbd8c1f9f7c96fc4677023a8151fe2afe0702e3dee920157b30deb98 gc-8.0.4_0.tar.bz2
|
||||
a151c33be67b0d41b7470c20b5265c079bf7f83194e859dbdfbed308da9a64bd gcc-10.5.0_0.tar.bz2
|
||||
61c5fb7da5c77ea3395a6b56f08c2285c279f6deb10712cce9395643a2373c70 gcc-15.2.0_0.tar.bz2
|
||||
1edee9931fd23d02bf3f706cb43de3c141fbd8f9d3a1bf636ed460acaac2c5eb gcc-10.5.0_0.tar.bz2
|
||||
a2d4f9099ef92f8bd79f65a384764622a0aa50b5488826aef8a3afef8d57e46b gcc-15.2.0_0.tar.bz2
|
||||
d34de902de6de9204abedb834c4c39fbb95b993e545fbb090de2b028fa1d4a61 gcc-4.0.4_0.tar.bz2
|
||||
2f13b3306832d882536c97d0302f2ec1801193086dbbe62388f930858e5728a3 gcc-4.0.4_1.tar.bz2
|
||||
2c5268956c09c71efd6c793773dd2d8133274b6c846ec63cd67218af9080bd3d gcc-4.7.4_0.tar.bz2
|
||||
c523aff079101ce282793efc00934cf2ca20de58109a42746002c112c526b65f gcc-4.7.4_0.tar.bz2
|
||||
4791285848460b6645e1ece7d53d836900529d52af7cbab86978bddf687acfa2 gettext-0.21_0.tar.bz2
|
||||
96f33b53c24f5f46a23c2b9eef8147e684c796889a83bdd39254a73393594a49 gmp-6.2.1_0.tar.bz2
|
||||
8138c02c4fef718c97827f1d6476e2fc83433ff06eff4820b53589b5419b7e15 gperf-3.1_0.tar.bz2
|
||||
|
|
@ -84,7 +84,7 @@ d4dff784cac3d58d0cedfd9a51b52ff100ad8654e10a7c8c41590351f48f57d6 m4-1.4.7_0.tar
|
|||
38611790ea602063095c2819672932cbfbc29cd1244b68a8f46123e76a1ad630 make-3.82_0.tar.bz2
|
||||
d477947e4df6f4964fae00c9c16850caf0c8e3b09771007fcca1fec8f6da9d6e make-4.2.1_0.tar.bz2
|
||||
88318fd096fe26688f8e56a77f303b24eaa5674f1b77d9bd0d0538066a0e6f99 mpc-1.2.1_0.tar.bz2
|
||||
84bc11e89ab9427be5b142e51cfaba7565d88738e5373bb7f59fb6a8d74aba6c mpfr-4.1.0_0.tar.bz2
|
||||
d62c1bc02f67f12a1240390b9aae0ff3708229d660b9780dca5bf5e77867407c mpfr-4.1.0_0.tar.bz2
|
||||
becc0745a5a4b831dca4d4d8a6c463452922739832f66760e8238e6486039832 musl-1.1.24_0.tar.bz2
|
||||
ed34943339fea3ff414e851134dc2f32b68221e8eeead0ec675eeb2a9208447d musl-1.1.24_1.tar.bz2
|
||||
ded6ecc93cc194f5b22be26c6547c63a4b84959785212fded100440f71da1802 musl-1.1.24_2.tar.bz2
|
||||
|
|
|
|||
|
|
@ -5,7 +5,16 @@
|
|||
src_prepare() {
|
||||
default
|
||||
|
||||
find . -name '*.info' -delete
|
||||
# Remove pregenerated table in strtofr.c
|
||||
sed -i '/^ {/,/ };$/d' src/strtofr.c
|
||||
cp src/strtofr.c{,.old}
|
||||
sed -i '/int RedInvLog2Table/ s/$/};/' src/strtofr.c
|
||||
|
||||
rm doc/*.info
|
||||
|
||||
# testfiles
|
||||
rm tests/tfpif_*.dat tests/tstrtofr.c
|
||||
|
||||
AUTOMAKE=automake-1.15 ACLOCAL=aclocal-1.15 autoreconf-2.69 -fi
|
||||
}
|
||||
|
||||
|
|
@ -21,6 +30,25 @@ src_configure() {
|
|||
|
||||
src_compile() {
|
||||
make "${MAKEJOBS}" MAKEINFO=true DESTDIR="${DESTDIR}"
|
||||
|
||||
pushd src
|
||||
cat > strtofr_gen.c <<EOF
|
||||
#include <stdio.h>
|
||||
#include <gmp.h>
|
||||
#include <mpfr.h>
|
||||
EOF
|
||||
# Enable the bit of code that generates the table
|
||||
sed -n '/^#define N 8$/,/^}$/p' strtofr.c >> strtofr_gen.c
|
||||
gcc strtofr_gen.c -o strtofr_gen -std=gnu99 -I. -L.libs -lmpfr -lgmp
|
||||
# ordering of 2>&1 >/dev/null is intentional here;
|
||||
# stdout -> null
|
||||
# stderr -> file (NOT null)
|
||||
./strtofr_gen 2>strtofr_table >/dev/null
|
||||
echo "};" >> strtofr_table
|
||||
sed "/int RedInvLog2Table/ r strtofr_table" strtofr.c.old > strtofr.c
|
||||
popd
|
||||
|
||||
make "${MAKEJOBS}" MAKEINFO=true DESTDIR="${DESTDIR}"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
|
|
|
|||
28
steps/mpfr-4.1.0/patches/strtofr-gen-fix.patch
Normal file
28
steps/mpfr-4.1.0/patches/strtofr-gen-fix.patch
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
SPDX-FileCopyrightText: 2025 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
The code to generate the table in strtofr.c was written in 2004 and not
|
||||
updated since. Not sure if this case was ever actually handled.
|
||||
Without this check, we end up dividing by zero, which creates problematic
|
||||
results.
|
||||
To fix this, check if the divisor is zero, and if it is, early exit (and
|
||||
fill the rest of the continued fraction with zeros).
|
||||
|
||||
--- mpfr-4.1.0/src/strtofr.c 2025-10-03 22:15:37.527948986 +1000
|
||||
+++ mpfr-4.1.0/src/strtofr.c 2025-10-03 22:18:18.480958600 +1000
|
||||
@@ -136,6 +136,14 @@
|
||||
mpfr_floor (y, x);
|
||||
tab[i] = mpfr_get_ui (y, MPFR_RNDN);
|
||||
mpfr_sub (x, x, y, MPFR_RNDN);
|
||||
+ if (mpfr_zero_p(x))
|
||||
+ {
|
||||
+ for (i++; i < N; i++)
|
||||
+ {
|
||||
+ tab[i] = 0;
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
mpfr_ui_div (x, 1, x, MPFR_RNDN);
|
||||
}
|
||||
for (i = N-1 ; i >= 0 ; i--)
|
||||
Loading…
Add table
Add a link
Reference in a new issue