void-packages/srcpkgs/gsl/patches/ppc-musl.patch
Đoàn Trần Công Danh 7fc9190f0e srcpkgs/g*: convert patches to -Np1
* gcc is kept at -Np0, because of void-cross

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

36 lines
938 B
Diff

fpu_control.h is glibc specific, but we only need some bits from it.
--- a/ieee-utils/fp-gnuppc.c
+++ b/ieee-utils/fp-gnuppc.c
@@ -18,7 +18,31 @@
*/
#include <stdio.h>
+
+#if defined(__GLIBC__)
#include <fpu_control.h>
+#else
+/* copied from fpu_control.h, only stuff that is needed here */
+# define _FPU_RC_NEAREST 0x00
+# define _FPU_RC_DOWN 0x03
+# define _FPU_RC_UP 0x02
+# define _FPU_RC_ZERO 0x01
+
+# define _FPU_MASK_ZM 0x10
+# define _FPU_MASK_OM 0x40
+# define _FPU_MASK_UM 0x20
+# define _FPU_MASK_IM 0x80
+
+# define _FPU_SETCW(cw) \
+ { union { double __d; unsigned long long __ll; } __u; \
+ register double __fr; \
+ __u.__ll = 0xfff80000LL << 32; /* This is a QNaN. */ \
+ __u.__ll |= (cw) & 0xffffffffLL; \
+ __fr = __u.__d; \
+ __asm__ __volatile__("mtfsf 255,%0" : : "f" (__fr)); \
+ }
+#endif
+
#include <gsl/gsl_errno.h>
#include <gsl/gsl_ieee_utils.h>