Subject: [PATCH 2/3] gnu: cross-gcc: Add patch for GCC 13.

From: Jean-Pierre De Jesus DIAZ <[email-masked]>
Date: Fri, 12 Apr 2024 12:53:01 +0200

* gnu/local.mk (dist_patch_DATA): Add gcc-13-cross-system-header-dir.patch.
* gnu/packages/cross-base.scm (cross-gcc) <source>: Add patch for
GCC 13.
* gnu/packages/patches/gcc-13-cross-system-header-dir.patch: New patch.

Change-Id: Ib4771ff78222fb7b7df58891d25938d338bd5df8
---
 gnu/local.mk                                  |  1 +
 gnu/packages/cross-base.scm                   |  4 +++
 .../gcc-13-cross-system-header-dir.patch      | 32 +++++++++++++++++++
 3 files changed, 37 insertions(+)
 create mode 100644 gnu/packages/patches/gcc-13-cross-system-header-dir.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 1169604891..bdaa57a40e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1297,6 +1297,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gcc-12-cross-environment-variables.patch \
   %D%/packages/patches/gcc-10-tree-sra-union-handling.patch	\
   %D%/packages/patches/gcc-11-libstdc++-powerpc.patch           \
+  %D%/packages/patches/gcc-13-cross-system-header-dir.patch     \
   %D%/packages/patches/gcolor3-update-libportal-usage.patch	\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-brect-bounds.patch			\
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index e62402a09e..36307698a8 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -321,6 +321,10 @@ (define* (cross-gcc target
         (append
          (origin-patches (package-source xgcc))
          (append (cond
+                  ((version>=? (package-version xgcc) "13.0")
+                   (search-patches "gcc-13-cross-system-header-dir.patch"
+                                   "gcc-12-cross-environment-variables.patch"
+                                   "gcc-cross-gxx-include-dir.patch"))
                   ((version>=? (package-version xgcc) "12.0")
                    (search-patches "gcc-12-cross-environment-variables.patch"
                                    "gcc-cross-gxx-include-dir.patch"))
diff --git a/gnu/packages/patches/gcc-13-cross-system-header-dir.patch b/gnu/packages/patches/gcc-13-cross-system-header-dir.patch
new file mode 100644
index 0000000000..75f80ea9d2
--- /dev/null
+++ b/gnu/packages/patches/gcc-13-cross-system-header-dir.patch
@@ -0,0 +1,32 @@
+From 8b001f38cc713190642194b55e02a56346f51494 Mon Sep 17 00:00:00 2001
+From: Jean-Pierre De Jesus DIAZ <[email-masked]>
+Date: Fri, 12 Apr 2024 12:18:24 +0200
+Subject: [PATCH] Fix CROSS_SYSTEM_HEADER_DIR value for Guix.
+
+* gcc/Makefile.in (CROSS_SYSTEM_HEADER_DIR): Always use default value.
+---
+ gcc/Makefile.in | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 775aaa1b3c4..06d192fa9ed 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -532,11 +532,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
+ # Default native SYSTEM_HEADER_DIR, to be overridden by targets.
+ NATIVE_SYSTEM_HEADER_DIR = @NATIVE_SYSTEM_HEADER_DIR@
+ # Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
+-ifeq (@includedir@,$(prefix)/include)
+-  CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+-else
+-  CROSS_SYSTEM_HEADER_DIR = @includedir@
+-endif
++CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
+ 
+ # autoconf sets SYSTEM_HEADER_DIR to one of the above.
+ # Purge it of unnecessary internal relative paths
+
+base-commit: c891d8dc23e1a46ad9f3e757d09e57b500d40044
+-- 
+2.41.0
+
-- 
2.41.0