From 27f3476f3302c74bd3de72c131fbb8a7e354c615 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 3 Aug 2018 21:09:34 +0200 Subject: [PATCH] dmd-bootstrap: fix musl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: #1447 [via git-merge-pr] Signed-off-by: Jürgen Buchmüller --- srcpkgs/dmd-bootstrap/files/musl-math.patch | 152 ++++++++++++++++++++ srcpkgs/dmd-bootstrap/template | 3 +- 2 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/dmd-bootstrap/files/musl-math.patch diff --git a/srcpkgs/dmd-bootstrap/files/musl-math.patch b/srcpkgs/dmd-bootstrap/files/musl-math.patch new file mode 100644 index 00000000000..ab0dc757189 --- /dev/null +++ b/srcpkgs/dmd-bootstrap/files/musl-math.patch @@ -0,0 +1,152 @@ +--- druntime/src/core/stdc/math.d 2018-03-04 08:20:53.000000000 +0100 ++++ - 2018-08-03 22:10:15.242825116 +0200 +@@ -232,8 +232,148 @@ + int isunordered(double x, double y); + int isunordered(real x, real y); + } ++version( CRuntime_Glibc ) ++{ ++ enum ++ { ++ /// ++ FP_NAN, ++ /// ++ FP_INFINITE, ++ /// ++ FP_ZERO, ++ /// ++ FP_SUBNORMAL, ++ /// ++ FP_NORMAL, ++ } ++ ++ enum ++ { ++ /// ++ FP_FAST_FMA = 0, ++ /// ++ FP_FAST_FMAF = 0, ++ /// ++ FP_FAST_FMAL = 0, ++ } ++ ++ int __fpclassifyf(float x); ++ int __fpclassify(double x); ++ int __fpclassifyl(real x); ++ ++ //int __finitef(float x); ++ //int __finite(double x); ++ //int __finitel(real x); + +-version( CRuntime_DigitalMars ) ++ //int __isinff(float x); ++ //int __isinf(double x); ++ //int __isinfl(real x); ++ ++ //int __isnanf(float x); ++ //int __isnan(double x); ++ //int __isnanl(real x); ++ ++ int __signbitf(float x); ++ int __signbit(double x); ++ int __signbitl(real x); ++ ++ extern (D) ++ { ++ //int fpclassify(real-floating x); ++ /// ++ int fpclassify(float x) { return __fpclassifyf(x); } ++ /// ++ int fpclassify(double x) { return __fpclassify(x); } ++ /// ++ int fpclassify(real x) ++{ ++ return (real.sizeof == double.sizeof) ++ ? __fpclassify(x) ++ : __fpclassifyl(x); ++ } ++ private uint __FLOAT_BITS(float __f) ++ { ++ union __u_t { ++ float __f; ++ uint __i; ++ } ++ __u_t __u; ++ __u.__f = __f; ++ return __u.__i; ++ } ++ private ulong __DOUBLE_BITS(double __f) ++ { ++ union __u_t { ++ double __f; ++ ulong __i; ++ } ++ __u_t __u; ++ __u.__f = __f; ++ return __u.__i; ++ } ++ //int isfinite(real-floating x); ++ /// ++ int isfinite(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) < 0x7f800000; } ++ /// ++ int isfinite(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) < 0x7ffUL<<52; } ++ /// ++ int isfinite(real x) ++ { ++ return (real.sizeof == double.sizeof) ++ ? isfinite(cast(double)x) ++ : __fpclassifyl(x) > FP_INFINITE; ++ } ++ ++ //int isinf(real-floating x); ++ /// ++ int isinf(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) == 0x7f800000; } ++ /// ++ int isinf(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) == 0x7ffUL<<52; } ++ /// ++ int isinf(real x) ++ { ++ return (real.sizeof == double.sizeof) ++ ? isinf(cast(double)x) ++ : __fpclassifyl(x) == FP_INFINITE; ++ } ++ ++ //int isnan(real-floating x); ++ /// ++ int isnan(float x) { return (__FLOAT_BITS(x) & 0x7fffffff) > 0x7f800000; } ++ /// ++ int isnan(double x) { return (__DOUBLE_BITS(x) & -1UL>>1) > 0x7ffUL<<52; } ++ /// ++ int isnan(real x) ++ { ++ return (real.sizeof == double.sizeof) ++ ? isnan(cast(double)x) ++ : __fpclassifyl(x) == FP_NAN; ++ } ++ ++ //int isnormal(real-floating x); ++ /// ++ int isnormal(float x) { return fpclassify(x) == FP_NORMAL; } ++ /// ++ int isnormal(double x) { return fpclassify(x) == FP_NORMAL; } ++ /// ++ int isnormal(real x) { return fpclassify(x) == FP_NORMAL; } ++ ++ //int signbit(real-floating x); ++ /// ++ int signbit(float x) { return __signbitf(x); } ++ /// ++ int signbit(double x) { return __signbit(x); } ++ /// ++ int signbit(real x) ++ { ++ return (real.sizeof == double.sizeof) ++ ? __signbit(x) ++ : __signbitl(x); ++ } ++ } ++} ++else version( CRuntime_DigitalMars ) + { + enum + { diff --git a/srcpkgs/dmd-bootstrap/template b/srcpkgs/dmd-bootstrap/template index 17d759a3b74..bebf451963d 100644 --- a/srcpkgs/dmd-bootstrap/template +++ b/srcpkgs/dmd-bootstrap/template @@ -1,7 +1,7 @@ # Template file for 'dmd-bootstrap' pkgname=dmd-bootstrap version=2.069.20180305 -revision=1 +revision=2 _gitrev_dmd=75266348c8a2368945a339ab86d7c8960a9bfc08 _gitrev_druntime=33ae38cef41564b12864470afaf8430eb7334d3b _gitrev_phobos=30ac23a0889dd183221ce531a057171dd45296c4 @@ -32,6 +32,7 @@ post_extract() { pre_configure() { case "$XBPS_TARGET_MACHINE" in *-musl) patch -p0 < ${FILESDIR}/musl.patch + patch -p0 < ${FILESDIR}/musl-math.patch esac }