From 7fd8fca6390e7c92185e785c35abaf62381cf95e Mon Sep 17 00:00:00 2001
From: Minecrell <minecrell@minecrell.net>
Date: Tue, 31 Mar 2020 15:37:54 +0200
Subject: [PATCH] cross/gcc-*: upgrade to 9.3.0-r1

upstream commit https://gitlab.alpinelinux.org/alpine/aports/commit/6957885149d8c97ec0c32b7988dac349c8d26356
---
 cross/gcc-aarch64/405-dlang-mips.patch | 34 ++++++++++++++++++++++++++
 cross/gcc-aarch64/APKBUILD             | 15 +++++-------
 cross/gcc-armhf/405-dlang-mips.patch   | 34 ++++++++++++++++++++++++++
 cross/gcc-armhf/APKBUILD               | 15 +++++-------
 cross/gcc-armv7/405-dlang-mips.patch   | 34 ++++++++++++++++++++++++++
 cross/gcc-armv7/APKBUILD               | 15 +++++-------
 6 files changed, 120 insertions(+), 27 deletions(-)
 create mode 100644 cross/gcc-aarch64/405-dlang-mips.patch
 create mode 100644 cross/gcc-armhf/405-dlang-mips.patch
 create mode 100644 cross/gcc-armv7/405-dlang-mips.patch

diff --git a/cross/gcc-aarch64/405-dlang-mips.patch b/cross/gcc-aarch64/405-dlang-mips.patch
new file mode 100644
index 00000000000..1b222a0d43a
--- /dev/null
+++ b/cross/gcc-aarch64/405-dlang-mips.patch
@@ -0,0 +1,34 @@
+--- gcc-9.3.0.orig/libphobos/libdruntime/core/sys/posix/fcntl.d
++++ gcc-9.3.0/libphobos/libdruntime/core/sys/posix/fcntl.d
+@@ -870,6 +870,21 @@
+             F_SETLKW       = 7,
+         }
+     }
++    else version (MIPS_Any)
++    {
++        enum 
++        {
++            O_DIRECTORY     = 0x010000, // octal   0200000
++            O_NOFOLLOW      = 0x020000, // octal   0400000
++            O_DIRECT        = 0x008000, // octal   0100000
++            O_LARGEFILE     = 0x002000, // octal   0020000
++            O_TMPFILE       = 0x410000, // octal 020200000
++
++            F_GETLK        = 33,
++            F_SETLK        = 34,
++            F_SETLKW       = 35,
++        }
++    }
+     else
+         static assert(0, "Platform not supported");
+ 
+--- gcc-9.3.0.orig/libphobos/configure.tgt
++++ gcc-9.3.0/libphobos/configure.tgt
+@@ -38,6 +38,7 @@
+ 	;;
+   mips*-*-linux*)
+ 	LIBPHOBOS_SUPPORTED=yes
++	LIBDRUNTIME_NEEDS_UCONTEXT=yes
+ 	;;
+   riscv*-*-linux*)
+ 	LIBPHOBOS_SUPPORTED=yes
diff --git a/cross/gcc-aarch64/APKBUILD b/cross/gcc-aarch64/APKBUILD
index 73a39de578d..8dfc70afa46 100644
--- a/cross/gcc-aarch64/APKBUILD
+++ b/cross/gcc-aarch64/APKBUILD
@@ -30,7 +30,7 @@ pkgver=9.3.0
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname="gcc-aarch64"
-pkgrel=0
+pkgrel=1
 pkgdesc="Stage2 cross-compiler for aarch64"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -117,11 +117,6 @@ fi
 # See libphobos/configure.tgt in GCC sources for supported targets
 [ "$CARCH" = ppc64le ] && LANG_D=false
 
-# GDC requires libucontext on mips, which is not yet available
-case "$CTARGET_ARCH" in
-mips*)		LANG_D=false ;;
-esac
-
 # Go needs {set,make,swap}context, unimplemented in musl
 [ "$CTARGET_LIBC" = musl ] && LANG_GO=false
 
@@ -155,7 +150,7 @@ fi
 if $LANG_D; then
 	subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
 	_languages="$_languages,d"
-	[ "$CTARGET_ARCH" == "s390x" ] && makedepends_build="$makedepends_build libucontext-dev"
+	makedepends_build="$makedepends_build libucontext-dev"
 fi
 if $LANG_OBJC; then
 	subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
@@ -218,6 +213,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
 	402-dlang-stat.patch
 	403-dlang-ibmz.patch
 	404-dlang-zlib.patch
+	405-dlang-mips.patch
 	"
 
 #	gcc-4.8-build-args.patch
@@ -527,7 +523,7 @@ libgphobos() {
 gdc() {
 	pkgdesc="GCC-based D language compiler"
 	depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
-	[ "$CTARGET_ARCH" == "s390x" ] && depends="$depends libucontext-dev"
+	depends="$depends libucontext-dev"
 
 	mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
 		"$subpkgdir"/usr/lib \
@@ -663,4 +659,5 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
 84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830  401-dlang-32bits.patch
 9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69  402-dlang-stat.patch
 fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae  403-dlang-ibmz.patch
-ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb  404-dlang-zlib.patch"
+ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb  404-dlang-zlib.patch
+3f40f796f50d49ea0a185d3454c79606fb5f90ed48c030fe25c1df8c4a72ba7cae37dccdb260cf737beb3e921dc2ddad68effbe446dbf220a07d0158b9b9ca8d  405-dlang-mips.patch"
diff --git a/cross/gcc-armhf/405-dlang-mips.patch b/cross/gcc-armhf/405-dlang-mips.patch
new file mode 100644
index 00000000000..1b222a0d43a
--- /dev/null
+++ b/cross/gcc-armhf/405-dlang-mips.patch
@@ -0,0 +1,34 @@
+--- gcc-9.3.0.orig/libphobos/libdruntime/core/sys/posix/fcntl.d
++++ gcc-9.3.0/libphobos/libdruntime/core/sys/posix/fcntl.d
+@@ -870,6 +870,21 @@
+             F_SETLKW       = 7,
+         }
+     }
++    else version (MIPS_Any)
++    {
++        enum 
++        {
++            O_DIRECTORY     = 0x010000, // octal   0200000
++            O_NOFOLLOW      = 0x020000, // octal   0400000
++            O_DIRECT        = 0x008000, // octal   0100000
++            O_LARGEFILE     = 0x002000, // octal   0020000
++            O_TMPFILE       = 0x410000, // octal 020200000
++
++            F_GETLK        = 33,
++            F_SETLK        = 34,
++            F_SETLKW       = 35,
++        }
++    }
+     else
+         static assert(0, "Platform not supported");
+ 
+--- gcc-9.3.0.orig/libphobos/configure.tgt
++++ gcc-9.3.0/libphobos/configure.tgt
+@@ -38,6 +38,7 @@
+ 	;;
+   mips*-*-linux*)
+ 	LIBPHOBOS_SUPPORTED=yes
++	LIBDRUNTIME_NEEDS_UCONTEXT=yes
+ 	;;
+   riscv*-*-linux*)
+ 	LIBPHOBOS_SUPPORTED=yes
diff --git a/cross/gcc-armhf/APKBUILD b/cross/gcc-armhf/APKBUILD
index 36e7869f584..46f43b33859 100644
--- a/cross/gcc-armhf/APKBUILD
+++ b/cross/gcc-armhf/APKBUILD
@@ -30,7 +30,7 @@ pkgver=9.3.0
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname="gcc-armhf"
-pkgrel=0
+pkgrel=1
 pkgdesc="Stage2 cross-compiler for armhf"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -117,11 +117,6 @@ fi
 # See libphobos/configure.tgt in GCC sources for supported targets
 [ "$CARCH" = ppc64le ] && LANG_D=false
 
-# GDC requires libucontext on mips, which is not yet available
-case "$CTARGET_ARCH" in
-mips*)		LANG_D=false ;;
-esac
-
 # Go needs {set,make,swap}context, unimplemented in musl
 [ "$CTARGET_LIBC" = musl ] && LANG_GO=false
 
@@ -155,7 +150,7 @@ fi
 if $LANG_D; then
 	subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
 	_languages="$_languages,d"
-	[ "$CTARGET_ARCH" == "s390x" ] && makedepends_build="$makedepends_build libucontext-dev"
+	makedepends_build="$makedepends_build libucontext-dev"
 fi
 if $LANG_OBJC; then
 	subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
@@ -218,6 +213,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
 	402-dlang-stat.patch
 	403-dlang-ibmz.patch
 	404-dlang-zlib.patch
+	405-dlang-mips.patch
 	"
 
 #	gcc-4.8-build-args.patch
@@ -527,7 +523,7 @@ libgphobos() {
 gdc() {
 	pkgdesc="GCC-based D language compiler"
 	depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
-	[ "$CTARGET_ARCH" == "s390x" ] && depends="$depends libucontext-dev"
+	depends="$depends libucontext-dev"
 
 	mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
 		"$subpkgdir"/usr/lib \
@@ -663,4 +659,5 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
 84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830  401-dlang-32bits.patch
 9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69  402-dlang-stat.patch
 fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae  403-dlang-ibmz.patch
-ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb  404-dlang-zlib.patch"
+ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb  404-dlang-zlib.patch
+3f40f796f50d49ea0a185d3454c79606fb5f90ed48c030fe25c1df8c4a72ba7cae37dccdb260cf737beb3e921dc2ddad68effbe446dbf220a07d0158b9b9ca8d  405-dlang-mips.patch"
diff --git a/cross/gcc-armv7/405-dlang-mips.patch b/cross/gcc-armv7/405-dlang-mips.patch
new file mode 100644
index 00000000000..1b222a0d43a
--- /dev/null
+++ b/cross/gcc-armv7/405-dlang-mips.patch
@@ -0,0 +1,34 @@
+--- gcc-9.3.0.orig/libphobos/libdruntime/core/sys/posix/fcntl.d
++++ gcc-9.3.0/libphobos/libdruntime/core/sys/posix/fcntl.d
+@@ -870,6 +870,21 @@
+             F_SETLKW       = 7,
+         }
+     }
++    else version (MIPS_Any)
++    {
++        enum 
++        {
++            O_DIRECTORY     = 0x010000, // octal   0200000
++            O_NOFOLLOW      = 0x020000, // octal   0400000
++            O_DIRECT        = 0x008000, // octal   0100000
++            O_LARGEFILE     = 0x002000, // octal   0020000
++            O_TMPFILE       = 0x410000, // octal 020200000
++
++            F_GETLK        = 33,
++            F_SETLK        = 34,
++            F_SETLKW       = 35,
++        }
++    }
+     else
+         static assert(0, "Platform not supported");
+ 
+--- gcc-9.3.0.orig/libphobos/configure.tgt
++++ gcc-9.3.0/libphobos/configure.tgt
+@@ -38,6 +38,7 @@
+ 	;;
+   mips*-*-linux*)
+ 	LIBPHOBOS_SUPPORTED=yes
++	LIBDRUNTIME_NEEDS_UCONTEXT=yes
+ 	;;
+   riscv*-*-linux*)
+ 	LIBPHOBOS_SUPPORTED=yes
diff --git a/cross/gcc-armv7/APKBUILD b/cross/gcc-armv7/APKBUILD
index af2598e3ea8..9e4b5abf435 100644
--- a/cross/gcc-armv7/APKBUILD
+++ b/cross/gcc-armv7/APKBUILD
@@ -30,7 +30,7 @@ pkgver=9.3.0
 [ "$CHOST" != "$CTARGET" ] && _target="-$CTARGET_ARCH" || _target=""
 
 pkgname="gcc-armv7"
-pkgrel=0
+pkgrel=1
 pkgdesc="Stage2 cross-compiler for armv7"
 url="https://gcc.gnu.org"
 arch="x86_64"
@@ -117,11 +117,6 @@ fi
 # See libphobos/configure.tgt in GCC sources for supported targets
 [ "$CARCH" = ppc64le ] && LANG_D=false
 
-# GDC requires libucontext on mips, which is not yet available
-case "$CTARGET_ARCH" in
-mips*)		LANG_D=false ;;
-esac
-
 # Go needs {set,make,swap}context, unimplemented in musl
 [ "$CTARGET_LIBC" = musl ] && LANG_GO=false
 
@@ -155,7 +150,7 @@ fi
 if $LANG_D; then
 	subpackages="$subpackages libgphobos::$CTARGET_ARCH gcc-gdc$_target:gdc"
 	_languages="$_languages,d"
-	[ "$CTARGET_ARCH" == "s390x" ] && makedepends_build="$makedepends_build libucontext-dev"
+	makedepends_build="$makedepends_build libucontext-dev"
 fi
 if $LANG_OBJC; then
 	subpackages="$subpackages libobjc::$CTARGET_ARCH gcc-objc$_target:objc"
@@ -218,6 +213,7 @@ source="https://gcc.gnu.org/pub/gcc/releases/gcc-${_pkgbase:-$pkgver}/gcc-${_pkg
 	402-dlang-stat.patch
 	403-dlang-ibmz.patch
 	404-dlang-zlib.patch
+	405-dlang-mips.patch
 	"
 
 #	gcc-4.8-build-args.patch
@@ -527,7 +523,7 @@ libgphobos() {
 gdc() {
 	pkgdesc="GCC-based D language compiler"
 	depends="gcc=$_gccrel libgphobos=$_gccrel musl-dev"
-	[ "$CTARGET_ARCH" == "s390x" ] && depends="$depends libucontext-dev"
+	depends="$depends libucontext-dev"
 
 	mkdir -p "$subpkgdir"/$_gcclibdir/include/d/ \
 		"$subpkgdir"/usr/lib \
@@ -663,4 +659,5 @@ f4ef08454e28c8732db69115e4998ec153399e8d229dd27f923dbdcf57b68128a65640d026cc7f45
 84bdbdfcb972161765b81220ea2e80e83c32f3ab27596b77eb451d8cac4bd6312210df468581c2b0e1363f5e3b31654e369c47ae84c907f3b54a1786d7c17830  401-dlang-32bits.patch
 9d73f21eaa2458d28a144dd0e5478ed52763a4d8bbf62084b607db52bce1e2242f773c853fc34e6aae2d53c4124948139954627064e850e9dabaddaef5cb9d69  402-dlang-stat.patch
 fd056014d0c6f627108d7387bfe46b5fb66786a16fa964da55b0442658b1c8e9e903c641a9e3233000ef37691e32ea4fef22029ab5eba217ccbc8bd5941e81ae  403-dlang-ibmz.patch
-ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb  404-dlang-zlib.patch"
+ddb3ca26b5e55f6d376036c2ed87959770bfb72d1175d0dba332f705edf6817806d53765c838ff670472a16ab175bd1ce88946c19d83f9d5e53ff2b4d3558dfb  404-dlang-zlib.patch
+3f40f796f50d49ea0a185d3454c79606fb5f90ed48c030fe25c1df8c4a72ba7cae37dccdb260cf737beb3e921dc2ddad68effbe446dbf220a07d0158b9b9ca8d  405-dlang-mips.patch"
-- 
GitLab