Github messages for voidlinux
 help / color / mirror / Atom feed
From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] Ldc cross compile
Date: Fri, 08 Sep 2023 16:44:23 +0200	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-45973@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]

There is a new pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages ldc-cross-compile
https://github.com/void-linux/void-packages/pull/45973

Ldc cross compile
<!-- Uncomment relevant sections and delete options which are not applicable -->
[ci skip][skip ci]
#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/45973.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-ldc-cross-compile-45973.patch --]
[-- Type: text/x-diff, Size: 76272 bytes --]

From 0c764a26945b226c36da9788f6b9bfca49ea6af2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Mon, 13 Mar 2023 23:59:22 +0700
Subject: [PATCH 1/8] New package: gcc11-11.3.0

---
 srcpkgs/gcc11-gdc                             |   1 +
 srcpkgs/gcc11/files/gccgo-musl.patch          | 162 +++++++++++
 srcpkgs/gcc11/files/libgnarl-musl.patch       | 122 ++++++++
 srcpkgs/gcc11/files/libssp-musl.patch         |  70 +++++
 ...se-poisoned-calloc-error-in-libgccji.patch |  80 ++++++
 srcpkgs/gcc11/patches/ada-shared.patch        |  28 ++
 .../patches/consistent-library-paths.patch    | 107 +++++++
 .../gcc11/patches/fix-cxxflags-passing.patch  |  10 +
 srcpkgs/gcc11/patches/fix-musl-execinfo.patch |  33 +++
 .../gcc11/patches/fix-vtv-link-order.patch    |  20 ++
 .../patches/force-override-clocale.patch      |  21 ++
 .../gcc11/patches/libgcc-ibm128-no-tag.patch  |  35 +++
 srcpkgs/gcc11/patches/mips-soft-float.patch   |  18 ++
 srcpkgs/gcc11/patches/musl-ada.patch          | 200 ++++++++++++++
 .../gcc11/patches/musl-generic-locale.patch   |  15 +
 srcpkgs/gcc11/template                        | 261 ++++++++++++++++++
 16 files changed, 1183 insertions(+)
 create mode 120000 srcpkgs/gcc11-gdc
 create mode 100644 srcpkgs/gcc11/files/gccgo-musl.patch
 create mode 100644 srcpkgs/gcc11/files/libgnarl-musl.patch
 create mode 100644 srcpkgs/gcc11/files/libssp-musl.patch
 create mode 100644 srcpkgs/gcc11/patches/0042-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch
 create mode 100644 srcpkgs/gcc11/patches/ada-shared.patch
 create mode 100644 srcpkgs/gcc11/patches/consistent-library-paths.patch
 create mode 100644 srcpkgs/gcc11/patches/fix-cxxflags-passing.patch
 create mode 100644 srcpkgs/gcc11/patches/fix-musl-execinfo.patch
 create mode 100644 srcpkgs/gcc11/patches/fix-vtv-link-order.patch
 create mode 100644 srcpkgs/gcc11/patches/force-override-clocale.patch
 create mode 100644 srcpkgs/gcc11/patches/libgcc-ibm128-no-tag.patch
 create mode 100644 srcpkgs/gcc11/patches/mips-soft-float.patch
 create mode 100644 srcpkgs/gcc11/patches/musl-ada.patch
 create mode 100644 srcpkgs/gcc11/patches/musl-generic-locale.patch
 create mode 100644 srcpkgs/gcc11/template

diff --git a/srcpkgs/gcc11-gdc b/srcpkgs/gcc11-gdc
new file mode 120000
index 0000000000000..7ab0b751796f2
--- /dev/null
+++ b/srcpkgs/gcc11-gdc
@@ -0,0 +1 @@
+gcc11
\ No newline at end of file
diff --git a/srcpkgs/gcc11/files/gccgo-musl.patch b/srcpkgs/gcc11/files/gccgo-musl.patch
new file mode 100644
index 0000000000000..35c6e3b3ceea3
--- /dev/null
+++ b/srcpkgs/gcc11/files/gccgo-musl.patch
@@ -0,0 +1,162 @@
+This is not among the normal patches as these changes are musl specific and
+there is no way to easily conditionalize it in source for some of the changes.
+
+Added by q66: runtime.h now uses libucontext_ prefixed APIs to allow build
+with freestanding versions of libucontext
+
+Souurce: Adélie Linux, q66
+URL: https://code.foxkit.us/adelie/packages/tree/master/system/gcc
+
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -50344,7 +50344,7 @@ configure-target-libgo:
+ 	esac; \
+ 	module_srcdir=libgo; \
+ 	rm -f no-such-file || : ; \
+-	CONFIG_SITE=no-such-file $(SHELL) \
++	CONFIG_SITE=no-such-file LIBS="-lucontext $$LIBS" $(SHELL) \
+ 	  $$s/$$module_srcdir/configure \
+ 	  --srcdir=$${topdir}/$$module_srcdir \
+ 	  $(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
+--- a/libgo/mksysinfo.sh
++++ b/libgo/mksysinfo.sh
+@@ -403,11 +403,7 @@ fi
+ # Some basic types.
+ echo 'type Size_t _size_t' >> ${OUT}
+ echo "type Ssize_t _ssize_t" >> ${OUT}
+-if grep '^const _HAVE_OFF64_T = ' gen-sysinfo.go > /dev/null 2>&1; then
+-  echo "type Offset_t _off64_t" >> ${OUT}
+-else
+-  echo "type Offset_t _off_t" >> ${OUT}
+-fi
++echo "type Offset_t _off_t" >> ${OUT}
+ echo "type Mode_t _mode_t" >> ${OUT}
+ echo "type Pid_t _pid_t" >> ${OUT}
+ echo "type Uid_t _uid_t" >> ${OUT}
+--- a/libgo/go/runtime/mem_gccgo.go
++++ b/libgo/go/runtime/mem_gccgo.go
+@@ -15,7 +15,7 @@ import (
+ //go:linkname sysFree
+ 
+ //extern mmap
+-func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) unsafe.Pointer
++func sysMmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) unsafe.Pointer
+ 
+ //extern munmap
+ func munmap(addr unsafe.Pointer, length uintptr) int32
+@@ -37,7 +37,7 @@ func init() {
+ 	}
+ }
+ 
+-func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uintptr) (unsafe.Pointer, int) {
++func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off int64) (unsafe.Pointer, int) {
+ 	p := sysMmap(addr, n, prot, flags, fd, off)
+ 	if uintptr(p) == _MAP_FAILED {
+ 		return nil, errno()
+--- a/libgo/go/syscall/errstr.go
++++ b/libgo/go/syscall/errstr.go
+@@ -5,7 +5,6 @@
+ // license that can be found in the LICENSE file.
+ 
+ // +build !hurd
+-// +build !linux
+ 
+ package syscall
+ 
+--- a/libgo/go/syscall/errstr_glibc.go
++++ /dev/null
+@@ -1,33 +0,0 @@
+-// errstr_glibc.go -- GNU/Linux and GNU/Hurd specific error strings.
+-
+-// Copyright 2010 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// We use this rather than errstr.go because on GNU/Linux sterror_r
+-// returns a pointer to the error message, and may not use buf at all.
+-
+-// +build hurd linux
+-
+-package syscall
+-
+-import "unsafe"
+-
+-//sysnb	strerror_r(errnum int, b []byte) (errstr *byte)
+-//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
+-
+-func Errstr(errnum int) string {
+-	a := make([]byte, 128)
+-	p := strerror_r(errnum, a)
+-	b := (*[1000]byte)(unsafe.Pointer(p))
+-	i := 0
+-	for b[i] != 0 {
+-		i++
+-	}
+-	// Lowercase first letter: Bad -> bad, but STREAM -> STREAM.
+-	if i > 1 && 'A' <= b[0] && b[0] <= 'Z' && 'a' <= b[1] && b[1] <= 'z' {
+-		c := b[0] + 'a' - 'A'
+-		return string(c) + string(b[1:i])
+-	}
+-	return string(b[:i])
+-}
+--- a/libgo/go/syscall/libcall_linux.go
++++ b/libgo/go/syscall/libcall_linux.go
+@@ -209,19 +209,19 @@ func Gettid() (tid int) {
+ //sys	Setxattr(path string, attr string, data []byte, flags int) (err error)
+ //setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int
+ 
+-//sys	splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
+-//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t
++//sys	splice(rfd int, roff *_off_t, wfd int, woff *_off_t, len int, flags int) (n int64, err error)
++//splice(rfd _C_int, roff *_off_t, wfd _C_int, woff *_off_t, len Size_t, flags _C_uint) Ssize_t
+ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
+-	var lroff _loff_t
+-	var plroff *_loff_t
++	var lroff _off_t
++	var plroff *_off_t
+ 	if roff != nil {
+-		lroff = _loff_t(*roff)
++		lroff = _off_t(*roff)
+ 		plroff = &lroff
+ 	}
+-	var lwoff _loff_t
+-	var plwoff *_loff_t
++	var lwoff _off_t
++	var plwoff *_off_t
+ 	if woff != nil {
+-		lwoff = _loff_t(*woff)
++		lwoff = _off_t(*woff)
+ 		plwoff = &lwoff
+ 	}
+ 	n, err = splice(rfd, plroff, wfd, plwoff, len, flags)
+--- a/libgo/runtime/runtime.h
++++ b/libgo/runtime/runtime.h
+@@ -501,10 +501,13 @@ int __go_setcontext(__go_context_t*);
+ void __go_makecontext(__go_context_t*, void (*)(), void*, size_t);
+ #else
+ #define __go_context_t	ucontext_t
+-#define __go_getcontext(c)	getcontext(c)
+-#define __go_setcontext(c)	setcontext(c)
++int  libucontext_getcontext(__go_context_t *);
++void libucontext_makecontext(__go_context_t *, void (*)(), int, ...);
++int  libucontext_setcontext(const __go_context_t *);
++#define __go_getcontext(c)	libucontext_getcontext(c)
++#define __go_setcontext(c)	libucontext_setcontext(c)
+ #define __go_makecontext(c, fn, sp, size) \
+-	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, makecontext(c, fn, 0))
++	((c)->uc_stack.ss_sp = sp, (c)->uc_stack.ss_size = size, libucontext_makecontext(c, fn, 0))
+ #endif
+ 
+ // Symbols defined by the linker.
+--- a/libgo/sysinfo.c
++++ b/libgo/sysinfo.c
+@@ -78,9 +78,6 @@
+ #include <sys/times.h>
+ #include <sys/wait.h>
+ #include <sys/un.h>
+-#if defined(HAVE_SYS_USER_H)
+-#include <sys/user.h>
+-#endif
+ #if defined(HAVE_SYS_UTSNAME_H)
+ #include <sys/utsname.h>
+ #endif
diff --git a/srcpkgs/gcc11/files/libgnarl-musl.patch b/srcpkgs/gcc11/files/libgnarl-musl.patch
new file mode 100644
index 0000000000000..5db06d337a229
--- /dev/null
+++ b/srcpkgs/gcc11/files/libgnarl-musl.patch
@@ -0,0 +1,122 @@
+Source: Alpine Linux
+Upstream: Unknown
+Reason: Patch libgnarl to not use function missing from musl.
+
+--- a/gcc/ada/libgnarl/s-osinte__linux.ads
++++ b/gcc/ada/libgnarl/s-osinte__linux.ads
+@@ -401,12 +401,6 @@ package System.OS_Interface is
+    PTHREAD_RWLOCK_PREFER_WRITER_NP              : constant := 1;
+    PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP : constant := 2;
+ 
+-   function pthread_rwlockattr_setkind_np
+-     (attr : access pthread_rwlockattr_t;
+-      pref : int) return int;
+-   pragma Import
+-     (C, pthread_rwlockattr_setkind_np, "pthread_rwlockattr_setkind_np");
+-
+    function pthread_rwlock_init
+      (mutex : access pthread_rwlock_t;
+       attr  : access pthread_rwlockattr_t) return int;
+@@ -468,11 +462,6 @@ package System.OS_Interface is
+       protocol : int) return int;
+    pragma Import (C, pthread_mutexattr_setprotocol);
+ 
+-   function pthread_mutexattr_setprioceiling
+-     (attr        : access pthread_mutexattr_t;
+-      prioceiling : int) return int;
+-   pragma Import (C, pthread_mutexattr_setprioceiling);
+-
+    type struct_sched_param is record
+       sched_priority : int;  --  scheduling priority
+    end record;
+--- a/gcc/ada/libgnarl/s-taprop__linux.adb
++++ b/gcc/ada/libgnarl/s-taprop__linux.adb
+@@ -198,9 +198,6 @@ package body System.Task_Primitives.Oper
+    pragma Import
+      (C, GNAT_pthread_condattr_setup, "__gnat_pthread_condattr_setup");
+ 
+-   function GNAT_has_cap_sys_nice return C.int;
+-   pragma Import
+-     (C, GNAT_has_cap_sys_nice, "__gnat_has_cap_sys_nice");
+    --  We do not have pragma Linker_Options ("-lcap"); here, because this
+    --  library is not present on many Linux systems. 'libcap' is the Linux
+    --  "capabilities" library, called by __gnat_has_cap_sys_nice.
+@@ -210,38 +207,6 @@ package body System.Task_Primitives.Oper
+    --  Convert Ada priority to Linux priority. Priorities are 1 .. 99 on
+    --  GNU/Linux, so we map 0 .. 98 to 1 .. 99.
+ 
+-   function Get_Ceiling_Support return Boolean;
+-   --  Get the value of the Ceiling_Support constant (see below).
+-   --  Note well: If this function or related code is modified, it should be
+-   --  tested by hand, because automated testing doesn't exercise it.
+-
+-   -------------------------
+-   -- Get_Ceiling_Support --
+-   -------------------------
+-
+-   function Get_Ceiling_Support return Boolean is
+-      Ceiling_Support : Boolean := False;
+-   begin
+-      if Locking_Policy /= 'C' then
+-         return False;
+-      end if;
+-
+-      declare
+-         function geteuid return Integer;
+-         pragma Import (C, geteuid, "geteuid");
+-         Superuser : constant Boolean := geteuid = 0;
+-         Has_Cap : constant C.int := GNAT_has_cap_sys_nice;
+-         pragma Assert (Has_Cap in 0 | 1);
+-      begin
+-         Ceiling_Support := Superuser or else Has_Cap = 1;
+-      end;
+-
+-      return Ceiling_Support;
+-   end Get_Ceiling_Support;
+-
+-   pragma Warnings (Off, "non-preelaborable call not allowed*");
+-   Ceiling_Support : constant Boolean := Get_Ceiling_Support;
+-   pragma Warnings (On, "non-preelaborable call not allowed*");
+    --  True if the locking policy is Ceiling_Locking, and the current process
+    --  has permission to use this policy. The process has permission if it is
+    --  running as 'root', or if the capability was set by the setcap command,
+@@ -344,7 +309,9 @@ package body System.Task_Primitives.Oper
+    -- Init_Mutex --
+    ----------------
+ 
++   pragma Warnings (Off, "formal parameter * is not referenced");
+    function Init_Mutex (L : RTS_Lock_Ptr; Prio : Any_Priority) return C.int is
++   pragma Warnings (On, "formal parameter * is not referenced");
+       Mutex_Attr : aliased pthread_mutexattr_t;
+       Result, Result_2 : C.int;
+ 
+@@ -356,16 +323,7 @@ package body System.Task_Primitives.Oper
+          return Result;
+       end if;
+ 
+-      if Ceiling_Support then
+-         Result := pthread_mutexattr_setprotocol
+-           (Mutex_Attr'Access, PTHREAD_PRIO_PROTECT);
+-         pragma Assert (Result = 0);
+-
+-         Result := pthread_mutexattr_setprioceiling
+-           (Mutex_Attr'Access, Prio_To_Linux_Prio (Prio));
+-         pragma Assert (Result = 0);
+-
+-      elsif Locking_Policy = 'I' then
++      if Locking_Policy = 'I' then
+          Result := pthread_mutexattr_setprotocol
+            (Mutex_Attr'Access, PTHREAD_PRIO_INHERIT);
+          pragma Assert (Result = 0);
+@@ -405,11 +363,6 @@ package body System.Task_Primitives.Oper
+             Result := pthread_rwlockattr_init (RWlock_Attr'Access);
+             pragma Assert (Result = 0);
+ 
+-            Result := pthread_rwlockattr_setkind_np
+-              (RWlock_Attr'Access,
+-               PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
+-            pragma Assert (Result = 0);
+-
+             Result := pthread_rwlock_init (L.RW'Access, RWlock_Attr'Access);
+ 
+             pragma Assert (Result in 0 | ENOMEM);
diff --git a/srcpkgs/gcc11/files/libssp-musl.patch b/srcpkgs/gcc11/files/libssp-musl.patch
new file mode 100644
index 0000000000000..c1c22699571e1
--- /dev/null
+++ b/srcpkgs/gcc11/files/libssp-musl.patch
@@ -0,0 +1,70 @@
+First part taken from Alpine.
+
+Second part added to prevent gccgo from thinking it can -fsplit-stack on musl.
+
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -977,10 +977,15 @@ proper position among the other output f
+ #define LINK_GCC_C_SEQUENCE_SPEC "%G %{!nolibc:%L %G}"
+ #endif
+ 
++#ifdef ENABLE_DEFAULT_SSP
++#define NO_SSP_SPEC "%{nostdlib|nodefaultlibs|ffreestanding:-fno-stack-protector} "
++#else
++#define NO_SSP_SPEC ""
++#endif
++
+ #ifndef LINK_SSP_SPEC
+ #ifdef TARGET_LIBC_PROVIDES_SSP
+-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+-		       "|fstack-protector-strong|fstack-protector-explicit:}"
++#define LINK_SSP_SPEC "-lssp_nonshared"
+ #else
+ #define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+ 		       "|fstack-protector-strong|fstack-protector-explicit" \
+@@ -1273,7 +1278,7 @@ static const char *cc1_options =
+  %{-version:--version}\
+  %{-help=*:--help=%*}\
+  %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %w%b.s}}}\
+- %{fsyntax-only:-o %j} %{-param*}\
++ %{fsyntax-only:-o %j} %{-param*} " NO_SSP_SPEC "\
+  %{coverage:-fprofile-arcs -ftest-coverage}\
+  %{fprofile-arcs|fprofile-generate*|coverage:\
+    %{!fprofile-update=single:\
+--- a/gcc/params.opt
++++ b/gcc/params.opt
+@@ -950,7 +950,7 @@ Common Joined UInteger Var(param_ssa_nam
+ The maximum number of SSA_NAME assignments to follow in determining a value.
+ 
+ -param=ssp-buffer-size=
+-Common Joined UInteger Var(param_ssp_buffer_size) Init(8) IntegerRange(1, 65536) Param Optimization
++Common Joined UInteger Var(param_ssp_buffer_size) Init(4) IntegerRange(1, 65536) Param Optimization
+ The lower bound for a buffer to be considered for stack smashing protection.
+ 
+ -param=stack-clash-protection-guard-size=
+--- a/gcc/config/i386/gnu-user-common.h
++++ b/gcc/config/i386/gnu-user-common.h
+@@ -64,9 +64,3 @@ along with GCC; see the file COPYING3.
+ 
+ /* Static stack checking is supported by means of probes.  */
+ #define STACK_CHECK_STATIC_BUILTIN 1
+-
+-/* We only build the -fsplit-stack support in libgcc if the
+-   assembler has full support for the CFI directives.  */
+-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+-#define TARGET_CAN_SPLIT_STACK
+-#endif
+--- a/gcc/config/i386/gnu.h
++++ b/gcc/config/i386/gnu.h
+@@ -40,11 +40,6 @@ along with GCC.  If not, see <http://www
+ /* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
+ #define TARGET_THREAD_SSP_OFFSET        0x14
+ 
+-/* We only build the -fsplit-stack support in libgcc if the
+-   assembler has full support for the CFI directives.  */
+-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+-#define TARGET_CAN_SPLIT_STACK
+-#endif
+ /* We steal the last transactional memory word.  */
+ #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
+ #endif
diff --git a/srcpkgs/gcc11/patches/0042-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch b/srcpkgs/gcc11/patches/0042-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch
new file mode 100644
index 0000000000000..7975e6339acaa
--- /dev/null
+++ b/srcpkgs/gcc11/patches/0042-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch
@@ -0,0 +1,80 @@
+From 72f32e3383129ad139df76d9a063fac9b03079b1 Mon Sep 17 00:00:00 2001
+From: Alex McGrath <amk@amk.ie>
+Date: Wed, 13 Oct 2021 23:24:27 +0100
+Subject: [PATCH] Fix attempt to use poisoned calloc error in libgccjit
+
+This moves usages of pthread.h to above any usage of system.h as it
+included #pragma GCC poison calloc
+---
+ gcc/jit/jit-playback.c  | 4 ++--
+ gcc/jit/jit-recording.c | 4 ++--
+ gcc/jit/libgccjit.c     | 3 ++-
+ 3 files changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/gcc/jit/jit-playback.c b/gcc/jit/jit-playback.c
+index cee9daa8220..a5600084933 100644
+--- a/gcc/jit/jit-playback.c
++++ b/gcc/jit/jit-playback.c
+@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#include <pthread.h>
++
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+@@ -41,8 +43,6 @@ along with GCC; see the file COPYING3.  If not see
+ #include "diagnostic.h"
+ #include "stmt.h"
+ 
+-#include <pthread.h>
+-
+ #include "jit-playback.h"
+ #include "jit-result.h"
+ #include "jit-builtins.h"
+diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
+index 117ff70114c..d2634a546b1 100644
+--- a/gcc/jit/jit-recording.c
++++ b/gcc/jit/jit-recording.c
+@@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#include <pthread.h>
++
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+@@ -25,8 +27,6 @@ along with GCC; see the file COPYING3.  If not see
+ #include "pretty-print.h"
+ #include "toplev.h"
+ 
+-#include <pthread.h>
+-
+ #include "jit-builtins.h"
+ #include "jit-recording.h"
+ #include "jit-playback.h"
+diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
+index 0cc650f9810..2f44481eeb0 100644
+--- a/gcc/jit/libgccjit.c
++++ b/gcc/jit/libgccjit.c
+@@ -18,13 +18,14 @@ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
++#include <pthread.h>
++
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+ #include "timevar.h"
+ #include "typed-splay-tree.h"
+ #include "cppbuiltin.h"
+-#include <pthread.h>
+ 
+ #include "libgccjit.h"
+ #include "jit-recording.h"
+-- 
+2.35.1
+
diff --git a/srcpkgs/gcc11/patches/ada-shared.patch b/srcpkgs/gcc11/patches/ada-shared.patch
new file mode 100644
index 0000000000000..dba5fb1d7deee
--- /dev/null
+++ b/srcpkgs/gcc11/patches/ada-shared.patch
@@ -0,0 +1,28 @@
+--- a/gcc/ada/link.c
++++ b/gcc/ada/link.c
+@@ -107,9 +107,9 @@ const char *__gnat_default_libgcc_subdir
+    || defined (__NetBSD__) || defined (__OpenBSD__) \
+    || defined (__QNX__)
+ const char *__gnat_object_file_option = "-Wl,@";
+-const char *__gnat_run_path_option = "-Wl,-rpath,";
+-char __gnat_shared_libgnat_default = STATIC;
+-char __gnat_shared_libgcc_default = STATIC;
++const char *__gnat_run_path_option = "";
++char __gnat_shared_libgnat_default = SHARED;
++char __gnat_shared_libgcc_default = SHARED;
+ int __gnat_link_max = 8192;
+ unsigned char __gnat_objlist_file_supported = 1;
+ const char *__gnat_object_library_extension = ".a";
+@@ -129,9 +129,9 @@ const char *__gnat_default_libgcc_subdir
+ 
+ #elif defined (__linux__) || defined (__GLIBC__)
+ const char *__gnat_object_file_option = "-Wl,@";
+-const char *__gnat_run_path_option = "-Wl,-rpath,";
+-char __gnat_shared_libgnat_default = STATIC;
+-char __gnat_shared_libgcc_default = STATIC;
++const char *__gnat_run_path_option = "";
++char __gnat_shared_libgnat_default = SHARED;
++char __gnat_shared_libgcc_default = SHARED;
+ int __gnat_link_max = 8192;
+ unsigned char __gnat_objlist_file_supported = 1;
+ const char *__gnat_object_library_extension = ".a";
diff --git a/srcpkgs/gcc11/patches/consistent-library-paths.patch b/srcpkgs/gcc11/patches/consistent-library-paths.patch
new file mode 100644
index 0000000000000..8ea6f17f3e752
--- /dev/null
+++ b/srcpkgs/gcc11/patches/consistent-library-paths.patch
@@ -0,0 +1,107 @@
+Always use lib64 for 64-bit and lib32 for 32-bit.
+
+Do not change the dynamic linkers in any way, though.
+
+When adding a new platform, fix this up too.
+
+--- a/gcc/config/aarch64/t-aarch64-linux
++++ b/gcc/config/aarch64/t-aarch64-linux
+@@ -22,7 +22,7 @@ LIB1ASMSRC   = aarch64/lib1funcs.asm
+ LIB1ASMFUNCS = _aarch64_sync_cache_range
+ 
+ AARCH_BE = $(if $(findstring TARGET_BIG_ENDIAN_DEFAULT=1, $(tm_defines)),_be)
+-MULTILIB_OSDIRNAMES = mabi.lp64=../lib64$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu)
++MULTILIB_OSDIRNAMES = mabi.lp64=../lib64
+ MULTIARCH_DIRNAME = $(call if_multiarch,aarch64$(AARCH_BE)-linux-gnu)
+ 
+ MULTILIB_OSDIRNAMES += mabi.ilp32=../libilp32$(call if_multiarch,:aarch64$(AARCH_BE)-linux-gnu_ilp32)
+--- a/gcc/config/i386/t-linux64
++++ b/gcc/config/i386/t-linux64
+@@ -33,6 +33,6 @@
+ comma=,
+ MULTILIB_OPTIONS    = $(subst $(comma),/,$(TM_MULTILIB_CONFIG))
+ MULTILIB_DIRNAMES   = $(patsubst m%, %, $(subst /, ,$(MULTILIB_OPTIONS)))
+-MULTILIB_OSDIRNAMES = m64=../lib64$(call if_multiarch,:x86_64-linux-gnu)
+-MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-linux-gnu)
++MULTILIB_OSDIRNAMES = m64=../lib64
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_OSDIRNAMES+= mx32=../libx32$(call if_multiarch,:x86_64-linux-gnux32)
+--- a/gcc/config/mips/t-linux64
++++ b/gcc/config/mips/t-linux64
+@@ -21,6 +21,6 @@ MULTILIB_DIRNAMES = n32 32 64
+ MIPS_EL = $(if $(filter %el, $(firstword $(subst -, ,$(target)))),el)
+ MIPS_SOFT = $(if $(strip $(filter MASK_SOFT_FLOAT_ABI, $(target_cpu_default)) $(filter soft, $(with_float))),soft)
+ MULTILIB_OSDIRNAMES = \
+-	../lib32$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabin32$(MIPS_SOFT)) \
+-	../lib$(call if_multiarch,:mips$(MIPS_EL)-linux-gnu$(MIPS_SOFT)) \
+-	../lib64$(call if_multiarch,:mips64$(MIPS_EL)-linux-gnuabi64$(MIPS_SOFT))
++	../lib32 \
++	../lib \
++	../lib64
+--- a/gcc/config/rs6000/t-linux
++++ b/gcc/config/rs6000/t-linux
+@@ -2,7 +2,8 @@
+ # or soft-float.
+ ifeq (,$(filter $(with_cpu),$(SOFT_FLOAT_CPUS))$(findstring soft,$(with_float)))
+ ifneq (,$(findstring powerpc64,$(target)))
+-MULTILIB_OSDIRNAMES := .=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
++MULTILIB_OSDIRNAMES := m64=../lib64
++MULTILIB_OSDIRNAMES += m32=../lib32
+ else
+ MULTIARCH_DIRNAME := $(call if_multiarch,powerpc-linux-gnu)
+ endif
+@@ -10,7 +11,8 @@ ifneq (,$(findstring powerpcle,$(target)
+ MULTIARCH_DIRNAME := $(subst -linux,le-linux,$(MULTIARCH_DIRNAME))
+ endif
+ ifneq (,$(findstring powerpc64le,$(target)))
+-MULTILIB_OSDIRNAMES := $(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))
++MULTILIB_OSDIRNAMES := m64=../lib64
++MULTILIB_OSDIRNAMES += m32=../lib32
+ endif
+ endif
+ 
+--- a/gcc/config/rs6000/t-linux64
++++ b/gcc/config/rs6000/t-linux64
+@@ -28,8 +28,8 @@
+ MULTILIB_OPTIONS    := m64/m32
+ MULTILIB_DIRNAMES   := 64 32
+ MULTILIB_EXTRA_OPTS := 
+-MULTILIB_OSDIRNAMES := m64=../lib64$(call if_multiarch,:powerpc64-linux-gnu)
+-MULTILIB_OSDIRNAMES += m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:powerpc-linux-gnu)
++MULTILIB_OSDIRNAMES := m64=../lib64
++MULTILIB_OSDIRNAMES += m32=../lib32
+ 
+ rs6000-linux.o: $(srcdir)/config/rs6000/rs6000-linux.c
+ 	$(COMPILE) $<
+--- a/gcc/config/rs6000/t-linux64bele
++++ b/gcc/config/rs6000/t-linux64bele
+@@ -2,6 +2,6 @@
+ 
+ MULTILIB_OPTIONS    += mlittle
+ MULTILIB_DIRNAMES   += le
+-MULTILIB_OSDIRNAMES += $(subst =,.mlittle=,$(subst lible32,lib32le,$(subst lible64,lib64le,$(subst lib,lible,$(subst -linux,le-linux,$(MULTILIB_OSDIRNAMES))))))
+-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mlittle%,$(MULTILIB_OSDIRNAMES)))
++MULTILIB_OSDIRNAMES = m64=../lib64
++MULTILIB_OSDIRNAMES+= m32=../lib32
+ MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
+--- a/gcc/config/rs6000/t-linux64lebe
++++ b/gcc/config/rs6000/t-linux64lebe
+@@ -2,6 +2,6 @@
+ 
+ MULTILIB_OPTIONS    += mbig
+ MULTILIB_DIRNAMES   += be
+-MULTILIB_OSDIRNAMES += $(subst =,.mbig=,$(subst libbe32,lib32be,$(subst libbe64,lib64be,$(subst lib,libbe,$(subst le-linux,-linux,$(MULTILIB_OSDIRNAMES))))))
+-MULTILIB_OSDIRNAMES += $(subst $(if $(findstring 64,$(target)),m64,m32).,,$(filter $(if $(findstring 64,$(target)),m64,m32).mbig%,$(MULTILIB_OSDIRNAMES)))
++MULTILIB_OSDIRNAMES := m64=../lib64
++MULTILIB_OSDIRNAMES += m32=../lib32
+ MULTILIB_MATCHES    := ${MULTILIB_MATCHES_ENDIAN}
+--- a/gcc/config/s390/t-linux64
++++ b/gcc/config/s390/t-linux64
+@@ -7,5 +7,5 @@
+ 
+ MULTILIB_OPTIONS = m64/m31
+ MULTILIB_DIRNAMES = 64 32
+-MULTILIB_OSDIRNAMES = ../lib64$(call if_multiarch,:s390x-linux-gnu)
+-MULTILIB_OSDIRNAMES += $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:s390-linux-gnu)
++MULTILIB_OSDIRNAMES = m64=../lib64
++MULTILIB_OSDIRNAMES+= m32=../lib32
diff --git a/srcpkgs/gcc11/patches/fix-cxxflags-passing.patch b/srcpkgs/gcc11/patches/fix-cxxflags-passing.patch
new file mode 100644
index 0000000000000..d6c65aaafa827
--- /dev/null
+++ b/srcpkgs/gcc11/patches/fix-cxxflags-passing.patch
@@ -0,0 +1,10 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -174,6 +174,7 @@ BUILD_EXPORTS = \
+ # built for the build system to override those in BASE_FLAGS_TO_PASS.
+ EXTRA_BUILD_FLAGS = \
+ 	CFLAGS="$(CFLAGS_FOR_BUILD)" \
++	CXXFLAGS="$(CXXFLAGS_FOR_BUILD)" \
+ 	LDFLAGS="$(LDFLAGS_FOR_BUILD)"
+ 
+ # This is the list of directories to built for the host system.
diff --git a/srcpkgs/gcc11/patches/fix-musl-execinfo.patch b/srcpkgs/gcc11/patches/fix-musl-execinfo.patch
new file mode 100644
index 0000000000000..2d9d181204741
--- /dev/null
+++ b/srcpkgs/gcc11/patches/fix-musl-execinfo.patch
@@ -0,0 +1,33 @@
+There is no <execinfo.h> in musl libc
+
+--- a/libvtv/vtv_rts.cc
++++ b/libvtv/vtv_rts.cc
+@@ -124,7 +124,7 @@
+ #include <windows.h>
+ #include <winternl.h>
+ #include <psapi.h>
+-#else
++#elif defined (__GLIBC__)
+ #include <execinfo.h>
+ #endif
+ 
+--- a/libvtv/vtv_utils.cc
++++ b/libvtv/vtv_utils.cc
+@@ -34,7 +34,7 @@
+ #include <string.h>
+ #if defined (__CYGWIN__) || defined (__MINGW32__)
+ #include <windows.h>
+-#else
++#elif defined (__GLIBC__)
+ #include <execinfo.h>
+ #endif
+ 
+@@ -178,7 +178,7 @@ __vtv_log_verification_failure (const ch
+ 
+   __vtv_add_to_log (vtv_failures_log_fd, "%s", log_msg);
+ 
+-#if !defined (__CYGWIN__) && !defined (__MINGW32__)
++#if !defined (__CYGWIN__) && !defined (__MINGW32__) && defined(__GLIBC__)
+   if (generate_backtrace)
+     {
+ #define STACK_DEPTH 20
diff --git a/srcpkgs/gcc11/patches/fix-vtv-link-order.patch b/srcpkgs/gcc11/patches/fix-vtv-link-order.patch
new file mode 100644
index 0000000000000..1bb0ef277bb60
--- /dev/null
+++ b/srcpkgs/gcc11/patches/fix-vtv-link-order.patch
@@ -0,0 +1,20 @@
+put vtv_end.o in front of postdep_objects_CXX
+having it after crtendS.o leads to missing zero termination in eh_frame section
+
+This is in line with comment in libgcc/vtv_end.c:
+
+   When the GCC driver inserts vtv_start.o into the link line (just
+   after crtbegin.o) it also inserts vtv_end.o into the link line,
+   just before crtend.o.
+
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -15566,7 +15566,7 @@ esac
+ 
+ if test "$enable_vtable_verify" = yes; then
+   predep_objects_CXX="${predep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_start.o"
+-  postdep_objects_CXX="${postdep_objects_CXX} ${glibcxx_builddir}/../libgcc/vtv_end.o"
++  postdep_objects_CXX="${glibcxx_builddir}/../libgcc/vtv_end.o ${postdep_objects_CXX}" 
+ fi
+ 
+ 
diff --git a/srcpkgs/gcc11/patches/force-override-clocale.patch b/srcpkgs/gcc11/patches/force-override-clocale.patch
new file mode 100644
index 0000000000000..457ec3849e498
--- /dev/null
+++ b/srcpkgs/gcc11/patches/force-override-clocale.patch
@@ -0,0 +1,21 @@
+This is necessary when building a gnu cross compiler for a musl target.
+Otherwise, even if clocale manually is set to gnu, it will be reset to generic
+when the test is performed using AC_EGREP_CPP().
+--- a/libstdc++-v3/configure
++++ b/libstdc++-v3/configure
+@@ -16504,6 +16504,7 @@ fi
+ 
+   # Sanity check model, and test for special functionality.
+   if test $enable_clocale_flag = gnu; then
++    if test $enable_clocale = auto; then
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
+@@ -16520,6 +16521,7 @@ else
+   enable_clocale_flag=generic
+ fi
+ rm -f conftest*
++    fi
+ 
+ 
+     # Set it to scream when it hurts.
diff --git a/srcpkgs/gcc11/patches/libgcc-ibm128-no-tag.patch b/srcpkgs/gcc11/patches/libgcc-ibm128-no-tag.patch
new file mode 100644
index 0000000000000..b38cab8ddffae
--- /dev/null
+++ b/srcpkgs/gcc11/patches/libgcc-ibm128-no-tag.patch
@@ -0,0 +1,35 @@
+From 236634eed58fa6e00cc50f19e7202903a9d8fae6 Mon Sep 17 00:00:00 2001
+From: q66 <daniel@octaforge.org>
+Date: Thu, 12 Dec 2019 04:03:56 +0100
+Subject: [PATCH] libgcc: use -mno-gnu-attribute for 128-bit IBM ldouble
+ support code
+
+Doing this will allow libgcc to emit the appropriate symbols without actually
+emitting the FP ABI tag for them, which allows 64-bit long double environments
+to function and even link statically while still allowing usage of
+explicit __ibm128.
+---
+ libgcc/config/rs6000/t-ibm-ldouble | 2 +-
+ libgcc/config/rs6000/t-linux       | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/libgcc/config/rs6000/t-ibm-ldouble
++++ b/libgcc/config/rs6000/t-ibm-ldouble
+@@ -1,6 +1,6 @@
+ # GCC 128-bit long double support routines.
+ LIB2ADD += $(srcdir)/config/rs6000/ibm-ldouble.c
+ 
+-HOST_LIBGCC2_CFLAGS += -mlong-double-128
++HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-gnu-attribute
+ 
+ SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-ibm-ldouble.ver
+--- a/libgcc/config/rs6000/t-linux
++++ b/libgcc/config/rs6000/t-linux
+@@ -1,6 +1,6 @@
+ SHLIB_MAPFILES += $(srcdir)/config/rs6000/libgcc-glibc.ver
+ 
+-HOST_LIBGCC2_CFLAGS += -mlong-double-128
++HOST_LIBGCC2_CFLAGS += -mlong-double-128 -mno-gnu-attribute
+ 
+ # This is a way of selecting -mcmodel=small for ppc64, which gives
+ # smaller and faster libgcc code.  Directly specifying -mcmodel=small
diff --git a/srcpkgs/gcc11/patches/mips-soft-float.patch b/srcpkgs/gcc11/patches/mips-soft-float.patch
new file mode 100644
index 0000000000000..5e966ff313d18
--- /dev/null
+++ b/srcpkgs/gcc11/patches/mips-soft-float.patch
@@ -0,0 +1,18 @@
+--- a/libffi/src/mips/o32.S
++++ b/libffi/src/mips/o32.S
+@@ -278,6 +278,7 @@ $LCFI7:
+ 	li	$9, FFI_TYPE_VOID
+ 	beq	$8, $9, closure_done
+ 
++#ifndef __mips_soft_float
+ 	li	$13, 1		# FFI_O32
+ 	bne	$16, $13, 1f	# Skip fp restore if FFI_O32_SOFT_FLOAT
+ 
+@@ -289,6 +290,7 @@ $LCFI7:
+ 	l.d	$f0, V0_OFF2($fp)
+ 	beq	$8, $9, closure_done
+ 1:	
++#endif
+ 	REG_L	$3, V1_OFF2($fp)
+ 	REG_L	$2, V0_OFF2($fp)
+ 
diff --git a/srcpkgs/gcc11/patches/musl-ada.patch b/srcpkgs/gcc11/patches/musl-ada.patch
new file mode 100644
index 0000000000000..c640741e9ab95
--- /dev/null
+++ b/srcpkgs/gcc11/patches/musl-ada.patch
@@ -0,0 +1,200 @@
+--- a/gcc/ada/adaint.c
++++ b/gcc/ada/adaint.c
+@@ -91,6 +91,11 @@
+ #include <sys/param.h>
+ #include <sys/pstat.h>
+ #endif
++ 
++#if defined (linux)
++#define _GNU_SOURCE 1
++#include <sched.h>
++#endif
+ 
+ #ifdef __PikeOS__
+ #define __BSD_VISIBLE 1
+@@ -3442,7 +3447,6 @@ __gnat_lwp_self (void)
+ #endif
+ 
+ #if defined (__linux__)
+-#include <sched.h>
+ 
+ /* glibc versions earlier than 2.7 do not define the routines to handle
+    dynamically allocated CPU sets. For these targets, we use the static
+@@ -3452,7 +3456,7 @@ __gnat_lwp_self (void)
+ 
+ /* Dynamic cpu sets */
+ 
+-cpu_set_t *
++void *
+ __gnat_cpu_alloc (size_t count)
+ {
+   return CPU_ALLOC (count);
+@@ -3465,33 +3469,33 @@ __gnat_cpu_alloc_size (size_t count)
+ }
+ 
+ void
+-__gnat_cpu_free (cpu_set_t *set)
++__gnat_cpu_free (void *set)
+ {
+-  CPU_FREE (set);
++  CPU_FREE ((cpu_set_t *) set);
+ }
+ 
+ void
+-__gnat_cpu_zero (size_t count, cpu_set_t *set)
++__gnat_cpu_zero (size_t count, void *set)
+ {
+-  CPU_ZERO_S (count, set);
++  CPU_ZERO_S (count, (cpu_set_t *) set);
+ }
+ 
+ void
+-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
++__gnat_cpu_set (int cpu, size_t count, void *set)
+ {
+   /* Ada handles CPU numbers starting from 1, while C identifies the first
+      CPU by a 0, so we need to adjust. */
+-  CPU_SET_S (cpu - 1, count, set);
++  CPU_SET_S (cpu - 1, count, (cpu_set_t *) set);
+ }
+ 
+ #else /* !CPU_ALLOC */
+ 
+ /* Static cpu sets */
+ 
+-cpu_set_t *
++void *
+ __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
+ {
+-  return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
++  return xmalloc (sizeof (cpu_set_t));
+ }
+ 
+ size_t
+@@ -3501,23 +3505,23 @@ __gnat_cpu_alloc_size (size_t count ATTR
+ }
+ 
+ void
+-__gnat_cpu_free (cpu_set_t *set)
++__gnat_cpu_free (void *set)
+ {
+   free (set);
+ }
+ 
+ void
+-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)
+ {
+-  CPU_ZERO (set);
++  CPU_ZERO ((cpu_set_t *) set);
+ }
+ 
+ void
+-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
++__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)
+ {
+   /* Ada handles CPU numbers starting from 1, while C identifies the first
+      CPU by a 0, so we need to adjust. */
+-  CPU_SET (cpu - 1, set);
++  CPU_SET (cpu - 1, (cpu_set_t *) set);
+ }
+ #endif /* !CPU_ALLOC */
+ #endif /* __linux__ */
+--- a/gcc/ada/adaint.h
++++ b/gcc/ada/adaint.h
+@@ -325,13 +325,11 @@ extern void   *__gnat_lwp_self			   (voi
+ 
+ /* Routines for interface to required CPU set primitives */
+ 
+-#include <sched.h>
+-
+-extern cpu_set_t *__gnat_cpu_alloc                 (size_t);
++extern void * __gnat_cpu_alloc                 (size_t);
+ extern size_t __gnat_cpu_alloc_size                (size_t);
+-extern void   __gnat_cpu_free                  (cpu_set_t *);
+-extern void   __gnat_cpu_zero                      (size_t, cpu_set_t *);
+-extern void   __gnat_cpu_set                       (int, size_t, cpu_set_t *);
++extern void   __gnat_cpu_free                  (void *);
++extern void   __gnat_cpu_zero                      (size_t, void *);
++extern void   __gnat_cpu_set                       (int, size_t, void *);
+ #endif
+ 
+ #if defined (_WIN32)
+--- a/gcc/ada/Makefile.rtl
++++ b/gcc/ada/Makefile.rtl
+@@ -1748,7 +1748,7 @@ ifeq ($(strip $(filter-out %86 linux%,$(
+   s-intman.adb<libgnarl/s-intman__posix.adb \
+   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+   $(TRASYM_DWARF_UNIX_PAIRS) \
+-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++  s-tsmona.adb<libgnat/s-tsmona.adb \
+   a-exetim.adb<libgnarl/a-exetim__posix.adb \
+   a-exetim.ads<libgnarl/a-exetim__default.ads \
+   s-linux.ads<libgnarl/s-linux.ads \
+@@ -2355,7 +2355,7 @@ ifeq ($(strip $(filter-out powerpc% linu
+   s-tasinf.adb<libgnarl/s-tasinf__linux.adb \
+   s-taspri.ads<libgnarl/s-taspri__posix.ads \
+   $(TRASYM_DWARF_UNIX_PAIRS) \
+-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++  s-tsmona.adb<libgnat/s-tsmona.adb \
+   $(ATOMICS_TARGET_PAIRS) \
+   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+   system.ads<libgnat/system-linux-ppc.ads
+@@ -2386,7 +2386,7 @@ ifeq ($(strip $(filter-out powerpc% linu
+ endif
+ 
+ # ARM linux, GNU eabi
+-ifeq ($(strip $(filter-out arm% linux-gnueabi%,$(target_cpu) $(target_os))),)
++ifeq ($(strip $(filter-out arm% linux-gnueabi% linux-musleabi% linux-muslgnueabi%,$(target_cpu) $(target_os))),)
+   LIBGNAT_TARGET_PAIRS = \
+   a-intnam.ads<libgnarl/a-intnam__linux.ads \
+   s-inmaop.adb<libgnarl/s-inmaop__posix.adb \
+@@ -2597,7 +2597,7 @@ ifeq ($(strip $(filter-out %ia64 linux%,
+   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+   s-taspri.ads<libgnarl/s-taspri__posix-noaltstack.ads \
+   $(TRASYM_DWARF_UNIX_PAIRS) \
+-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++  s-tsmona.adb<libgnat/s-tsmona.adb \
+   $(ATOMICS_TARGET_PAIRS) \
+   $(ATOMICS_BUILTINS_TARGET_PAIRS) \
+   $(GNATRTL_128BIT_PAIRS) \
+@@ -2700,7 +2700,7 @@ ifeq ($(strip $(filter-out %x86_64 linux
+   s-tpopsp.adb<libgnarl/s-tpopsp__tls.adb \
+   s-taspri.ads<libgnarl/s-taspri__posix.ads \
+   $(TRASYM_DWARF_UNIX_PAIRS) \
+-  s-tsmona.adb<libgnat/s-tsmona__linux.adb \
++  s-tsmona.adb<libgnat/s-tsmona.adb \
+   $(ATOMICS_TARGET_PAIRS) \
+   $(X86_64_TARGET_PAIRS) \
+   $(GNATRTL_128BIT_PAIRS) \
+--- a/gcc/ada/terminals.c
++++ b/gcc/ada/terminals.c
+@@ -1132,7 +1132,7 @@ __gnat_setup_winsize (void *desc ATTRIBU
+ /* POSIX does not specify how to open the master side of a terminal.Several
+    methods are available (system specific):
+       1- using a cloning device (USE_CLONE_DEVICE)
+-      2- getpt                  (USE_GETPT)
++      2- posix_openpt           (USE_POSIX_OPENPT)
+       3- openpty                (USE_OPENPTY)
+ 
+    When using the cloning device method, the macro USE_CLONE_DEVICE should
+@@ -1146,7 +1146,7 @@ __gnat_setup_winsize (void *desc ATTRIBU
+ #if defined (__APPLE__) || defined (BSD)
+ #define USE_OPENPTY
+ #elif defined (__linux__)
+-#define USE_GETPT
++#define USE_POSIX_OPENPT
+ #elif defined (__sun__)
+ #define USE_CLONE_DEVICE "/dev/ptmx"
+ #elif defined (_AIX)
+@@ -1195,8 +1195,8 @@ allocate_pty_desc (pty_desc **desc) {
+    int  master_fd   = -1;
+    char *slave_name = NULL;
+ 
+-#ifdef USE_GETPT
+-  master_fd = getpt ();
++#if defined(USE_POSIX_OPENPT)
++  master_fd = posix_openpt(O_RDWR | O_NOCTTY);
+ #elif defined (USE_OPENPTY)
+   status = openpty (&master_fd, &slave_fd, NULL, NULL, NULL);
+ #elif defined (USE_CLONE_DEVICE)
diff --git a/srcpkgs/gcc11/patches/musl-generic-locale.patch b/srcpkgs/gcc11/patches/musl-generic-locale.patch
new file mode 100644
index 0000000000000..db8d96b71df89
--- /dev/null
+++ b/srcpkgs/gcc11/patches/musl-generic-locale.patch
@@ -0,0 +1,15 @@
+See
+https://inbox.vuxu.org/musl/551d3310-039f-23c4-608e-5e15e625f638@sholland.org/
+
+--- a/libstdc++-v3/config/locale/generic/c_locale.cc
++++ b/libstdc++-v3/config/locale/generic/c_locale.cc
+@@ -242,9 +242,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+     // Currently, the generic model only supports the "C" locale.
+     // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
+     __cloc = 0;
+-    if (strcmp(__s, "C"))
+-      __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
+-			    "name not valid"));
+   }
+ 
+   void
diff --git a/srcpkgs/gcc11/template b/srcpkgs/gcc11/template
new file mode 100644
index 0000000000000..695668bc3ec81
--- /dev/null
+++ b/srcpkgs/gcc11/template
@@ -0,0 +1,261 @@
+# Template file for 'gcc11'
+# for gdc
+pkgname=gcc11
+version=11.4.0
+revision=1
+_majorver="${version%%.*}"
+_minorver="${version%.*}"
+build_style=gnu-configure
+hostmakedepends="tar texinfo perl flex"
+makedepends="zlib-devel libzstd-devel"
+depends="binutils"
+checkdepends="dejagnu"
+short_desc="GNU Compiler Collection - version ${_majorver}"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+homepage="http://gcc.gnu.org"
+license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
+_gmp_version=6.2.1
+_mpfr_version=4.1.0
+_mpc_version=1.2.1
+_isl_version=0.24
+distfiles="
+ ${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz
+ https://gmplib.org/download/gmp/gmp-${_gmp_version}.tar.xz
+ ${GNU_SITE}/mpfr/mpfr-${_mpfr_version}.tar.xz
+ ${GNU_SITE}/mpc/mpc-${_mpc_version}.tar.gz
+ ${SOURCEFORGE_SITE}/libisl/isl-${_isl_version}.tar.bz2"
+checksum="
+ 3f2db222b007e8a4a23cd5ba56726ef08e8b1f1eb2055ee72c1402cea73a8dd9
+ fd4829912cddd12f84181c3451cc752be224643e87fac497b69edddadc49b4f2
+ 0c98a3f1732ff6ca4ea690552079da9c597872d30e96ec28414ee23c95558a7f
+ 17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459
+ fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0"
+nopie=yes
+lib32disabled=yes
+repository=bootstrap
+skip_extraction="
+ gmp-${_gmp_version}.tar.xz
+ mpfr-${_mpfr_version}.tar.xz
+ mpc-${_mpc_version}.tar.gz
+ isl-${_isl_version}.tar.bz2
+ "
+
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
+	depends+=" musl-devel"
+else
+	depends+=" glibc-devel"
+fi
+
+case "$XBPS_TARGET_MACHINE" in
+	i686) _triplet="i686-pc-linux-gnu";;
+	i686-musl) _triplet="i686-linux-musl";;
+	x86_64) _triplet="x86_64-linux-gnu";;
+	x86_64-musl) _triplet="x86_64-linux-musl";;
+	armv5tel) _triplet="arm-linux-gnueabi";;
+	armv5tel-musl) _triplet="arm-linux-musleabi";;
+	armv6l) _triplet="arm-linux-gnueabihf";;
+	armv7l) _triplet="armv7l-linux-gnueabihf";;
+	armv6l-musl) _triplet="arm-linux-musleabihf";;
+	armv7l-musl) _triplet="armv7l-linux-musleabihf";;
+	aarch64) _triplet="aarch64-linux-gnu";;
+	aarch64-musl) _triplet="aarch64-linux-musl";;
+	ppc) _triplet="powerpc-linux-gnu";;
+	ppc-musl) _triplet="powerpc-linux-musl";;
+	ppcle) _triplet="powerpcle-linux-gnu";;
+	ppcle-musl) _triplet="powerpcle-linux-musl";;
+	ppc64le) _triplet="powerpc64le-linux-gnu";;
+	ppc64le-musl) _triplet="powerpc64le-linux-musl";;
+	ppc64) _triplet="powerpc64-linux-gnu";;
+	ppc64-musl) _triplet="powerpc64-linux-musl";;
+	mips-musl) _triplet="mips-linux-musl";;
+	mipshf-musl) _triplet="mips-linux-muslhf";;
+	mipsel-musl) _triplet="mipsel-linux-musl";;
+	mipselhf-musl) _triplet="mipsel-linux-muslhf";;
+esac
+
+if [ "$CROSS_BUILD" ]; then
+	hostmakedepends+=" cross-${_triplet}"
+fi
+
+post_extract() {
+	vsrcextract -C gmp gmp-${_gmp_version}.tar.xz
+	vsrcextract -C mpfr mpfr-${_mpfr_version}.tar.xz
+	vsrcextract -C mpc mpc-${_mpc_version}.tar.gz
+	vsrcextract -C isl isl-${_isl_version}.tar.bz2
+}
+
+post_patch() {
+	# _FORTIFY_SOURCE needs an optimization level.
+	vsed -i '/ac_cpp=/s/[$]CPPFLAGS/$CPPFLAGS -O2/' {gcc,libiberty}/configure
+
+	# Do not run fixincludes
+	sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
+
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
+		for p in ${FILESDIR}/*-musl.patch; do
+			patch -Np1 -i $p
+		done
+	fi
+}
+
+do_configure() {
+	local _args _hash
+	_hash=gnu
+	case "$XBPS_TARGET_MACHINE" in
+		mipselhf-musl) _args+=" --with-arch=mips32r2 --with-float=hard"; _hash=sysv;;
+		mipsel-musl) _args+=" --with-arch=mips32r2 --with-float=soft"; _hash=sysv;;
+		mipshf-musl) _args+=" --with-arch=mips32r2 --with-float=hard";;
+		mips-musl) _args+=" --with-arch=mips32r2 --with-float=soft";;
+		armv5*) _args+=" --with-arch=armv5te --with-float=soft";;
+		armv6l*) _args+=" --with-arch=armv6 --with-fpu=vfp --with-float=hard";;
+		armv7l*) _args+=" --with-arch=armv7-a --with-fpu=vfpv3 --with-float=hard";;
+		aarch64*) _args+=" --with-arch=armv8-a";;
+		ppc64le*) _args+=" --with-abi=elfv2 --enable-secureplt --enable-targets=powerpcle-linux";;
+		ppc64*) _args+=" --with-abi=elfv2 --enable-secureplt --enable-targets=powerpc-linux";;
+		ppc*) _args+=" --enable-secureplt";;
+	esac
+
+	# on ppc64le-musl and all big endian ppc64
+	case "$XBPS_TARGET_MACHINE" in
+		ppc64le) ;;
+		ppc64*) _args+=" --disable-libquadmath" ;;
+	esac
+
+	# fix: unknown long double size, cannot define BFP_FMT
+	case "$XBPS_TARGET_MACHINE" in
+		ppc*-musl) _args+=" --disable-decimal-float";;
+	esac
+
+
+	if [ "$CROSS_BUILD" ]; then
+		export CC_FOR_TARGET="$CC"
+		export GCC_FOR_TARGET="$CC"
+		export CXX_FOR_TARGET="$CXX"
+
+		_args+=" --host=$XBPS_CROSS_TRIPLET"
+		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
+	else
+		_args+=" --build=${_triplet}"
+	fi
+
+	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
+		_args+=" --disable-gnu-unique-object"
+		_args+=" --disable-libsanitizer"
+		_args+=" --disable-symvers"
+		_args+=" libat_cv_have_ifunc=no"
+	else
+		_args+=" --enable-gnu-unique-object"
+	fi
+
+	case "$XBPS_TARGET_MACHINE" in
+		ppc*) _args+=" --disable-vtable-verify";;
+		*) _args+=" --enable-vtable-verify";;
+	esac
+
+	export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}"
+	export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}"
+
+	# Disable explicit -fno-PIE, gcc will figure this out itself.
+	export CFLAGS="${CFLAGS//-fno-PIE/}"
+	export CXXFLAGS="${CXXFLAGS//-fno-PIE/}"
+	export LDFLAGS="${LDFLAGS//-no-pie/}"
+
+	_args+=" --prefix=/usr"
+	_args+=" --program-suffix=-${_majorver}"
+	_args+=" --enable-version-specific-runtime-libs"
+	_args+=" --mandir=/usr/share/man"
+	_args+=" --infodir=/usr/share/info"
+	_args+=" --libexecdir=/usr/lib${XBPS_TARGET_WORDSIZE}"
+	_args+=" --libdir=/usr/lib${XBPS_TARGET_WORDSIZE}"
+	_args+=" --with-gxx-include-dir=/usr/include/c++/${version}"
+	_args+=" --enable-threads=posix"
+	_args+=" --enable-__cxa_atexit"
+	_args+=" --disable-multilib"
+	_args+=" --with-system-zlib"
+	_args+=" --enable-shared"
+	_args+=" --enable-lto"
+	_args+=" --enable-plugins"
+	_args+=" --enable-linker-build-id"
+	_args+=" --disable-werror"
+	_args+=" --disable-nls"
+	_args+=" --enable-default-pie"
+	_args+=" --enable-default-ssp"
+	_args+=" --enable-checking=release"
+	_args+=" --disable-libstdcxx-pch"
+	_args+=" --with-isl"
+	_args+=" --with-linker-hash-style=$_hash"
+	_args+=" --disable-sjlj-exceptions"
+	_args+=" --disable-target-libiberty"
+	_args+=" --disable-libssp"
+
+	mkdir -p build
+	cd build
+	_args+=" --enable-languages=c,c++,d,lto"
+	CONFIG_SHELL=/bin/bash \
+		${wrksrc}/configure ${_args}
+}
+
+do_build() {
+	make -C build ${makejobs}
+}
+
+do_install() {
+	local _f
+	vmkdir "usr/include/c++/${version}"
+	make -C build DESTDIR="${DESTDIR}" install
+
+	# Make version a symlink of major version to make all versions
+	# from the same series work automagically.
+	mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${version} \
+		${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}
+	ln -sf ${_minorver} ${DESTDIR}/usr/lib/gcc/${_triplet}/${version}
+
+	# Ditto for c++ headers.
+	mv ${DESTDIR}/usr/include/c++/${version} \
+		${DESTDIR}/usr/include/c++/${_minorver}
+	ln -sf ${_minorver} ${DESTDIR}/usr/include/c++/${version}
+
+	# Avoid conflict with gcc
+	mv ${DESTDIR}/usr/lib/libcc1* ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}
+
+	# Remove python stuff
+	rm -rf ${DESTDIR}/usr/share/gcc-${version}/python
+
+	# Conflicting manpages, provided by gcc
+	rm -rf ${DESTDIR}/usr/share/man/man7
+
+	# Version info files to avoid conflicts with gcc
+	for f in cpp cppinternals gcc gccinstall gccint gdc \
+		libgomp libitm libquadmath; do
+		if [ -f ${DESTDIR}/usr/share/info/${f}.info ]; then
+			mv ${DESTDIR}/usr/share/info/${f}.info \
+			   ${DESTDIR}/usr/share/info/${f}-${_majorver}.info
+		fi
+	done
+
+	# Provided by main libgcc
+	rm -f ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/libgcc_s.so* \
+		${DESTDIR}/usr/lib/gcc/${_triplet}/lib/libgcc_s.so* \
+		${DESTDIR}/usr/lib/gcc/${_triplet}/lib64/libgcc_s.so* \
+		${DESTDIR}/usr/lib/gcc/${_triplet}/lib32/libgcc_s.so*
+
+	# Move pkg-config file into a path pkg-config knows about
+	# mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}/pkgconfig \
+	#   ${DESTDIR}/usr/lib/
+}
+
+gcc11-gdc_package() {
+	lib32disabled=yes
+	repository=bootstrap
+	depends="${sourcepkg}>=${_minorver}"
+	short_desc+=" - D compiler frontend"
+	pkg_install() {
+		vmove "usr/bin/*gdc*"
+		vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/d"
+		vmove usr/lib/gcc/${_triplet}/${_minorver}/d21
+		vmove "usr/lib/gcc/${_triplet}/${_minorver}/libgphobos.*"
+		vmove "usr/lib/gcc/${_triplet}/${_minorver}/libgdruntime.*"
+		vmove "usr/share/info/gdc*"
+		vmove "usr/share/man/man1/gdc*"
+	}
+}

From 87f7b90d78f92070e435683b0fe1a6e122844cf4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 14 Mar 2023 14:12:54 +0700
Subject: [PATCH 2/8] gcc: add D frontend

---
 srcpkgs/gcc-gdc            |   1 +
 srcpkgs/gcc/template       | 110 +++++++++++++++++++++++++++++++------
 srcpkgs/libgdruntime       |   1 +
 srcpkgs/libgdruntime-devel |   1 +
 srcpkgs/libgphobos         |   1 +
 srcpkgs/libgphobos-devel   |   1 +
 6 files changed, 98 insertions(+), 17 deletions(-)
 create mode 120000 srcpkgs/gcc-gdc
 create mode 120000 srcpkgs/libgdruntime
 create mode 120000 srcpkgs/libgdruntime-devel
 create mode 120000 srcpkgs/libgphobos
 create mode 120000 srcpkgs/libgphobos-devel

diff --git a/srcpkgs/gcc-gdc b/srcpkgs/gcc-gdc
new file mode 120000
index 0000000000000..b08d5af5795c6
--- /dev/null
+++ b/srcpkgs/gcc-gdc
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/srcpkgs/gcc/template b/srcpkgs/gcc/template
index 34a3fa62d31b5..a818b0cdacf57 100644
--- a/srcpkgs/gcc/template
+++ b/srcpkgs/gcc/template
@@ -4,7 +4,7 @@
 
 pkgname=gcc
 version=12.2.0
-revision=3
+revision=4
 _minorver="${version%.*}"
 _majorver="${_minorver%.*}"
 _gmp_version=6.2.1
@@ -36,6 +36,7 @@ replaces="gcc-gcj<7.2.0 gcc-gcj-jdk-compat<7.2.0 libmpx>=0 libmpx-devel>=0
  libssp>=0 libssp-devel>=0"
 
 _have_gccgo=yes
+_have_gdc=yes
 
 # MIPS is untested and does not have go in crosstoolchains
 # 32-bit PowerPC seems weirdly broken since the 10.x release
@@ -49,6 +50,7 @@ if [ "$CHROOT_READY" ]; then
 	hostmakedepends="tar texinfo perl flex"
 else
 	_have_gccgo=no
+	_have_gdc=no
 	# libzstd fails to link in bootstrap with glibc 2.36
 	# when zlib has been compiled with glibc 2.32.
 	LDFLAGS="-lzstd -pthread"
@@ -95,6 +97,17 @@ if [ "$_have_gccgo" = "yes" ]; then
 	fi
 fi
 
+if [ "$_have_gdc" = yes ]; then
+	if [ "$CROSS_BUILD" ]; then
+		hostmakedepends+=" gcc-gdc"
+	else
+		hostmakedepends+=" gcc11-gdc"
+	fi
+	subpackages+=" gcc-gdc"
+	subpackages+=" libgdruntime-devel libgdruntime"
+	subpackages+=" libgphobos-devel libgphobos"
+fi
+
 subpackages+=" libstdc++-devel libstdc++ libgcc-devel"
 if [ "$build_option_gnatboot" -o "$build_option_ada" ]; then
 	subpackages+=" gcc-ada libada-devel libada"
@@ -180,7 +193,7 @@ post_extract() {
 	fi
 }
 
-pre_configure() {
+post_patch() {
 	# _FORTIFY_SOURCE needs an optimization level.
 	sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {gcc,libiberty}/configure
 
@@ -193,9 +206,9 @@ pre_configure() {
 		done
 	fi
 }
+
 do_configure() {
 	local _langs _args _hash
-
 	_hash=gnu
 	case "$XBPS_TARGET_MACHINE" in
 		mipselhf-musl) _args+=" --with-arch=mips32r2 --with-float=hard --enable-autolink-libatomic"; _hash=sysv;;
@@ -222,10 +235,6 @@ do_configure() {
 		ppc*-musl) _args+=" --disable-decimal-float";;
 	esac
 
-	if [ -z "$CHROOT_READY" -o -n "$CROSS_BUILD" ]; then
-		_langs="c,c++,lto"
-	fi
-
 	if [ "$CROSS_BUILD" ]; then
 		export CC_FOR_TARGET="$CC"
 		export GCC_FOR_TARGET="$CC"
@@ -235,10 +244,11 @@ do_configure() {
 
 		_args+=" --host=$XBPS_CROSS_TRIPLET"
 		_args+=" --with-build-sysroot=${XBPS_CROSS_BASE}"
-		_langs+=",objc,obj-c++,fortran"
+		_langs="c,c++,lto,objc,obj-c++,fortran"
 	elif [ -z "$CHROOT_READY" ]; then
 		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
 		_args+=" --build=${_triplet}"
+		_langs="c,c++,lto"
 	else
 		_langs="c,c++,objc,obj-c++,fortran,lto"
 		_args+=" --build=${_triplet}"
@@ -248,6 +258,26 @@ do_configure() {
 		_langs+=",go"
 	fi
 
+	if [ "$_have_gdc" = yes ]; then
+		_langs+=",d"
+		mkdir -p ${wrksrc}/gdc-bt
+		PATH="$PATH:${wrksrc}/gdc-bt"
+		ln -fs /usr/bin/gdc-11 ${wrksrc}/gdc-bt/gdc
+		case "$XBPS_TARGET_MACHINE" in
+		x86_64)
+			ln -fs /usr/bin/x86_64-linux-gnu-gdc-11 \
+				${wrksrc}/gdc-bt/${_triplet}-gdc
+			;;
+		*)
+			ln -fs /usr/bin/${_triplet}-gdc-11 \
+				${wrksrc}/gdc-bt/${_triplet}-gdc
+			;;
+		esac
+		export GDC=gdc
+		export GDC_FOR_TARGET="${_triplet}-gdc"
+
+	fi
+
 	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
 		_args+=" --disable-gnu-unique-object"
 		_args+=" --disable-libsanitizer"
@@ -320,29 +350,27 @@ do_build() {
 	if [ -z "$CHROOT_READY" ]; then
 		export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
 	fi
-	cd build
+	if [ "$_have_gdc" = yes ]; then
+		PATH="$PATH:${wrksrc}/gdc-bt"
+	fi
 	if [ "$build_option_gnatboot" ]; then
 		CC="${wrksrc}/gnat/bin/gcc" \
 		GNATBIND="${wrksrc}/gnat/bin/gnatbind" \
 		GNATMAKE="${wrksrc}/gnat/bin/gnatmake" \
 		PATH="${wrksrc}/gnat/bin:$PATH" \
-		make ${makejobs}
+		make -C build ${makejobs}
 	else
-		make ${makejobs}
+		make -C build ${makejobs}
 	fi
 }
-pre_install() {
+do_install() {
 	if [ "$CROSS_BUILD" ]; then
 		# XXX otherwise links to host libpthread
 		for f in $(find ${wrksrc}/build/${XBPS_CROSS_TRIPLET} -type f -name libtool); do
 			sed -e "s,add_dir=\"-L\$libdir\",add_dir=\"-L${XBPS_CROSS_BASE}\$libdir\",g" -i $f
 		done
 	fi
-}
-do_install() {
-	cd build
-
-	make DESTDIR=${DESTDIR} install
+	make -C build DESTDIR=${DESTDIR} install
 
 	# Make version a symlink of major version to make all versions
 	# from the same series work automagically.
@@ -402,6 +430,19 @@ gcc-ada_package() {
 	}
 }
 
+gcc-gdc_package() {
+	lib32disabled=yes
+	depends="${sourcepkg}>=${_minorver}
+	 libgdruntime-devel>=${_minorver} libgphobos-devel>=${_minorver}"
+	short_desc+=" - D compiler frontend"
+	pkg_install() {
+		vmove "usr/bin/*gdc*"
+		vmove usr/lib/gcc/${_triplet}/${_minorver}/d21
+		vmove "usr/share/info/gdc*"
+		vmove "usr/share/man/man1/gdc*"
+	}
+}
+
 gcc-go_package() {
 	lib32disabled=yes
 	depends="gcc>=${_minorver} libgo-devel>=${_minorver}"
@@ -499,6 +540,41 @@ libada_package() {
 	}
 }
 
+libgdruntime-devel_package() {
+	depends="libgdruntime>=${_minorver}"
+	short_desc+=" - D library - development files"
+	pkg_install() {
+		vmove "usr/lib/gcc/${_triplet}/${_minorver}/include/d"
+		vmove "usr/lib/libgdruntime.a"
+		vmove "usr/lib/libgdruntime.la"
+		vmove "usr/lib/libgdruntime.so"
+	}
+}
+
+libgdruntime_package() {
+	short_desc+=" - D library"
+	pkg_install() {
+		vmove "usr/lib/libgdruntime*.so.*"
+	}
+}
+
+libgphobos-devel_package() {
+	depends="libgphobos>=${_minorver}"
+	short_desc+=" - GNU Phobos library - development files"
+	pkg_install() {
+		vmove usr/lib/libgphobos.spec
+		vmove usr/lib/libgphobos.a
+		vmove usr/lib/libgphobos.so
+	}
+}
+
+libgphobos_package() {
+	short_desc+=" - GNU Phobos library"
+	pkg_install() {
+		vmove "usr/lib/libgphobos.so.*"
+	}
+}
+
 libgfortran-devel_package() {
 	depends="libgfortran>=${_minorver}"
 	short_desc+=" - Fortran library - development files"
diff --git a/srcpkgs/libgdruntime b/srcpkgs/libgdruntime
new file mode 120000
index 0000000000000..b08d5af5795c6
--- /dev/null
+++ b/srcpkgs/libgdruntime
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/srcpkgs/libgdruntime-devel b/srcpkgs/libgdruntime-devel
new file mode 120000
index 0000000000000..b08d5af5795c6
--- /dev/null
+++ b/srcpkgs/libgdruntime-devel
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/srcpkgs/libgphobos b/srcpkgs/libgphobos
new file mode 120000
index 0000000000000..b08d5af5795c6
--- /dev/null
+++ b/srcpkgs/libgphobos
@@ -0,0 +1 @@
+gcc
\ No newline at end of file
diff --git a/srcpkgs/libgphobos-devel b/srcpkgs/libgphobos-devel
new file mode 120000
index 0000000000000..b08d5af5795c6
--- /dev/null
+++ b/srcpkgs/libgphobos-devel
@@ -0,0 +1 @@
+gcc
\ No newline at end of file

From a39e90220af5179c536177716ae30d95521fe106 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 14 Mar 2023 16:03:36 +0700
Subject: [PATCH 3/8] New package: gdmd-0.1.0

---
 srcpkgs/gdmd/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/gdmd/template

diff --git a/srcpkgs/gdmd/template b/srcpkgs/gdmd/template
new file mode 100644
index 0000000000000..af8e1a3cc007d
--- /dev/null
+++ b/srcpkgs/gdmd/template
@@ -0,0 +1,17 @@
+# Template file for 'gdmd'
+pkgname=gdmd
+version=0.1.0
+revision=1
+depends="perl gcc-gdc"
+short_desc="DMD-like CLI interface for gdc"
+maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/D-Programming-GDC/gdmd"
+distfiles="https://github.com/D-Programming-GDC/gdmd/archive/script-$version.tar.gz"
+distfiles="https://github.com/D-Programming-GDC/gdmd/archive/refs/tags/script-${version}.tar.gz"
+checksum=6c9891b7f2e41d8b6c0e89fab3ad32fb77bb3617760b33a4c23bca49197a026b
+
+do_install() {
+	vbin dmd-script gdmd
+	vman dmd-script.1 gdmd.1
+}

From 3148e56606909d6199d1b9d657265b240aef3d30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 14 Mar 2023 21:23:40 +0700
Subject: [PATCH 4/8] ldc: update to 1.34.0.

---
 common/shlibs                            |   7 +-
 srcpkgs/ldc-runtime-debug                |   1 +
 srcpkgs/ldc-runtime-devel                |   1 +
 srcpkgs/ldc/patches/target-runtime.patch |  23 ++++
 srcpkgs/ldc/template                     | 145 +++++++++++++++++++++--
 5 files changed, 165 insertions(+), 12 deletions(-)
 create mode 120000 srcpkgs/ldc-runtime-debug
 create mode 120000 srcpkgs/ldc-runtime-devel
 create mode 100644 srcpkgs/ldc/patches/target-runtime.patch

diff --git a/common/shlibs b/common/shlibs
index 531b3345e230f..403d6dd4d27df 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -2180,9 +2180,10 @@ libFcitx5GClient.so.2 fcitx5-gtk-5.0.4_1
 libFcitx5Qt5DBusAddons.so.1 fcitx5-qt5-5.0.3_1
 libFcitx5Qt5WidgetsAddons.so.2 fcitx5-qt5-5.0.3_1
 libdruntime-ldc-debug-shared.so.101 ldc-runtime-1.31.0_1
-libdruntime-ldc-shared.so.101 ldc-runtime-1.31.0_1
-libphobos2-ldc-shared.so.101 ldc-runtime-1.31.0_1
-libphobos2-ldc-debug-shared.so.101 ldc-runtime-1.31.0_1
+libdruntime-ldc-shared.so.104 ldc-runtime-1.34.0_1
+libphobos2-ldc-shared.so.104 ldc-runtime-1.34.0_1
+libdruntime-ldc-debug-shared.so.104 ldc-runtime-debug-1.34.0_1
+libphobos2-ldc-debug-shared.so.104 ldc-runtime-debug-1.34.0_1
 libmarblewidget-qt5.so.28 marble5-17.12.2_1
 libastro.so.2 marble5-17.12.2_1
 libparrot.so.6.9.0 parrot-6.9.0_1
diff --git a/srcpkgs/ldc-runtime-debug b/srcpkgs/ldc-runtime-debug
new file mode 120000
index 0000000000000..12f0b1bf64f06
--- /dev/null
+++ b/srcpkgs/ldc-runtime-debug
@@ -0,0 +1 @@
+ldc
\ No newline at end of file
diff --git a/srcpkgs/ldc-runtime-devel b/srcpkgs/ldc-runtime-devel
new file mode 120000
index 0000000000000..12f0b1bf64f06
--- /dev/null
+++ b/srcpkgs/ldc-runtime-devel
@@ -0,0 +1 @@
+ldc
\ No newline at end of file
diff --git a/srcpkgs/ldc/patches/target-runtime.patch b/srcpkgs/ldc/patches/target-runtime.patch
new file mode 100644
index 0000000000000..321be796f62b9
--- /dev/null
+++ b/srcpkgs/ldc/patches/target-runtime.patch
@@ -0,0 +1,23 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -863,7 +863,7 @@ add_test(NAME build-ldc2-unittest COMMAN
+ add_test(NAME ldc2-unittest COMMAND ${LDC_UNITTEST_EXE_FULL} --version)
+ set_tests_properties(ldc2-unittest PROPERTIES DEPENDS build-ldc2-unittest)
+ 
+-if(EXISTS "${PROJECT_SOURCE_DIR}/runtime/druntime/src/object.d")
++if(BUILD_LDC_RUNTIME AND EXISTS "${PROJECT_SOURCE_DIR}/runtime/druntime/src/object.d")
+     add_subdirectory(runtime)
+ else()
+     message(STATUS "Runtime file runtime/druntime/src/object.d not found, will build ldc binaries but not the standard library.")
+--- a/runtime/CMakeLists.txt
++++ b/runtime/CMakeLists.txt
+@@ -7,6 +7,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PAT
+ include(CheckIncludeFile)
+ 
+ # Verify required variables if this CMake project is NOT embedded in the LDC CMake project.
++if(DEFINED XLDC_EXE_FULL)
++   set(LDC_EXE_FULL "${XLDC_EXE_FULL}")
++endif()
+ if(NOT LDC_EXE)
+     if(NOT LDC_EXE_FULL)
+         message(FATAL_ERROR "Please define the path to the LDC executable via -DLDC_EXE_FULL=...")
diff --git a/srcpkgs/ldc/template b/srcpkgs/ldc/template
index f6d8b7ffbe985..3f49038a4e643 100644
--- a/srcpkgs/ldc/template
+++ b/srcpkgs/ldc/template
@@ -1,6 +1,6 @@
 # Template file for 'ldc'
 pkgname=ldc
-version=1.31.0
+version=1.34.0
 revision=1
 build_style=cmake
 configure_args="
@@ -11,10 +11,10 @@ configure_args="
  -DCOMPILE_D_MODULES_SEPARATELY=ON
  -DC_SYSTEM_LIBS='unwind;m;pthread;rt;dl'"
 conf_files="/etc/ldc2.conf"
-hostmakedepends="dmd llvm15 perl pkg-config"
+hostmakedepends="gdmd llvm perl pkg-config"
 makedepends="libcurl-devel libffi-devel ncurses-devel zlib-devel
- llvm-libunwind-devel"
-depends="ldc-runtime llvm-libunwind-devel"
+ llvm-libunwind-devel llvm"
+depends="ldc-runtime-devel llvm-libunwind-devel"
 checkdepends="python3"
 short_desc="Portable D programming language compiler based on LLVM"
 maintainer="Auri <me@aurieh.me>"
@@ -22,19 +22,146 @@ license="BSD-3-Clause, BSL-1.0"
 homepage="https://wiki.dlang.org/LDC"
 changelog="https://raw.githubusercontent.com/ldc-developers/ldc/master/CHANGELOG.md"
 distfiles="https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc-${version}-src.tar.gz"
-checksum=f1c8ece9e1e35806c3441bf24fbe666cddd8eef375592c19cd8fee4701cd5458
+checksum=3005c6e9c79258538c83979766767a59e3d74f3cb90ac2cb0dce5d7573beb719
 nopie=yes
-nocross="dmd compilation fails on cross"
 # tests timeout on musl; also require unpackaged python3-lit
 make_check=no
+subpackages="ldc-runtime-debug ldc-runtime ldc-runtime-devel"
 
-post_install() {
-	vlicense LICENSE
+case "$XBPS_TARGET_MACHINE" in
+	i686) _triplet="i686-pc-linux-gnu";;
+	i686-musl) _triplet="i686-linux-musl";;
+	x86_64) _triplet="x86_64-linux-gnu";;
+	x86_64-musl) _triplet="x86_64-linux-musl";;
+	armv5tel) _triplet="arm-linux-gnueabi";;
+	armv5tel-musl) _triplet="arm-linux-musleabi";;
+	armv6l) _triplet="arm-linux-gnueabihf";;
+	armv7l) _triplet="armv7l-linux-gnueabihf";;
+	armv6l-musl) _triplet="arm-linux-musleabihf";;
+	armv7l-musl) _triplet="armv7l-linux-musleabihf";;
+	aarch64) _triplet="aarch64-linux-gnu";;
+	aarch64-musl) _triplet="aarch64-linux-musl";;
+	ppc) _triplet="powerpc-linux-gnu";;
+	ppc-musl) _triplet="powerpc-linux-musl";;
+	ppcle) _triplet="powerpcle-linux-gnu";;
+	ppcle-musl) _triplet="powerpcle-linux-musl";;
+	ppc64le) _triplet="powerpc64le-linux-gnu";;
+	ppc64le-musl) _triplet="powerpc64le-linux-musl";;
+	ppc64) _triplet="powerpc64-linux-gnu";;
+	ppc64-musl) _triplet="powerpc64-linux-musl";;
+	mips-musl) _triplet="mips-linux-musl";;
+	mipshf-musl) _triplet="mips-linux-muslhf";;
+	mipsel-musl) _triplet="mipsel-linux-musl";;
+	mipselhf-musl) _triplet="mipsel-linux-muslhf";;
+esac
+export DFLAGS="-mtriple=${_triplet}"
+
+pre_configure() {
+	local _ldc _major _minor _pver
+
+	unset DFLAGS
+	# First build ldc by gdc
+	mkdir -p build-stage1
+	CC=$CC_FOR_BUILD CFLAGS="$CFLAGS_FOR_BUILD" \
+	CXX=$CXX_FOR_BUILD CXXFLAGS="$CXXFLAGS_FOR_BUILD" \
+	LD=$LD_FOR_BUILD LDFLAGS="$LDFLAGS_FOR_BUILD" \
+	cmake -GNinja -DD_COMPILER=gdmd \
+		-DBUILD_LDC_RUNTIME=OFF \
+		-S $PWD -B $PWD/build-stage1
+	ninja -C build-stage1
+
+	# Then build ldc-runtime for stage1 ldc
+	cat <<-EOF >"${XBPS_WRAPPERDIR}/ldmd2"
+	#!/bin/sh
+	exec "$wrksrc/build-stage1/bin/ldmd2" -mtriple="$_triplet" "\$@"
+	EOF
+	cat <<-EOF >"${XBPS_WRAPPERDIR}/ldc2"
+	#!/bin/sh
+	exec "$wrksrc/build-stage1/bin/ldc2" -mtriple="$_triplet" "\$@"
+	EOF
+	_ldmd="${XBPS_WRAPPERDIR}/ldmd2"
+	_ldc="${XBPS_WRAPPERDIR}/ldc2"
+	chmod +x "${_ldmd}"
+	chmod +x "${_ldc}"
+
+	export DFLAGS=-mtriple=${_triplet}
+	_major=$(sed -nE 's/set\(DMDFE_MAJOR_VERSION[[:space:]]*([0-9]*)\)/\1/p' CMakeLists.txt)
+	_minor=$(sed -nE 's/set\(DMDFE_MINOR_VERSION[[:space:]]*([0-9]*)\)/\1/p' CMakeLists.txt)
+	_pver=$(sed -nE 's/set\(DMDFE_PATCH_VERSION[[:space:]]*([0-9]*)\)/\1/p' CMakeLists.txt)
+	mkdir -p build-stage2
+	CFLAGS="-DNDEBUG ${CFLAGS/ -pipe / }" \
+	CXXFLAGS="-DNDEBUG ${CXXFLAGS/ -pipe / }" \
+	cmake -GNinja \
+		-DD_COMPILER="$_ldmd" -DLDC_EXE_FULL="$_ldc" \
+		-DDMDFE_MAJOR_VERSION=$_major \
+		-DDMDFE_MINOR_VERSION=$_minor \
+		-DDMDFE_PATCH_VERSION=$_pver \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
+		-DCMAKE_INSTALL_LIBDIR="lib${XBPS_TARGET_WORDSIZE}" \
+		-DLIB_SUFFIX="${XBPS_TARGET_WORDSIZE}" \
+		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
+		-S $PWD/runtime -B $PWD/build-stage2
+	ninja -C build-stage2
+
+	cat <<-EOF >build-stage1/bin/ldc2.conf
+	default:
+	{
+	    switches = [
+		"-defaultlib=phobos2-ldc,druntime-ldc",
+	    ];
+	    post-switches = [
+		"-I$PWD/runtime/druntime/src",
+		"-I$PWD/build-stage2/runtime/import",
+		"-I$PWD/runtime/jit-rt/d",
+		"-I$PWD/runtime/phobos",
+	    ];
+	    lib-dirs = [
+		"$PWD/build-stage2/lib${XBPS_TARGET_WORDSIZE}",
+	    ];
+	    rpath = "";
+	};
+
+	"^wasm(32|64)-":
+	{
+	    switches = [
+		"-defaultlib=",
+		"-L-z", "-Lstack-size=1048576",
+		"-L--stack-first",
+		"-L--export-dynamic",
+	    ];
+	    lib-dirs = [];
+	};
+	EOF
+
+	configure_args+=" -DD_COMPILER=${_ldmd}"
+	configure_args+=" -DXLDC_EXE_FULL=${_ldc}"
+	configure_args+=" -DBUILD_LDC_RUNTIME=ON"
+	configure_args+=" -DLIB_SUFFIX=${XBPS_TARGET_WORDSIZE}"
 }
 
 ldc-runtime_package() {
 	short_desc+=" - D runtime"
 	pkg_install() {
-		vmove "usr/lib/*.so*"
+		vlicense LICENSE
+		vmove "usr/lib/*.so.*"
+	}
+}
+
+ldc-runtime-debug_package() {
+	short_desc+=" - D runtime - debug version"
+	pkg_install() {
+		vlicense LICENSE
+		vmove "usr/lib/*-debug-*.so.*"
+	}
+}
+
+ldc-runtime-devel_package() {
+	short_desc+=" - D runtime - development files"
+	depends="ldc-runtime ldc-runtime-debug llvm-libunwind-devel"
+	pkg_install() {
+		vmove usr/include
+		vmove "usr/lib/*.o"
+		vmove "usr/lib/*.so"
 	}
 }

From f8cc99f75f272d0c874d52d5595a5844dbdd0e72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Fri, 8 Sep 2023 20:04:47 +0700
Subject: [PATCH 5/8] btdu: rebuild for ldc 1.34.0

---
 srcpkgs/btdu/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/btdu/template b/srcpkgs/btdu/template
index a42917b4f665b..eb2a33360b3f6 100644
--- a/srcpkgs/btdu/template
+++ b/srcpkgs/btdu/template
@@ -1,7 +1,7 @@
 # Template file for 'btdu'
 pkgname=btdu
 version=0.5.1
-revision=1
+revision=2
 hostmakedepends="ldc dub"
 makedepends="zlib-devel ncurses-devel"
 short_desc="Sampling disk usage profiler for btrfs"

From 37c85167d49ab0ba48f501a2a3b2acb367e548b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Fri, 8 Sep 2023 20:04:51 +0700
Subject: [PATCH 6/8] gtkd: rebuild for ldc 1.34.0

---
 srcpkgs/gtkd/patches/cross.patch      | 11 ++++
 srcpkgs/gtkd/patches/pkg-config.patch | 89 +++++++++++++++++++++++++++
 srcpkgs/gtkd/template                 | 17 ++---
 3 files changed, 110 insertions(+), 7 deletions(-)
 create mode 100644 srcpkgs/gtkd/patches/cross.patch
 create mode 100644 srcpkgs/gtkd/patches/pkg-config.patch

diff --git a/srcpkgs/gtkd/patches/cross.patch b/srcpkgs/gtkd/patches/cross.patch
new file mode 100644
index 0000000000000..d56f5efe8d222
--- /dev/null
+++ b/srcpkgs/gtkd/patches/cross.patch
@@ -0,0 +1,11 @@
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -38,7 +38,7 @@ ifeq ("$(DC)","gdc")
+     DDOCINC=-fdoc-inc=
+     output=-o $@
+ else
+-    DCFLAGS=-O
++    DCFLAGS+=-O
+     LINKERFLAG=-L
+     DDOCFLAGS=-o- -Df$@
+     output=-of$@
diff --git a/srcpkgs/gtkd/patches/pkg-config.patch b/srcpkgs/gtkd/patches/pkg-config.patch
new file mode 100644
index 0000000000000..e3f5fccc65c6c
--- /dev/null
+++ b/srcpkgs/gtkd/patches/pkg-config.patch
@@ -0,0 +1,89 @@
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -368,33 +368,33 @@ install-shared-peas: $(SONAME_PEASD) ins
+ 
+ install-headers-gtkd: gtkd-$(MAJOR).pc
+ 	install -d $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)
+-	install -d $(DESTDIR)$(libdir)/pkgconfig
++	install -d $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 	(cd generated/gtkd;   echo $(SOURCES_GTKD)   | sed -e s,generated/gtkd/,,g   | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
+-	install -m 644 gtkd-$(MAJOR).pc $(DESTDIR)$(libdir)/pkgconfig
++	install -m 644 gtkd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 
+ install-headers-gtkdgl: gtkdgl-$(MAJOR).pc install-headers-gtkd
+ 	(cd generated/gtkdgl; echo $(SOURCES_GTKDGL) | sed -e s,generated/gtkdgl/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
+-	install -m 644 gtkdgl-$(MAJOR).pc $(DESTDIR)$(libdir)/pkgconfig
++	install -m 644 gtkdgl-$(MAJOR).pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 
+ install-headers-gtkdsv: gtkdsv-$(MAJOR).pc install-headers-gtkd
+ 	(cd generated/sourceview; echo $(SOURCES_GTKDSV) | sed -e s,generated/sourceview/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
+-	install -m 644 gtkdsv-$(MAJOR).pc $(DESTDIR)$(libdir)/pkgconfig
++	install -m 644 gtkdsv-$(MAJOR).pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 
+ install-headers-gstreamer: gstreamerd-$(MAJOR).pc install-headers-gtkd
+ 	(cd generated/gstreamer; echo $(SOURCES_GSTREAMERD) | sed -e s,generated/gstreamer/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
+-	install -m 644 gstreamerd-$(MAJOR).pc $(DESTDIR)$(libdir)/pkgconfig
++	install -m 644 gstreamerd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 
+ install-headers-vte: vted-$(MAJOR).pc install-headers-gtkd
+ 	(cd generated/vte; echo $(SOURCES_VTED) | sed -e s,generated/vte/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
+-	install -m 644 vted-$(MAJOR).pc $(DESTDIR)$(libdir)/pkgconfig
++	install -m 644 vted-$(MAJOR).pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 
+ install-headers-peas: peasd-$(MAJOR).pc install-headers-gtkd
+ 	(cd generated/peas; echo $(SOURCES_PEASD) | sed -e s,generated/peas/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
+-	install -m 644 peasd-$(MAJOR).pc $(DESTDIR)$(libdir)/pkgconfig
++	install -m 644 peasd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(libdir)/pkgconfig
+ 
+ uninstall: uninstall-gtkdgl uninstall-gtkdsv uninstall-gstreamer uninstall-vte uninstall-peas
+ 	$(foreach dir,$(shell ls generated/gtkd)  , rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
+-	rm -f $(DESTDIR)$(libdir)/pkgconfig/gtkd-$(MAJOR).pc
++	rm -f $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/gtkd-$(MAJOR).pc
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKD)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD).$(SO_VERSION)
+@@ -402,7 +402,7 @@ uninstall: uninstall-gtkdgl uninstall-gt
+ 
+ uninstall-gtkdgl:
+ 	$(foreach dir,$(shell ls generated/gtkdgl), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
+-	rm -f $(DESTDIR)$(libdir)/pkgconfig/gtkdgl-$(MAJOR).pc
++	rm -f $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/gtkdgl-$(MAJOR).pc
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKDGL)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL).$(SO_VERSION)
+@@ -410,7 +410,7 @@ uninstall-gtkdgl:
+ 
+ uninstall-gtkdsv:
+ 	$(foreach dir,$(shell ls generated/sourceview), rm -rf $(DESTDIR)$(prefix)/include/d/$(dir))
+-	rm -f $(DESTDIR)$(libdir)/pkgconfig/gtkdsv-$(MAJOR).pc
++	rm -f $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/gtkdsv-$(MAJOR).pc
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKDSV)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV).$(SO_VERSION)
+@@ -418,7 +418,7 @@ uninstall-gtkdsv:
+ 
+ uninstall-gstreamer:
+ 	$(foreach dir,$(shell ls generated/gstreamer), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
+-	rm -f $(DESTDIR)$(libdir)/pkgconfig/gstreamerd-$(MAJOR).pc
++	rm -f $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/gstreamerd-$(MAJOR).pc
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GSTREAMERD)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD).$(SO_VERSION)
+@@ -426,7 +426,7 @@ uninstall-gstreamer:
+ 
+ uninstall-vte:
+ 	$(foreach dir,$(shell ls generated/vte), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
+-	rm -f $(DESTDIR)$(libdir)/pkgconfig/vted-$(MAJOR).pc
++	rm -f $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/vted-$(MAJOR).pc
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_VTED)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_VTED)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_VTED).$(SO_VERSION)
+@@ -434,7 +434,7 @@ uninstall-vte:
+ 
+ uninstall-peas:
+ 	$(foreach dir,$(shell ls generated/peas), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
+-	rm -f $(DESTDIR)$(libdir)/pkgconfig/peasd-$(MAJOR).pc
++	rm -f $(DESTDIR)$(prefix)/$(libdir)/pkgconfig/peasd-$(MAJOR).pc
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_PEASD)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_PEASD)
+ 	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_PEASD).$(SO_VERSION)
diff --git a/srcpkgs/gtkd/template b/srcpkgs/gtkd/template
index 6a75d69e19cec..0db1f9baa5fe3 100644
--- a/srcpkgs/gtkd/template
+++ b/srcpkgs/gtkd/template
@@ -1,9 +1,9 @@
 # Template file for 'gtkd'
 pkgname=gtkd
 version=3.9.0
-revision=10
+revision=11
 build_style=gnu-makefile
-make_build_args="LDFLAGS='-linker=bfd' DC=ldc2"
+make_build_args="DC=ldc2"
 make_build_target="shared-libs shared-gstreamer shared-vte shared-peas shared-gtkdgl"
 make_check_args="$make_build_args"
 make_install_target="install-shared-gstreamer install-headers-gstreamer
@@ -12,7 +12,7 @@ make_install_target="install-shared-gstreamer install-headers-gstreamer
  install-headers-vte"
 hostmakedepends="ldc pkg-config tar which"
 makedepends="gstreamer1-devel gtksourceview-devel libpeas-devel librsvg-devel
- vte3-devel"
+ vte3-devel ldc-runtime-devel"
 short_desc="D bindings for GTK+3 and related libraries"
 maintainer="Enno Boland <gottox@voidlinux.org>"
 license="LGPL-3.0-or-later"
@@ -20,11 +20,14 @@ homepage="https://gtkd.org"
 #changelog="https://gtkd.org/changelog.html"
 distfiles="https://github.com/gtkd-developers/GtkD/archive/v${version}.tar.gz"
 checksum=02a5d84b120e66011d6595f92679780f5782e8fe733c5517de1629c397a0d7d9
-nocross="Uses host flags for cross compilations"
+# nocross="Uses host flags for cross compilations"
 
-do_patch() {
-	# Makefile wants to install pkgconfig in /lib by default
-	vsed -e 's@$(DESTDIR)$(libdir)@$(DESTDIR)$(prefix)/$(libdir)@g' -i GNUmakefile
+if [ "$CROSS_BUILD" ]; then
+	export DCFLAGS="-mtriple=$XBPS_CROSS_TRIPLET"
+fi
+
+pre_build() {
+	LDFLAGS="-linker=bfd ${DCFLAGS}"
 }
 
 libpeasd_package() {

From 79635760c1eabd05edb46b1df0561ff23924728a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Fri, 8 Sep 2023 20:04:56 +0700
Subject: [PATCH 7/8] onedrive: rebuild for ldc 1.34.0

---
 srcpkgs/onedrive/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/onedrive/template b/srcpkgs/onedrive/template
index e15249cbd7e3c..d250493c1596a 100644
--- a/srcpkgs/onedrive/template
+++ b/srcpkgs/onedrive/template
@@ -1,7 +1,7 @@
 # Template file for 'onedrive'
 pkgname=onedrive
 version=2.4.23
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="DC=ldc2"
 hostmakedepends="ldc pkg-config"

From ef2360a3f7644e4da7e904e17696a5d3af0bf1de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Fri, 8 Sep 2023 20:04:59 +0700
Subject: [PATCH 8/8] tilix: rebuild for ldc 1.34.0

---
 srcpkgs/tilix/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/tilix/template b/srcpkgs/tilix/template
index 74ccb4dd4592d..77da7f7940caf 100644
--- a/srcpkgs/tilix/template
+++ b/srcpkgs/tilix/template
@@ -1,7 +1,7 @@
 # Template file for 'tilix'
 pkgname=tilix
 version=1.9.4
-revision=7
+revision=8
 _undead_version=1.1.8
 build_wrksrc="${pkgname}-${version}"
 build_style=meson

             reply	other threads:[~2023-09-08 14:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 14:44 sgn [this message]
2023-09-09  3:56 ` [PR PATCH] [Updated] " sgn
2023-10-23  7:53 ` sgn
2023-10-23 23:43 ` sgn
2023-10-23 23:43 ` sgn
2023-10-25 15:57 ` [PR PATCH] [Updated] " sgn
2023-10-25 16:42 ` sgn
2023-10-26  4:44 ` sgn
2023-10-26 10:45 ` sgn
2023-10-26 16:25 ` sgn
2023-10-26 17:01 ` sgn
2024-01-25  1:48 ` github-actions
2024-01-26  6:52 ` jtbx
2024-04-26  1:45 ` github-actions
2024-05-10  1:47 ` [PR PATCH] [Closed]: " github-actions

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-45973@inbox.vuxu.org \
    --to=sgn@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).