commit:     bf8c6e96498309932dbdc975462ef93eb0c1c347
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 10 18:59:51 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Mar 10 18:59:51 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=bf8c6e96

sys-devel/gcc-13.2.0: fix bootstrap using CLT 15.3 on macOS

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 .../gcc/files/gcc-13-darwin14-bootstrap.patch      | 40 ++++++++++++++++++++++
 sys-devel/gcc/gcc-13.2.0.ebuild                    |  4 +++
 2 files changed, 44 insertions(+)

diff --git a/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch 
b/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch
new file mode 100644
index 0000000000..98a92c103e
--- /dev/null
+++ b/sys-devel/gcc/files/gcc-13-darwin14-bootstrap.patch
@@ -0,0 +1,40 @@
+disable some code-sanity checks/hacks because while bootstapping we use
+a compiler and its c++ library that does not necessarily comply
+
+This is an issue since macOS Sonoma 14.4 and/or CLT 15.3.
+
+--- a/include/safe-ctype.h
++++ b/include/safe-ctype.h
+@@ -120,6 +120,7 @@
+    So we include ctype.h here and then immediately redefine its macros.  */
+ 
+ #include <ctype.h>
++#if 0
+ #undef isalpha
+ #define isalpha(c) do_not_use_isalpha_with_safe_ctype
+ #undef isalnum
+@@ -146,5 +147,6 @@
+ #define toupper(c) do_not_use_toupper_with_safe_ctype
+ #undef tolower
+ #define tolower(c) do_not_use_tolower_with_safe_ctype
++#endif
+ 
+ #endif /* SAFE_CTYPE_H */
+--- a/gcc/system.h
++++ b/gcc/system.h
+@@ -917,6 +917,7 @@
+ 
+ #if (GCC_VERSION >= 3000)
+ 
++#if 0
+ /* Note autoconf checks for prototype declarations and includes
+    system.h while doing so.  Only poison these tokens if actually
+    compiling gcc, so that the autoconf declaration tests for malloc
+@@ -933,6 +934,7 @@
+ #undef realloc
+  #pragma GCC poison malloc realloc
+ #endif
++#endif
+ 
+ /* The %m format should be used when GCC's main diagnostic functions
+    supporting %m are available, and xstrerror from libiberty

diff --git a/sys-devel/gcc/gcc-13.2.0.ebuild b/sys-devel/gcc/gcc-13.2.0.ebuild
index 65b51e7dcc..41160a6ef9 100644
--- a/sys-devel/gcc/gcc-13.2.0.ebuild
+++ b/sys-devel/gcc/gcc-13.2.0.ebuild
@@ -21,6 +21,8 @@ IANSGCCVER="gcc-13.2-darwin-r0"
 SRC_URI+=" elibc_Darwin? (
 https://github.com/iains/gcc-13-branch/archive/refs/tags/${IANSGCCVER}.tar.gz 
)"
 
+IUSE+="bootstrap"
+
 # Technically only if USE=hardened *too* right now, but no point in 
complicating it further.
 # If GCC is enabling CET by default, we need glibc to be built with support 
for it.
 # bug #830454
@@ -76,6 +78,8 @@ src_prepare() {
        fi
 
        if [[ ${CHOST} == *-darwin* ]] ; then
+               use bootstrap && eapply 
"${FILESDIR}"/${PN}-13-darwin14-bootstrap.patch
+
                # our ld64 is a slight bit different, so tweak expression to not
                # get confused and break the build
                sed -i -e 's/grep ld64/grep :ld64/' gcc/configure || die

Reply via email to