Skip to content

Commit

Permalink
sys-devel/gcc-13.2.0: version bump
Browse files Browse the repository at this point in the history
Compiles and works on Darwin x64-17, arm64-23.  Non-Darwin use untested.

Bug: https://bugs.gentoo.org/916291
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
  • Loading branch information
grobian committed Jan 13, 2024
1 parent fbcb941 commit 1469562
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sys-devel/gcc/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ DIST gcc-12.2-darwin-r0.tar.gz 131069986 BLAKE2B 42de71c9f0802f1a43e675d3fae7341
DIST gcc-12.2.0-musl-patches-1.tar.xz 3844 BLAKE2B 004432806696f7d0a32366270ac45695e858abee73a255e44dc6e0a225339e4cad40aab0d51dfe9a55d5aa4b4001f5726064bb2eea3212a0874b2d27e229abd7 SHA512 c354edcd641a9dfaf902a0ff4c44c75065d0cf1c36bbf6c3c35c2e23bff22b8f70bcf4458a5a0ef86371e9f2fafca8a54ca822e35820ff442c9458a2819c3606
DIST gcc-12.2.0-patches-1.tar.xz 12864 BLAKE2B a5ae0a85dfc1b6f0bd968f0d5262ebed14ec9cdb3249e3a4c571578c54eda0e53708ee7fe8e03e506366c7f3cf7926eced9b390d9dee948c1249298c0fabd9fb SHA512 f3d793b89a2a0385d596162fb0c653d4acdf21ae418cb792c1786a01fde0391bd0719715dbf07d53636f127168f5cd99108a1dc11cf6cea889b7d82385bcc258
DIST gcc-12.2.0.tar.xz 84645292 BLAKE2B 715574af9ad678f9dc8cfd19c866bf910c7edfd479e7e9681337feaa9b54e5d304ddb85483816b8d89754d502405823ae2eff0d1e444538763f40be8e428d8da SHA512 e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173
DIST gcc-13.2-darwin-r0.tar.gz 137958605 BLAKE2B b6777b76baf2dc007c4080c0b7a6d448223747f0cf832e493e3b903b3bdb7f87a0e2e9cf41f9355769b178a72409b1e2866b3e73b1cc33ed0aba837f3a9e66c1 SHA512 a33177bd55d228d1df93e2a029e8af5d215ad8b2ebc84a0c90df629d6f69c5de0ed1ec9dd27bc21a62362522d83bad9a8f34407b89b13321b65f513fa2202dd2
DIST gcc-13.2.0-musl-patches-2.tar.xz 5292 BLAKE2B c057d6574d03c05854edaa9f3fd40e9149662b04f3ac7a7db3eb078d73a7b535726d1bf52e5b12736dedb2f9898ad731f2e48a6421fcfbf7b90f929dee072fcb SHA512 a691da0c87c443a5e9d23731f4005f27871c5b12bc9102873ffa24d374aa7b9fbd187c4f5635d23fa9ffb17e351e76173c2d3fdf40646e355c4cb314b538de69
DIST gcc-13.2.0-patches-7.tar.xz 37064 BLAKE2B 4a8700a8d44bfaa84926f8bfd0da4c5b0c0377f47fc0679456e909f7c9029b9cf1b72c0ba0bc505d9035d5c38e27f7e5b029727eaf2bc7aca417a6be966b2f43 SHA512 f440c97e6782ecb8581d41608e31a648ac426e2d870bc1d171da7794cdeff2fd0546cae0c7214e72fd3a00ead8a5c66f3f633b670b74553a2f3a40378b51f20c
DIST gcc-13.2.0.tar.xz 87858592 BLAKE2B 0034b29d3d6cc05821f0c4253ce077805943aff7b370729dd203bda57d89c107edd657eeddc2fb1e69ea15c7b0323b961f46516c7f4af89a3ccf7fea84701be2 SHA512 d99e4826a70db04504467e349e9fbaedaa5870766cda7c5cab50cdebedc4be755ebca5b789e1232a34a20be1a0b60097de9280efe47bdb71c73251e30b0862a2
19 changes: 19 additions & 0 deletions sys-devel/gcc/files/gcc-13-fix-cross-fixincludes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Revert of https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=59e4c98173a79fcaa2c33253261409f38856c384
for now to fix cross fixincludes builds.

https://bugs.gentoo.org/905118
--- 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
153 changes: 153 additions & 0 deletions sys-devel/gcc/gcc-13.2.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

TOOLCHAIN_PATCH_DEV="sam"
PATCH_GCC_VER="13.2.0"
PATCH_VER="7"
MUSL_VER="2"
MUSL_GCC_VER="13.2.0"

inherit toolchain

# Don't keyword live ebuilds
if ! tc_is_live && [[ -z ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
# fails to compile on Solaris and macOS, need to check why
: KEYWORDS="~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
KEYWORDS="~arm64-macos ~x64-macos ~x64-solaris"
fi

# use alternate source for Apple M1 (also works for x86_64)
IANSGCCVER="gcc-13.2-darwin-r0"
SRC_URI+=" elibc_Darwin? (
https://github.com/iains/gcc-13-branch/archive/refs/tags/${IANSGCCVER}.tar.gz )"

# 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
RDEPEND="!prefix-guest? ( elibc_glibc? ( sys-libs/glibc[cet(-)?] ) )"
DEPEND="${RDEPEND}"
BDEPEND="
kernel_linux? ( >=${CATEGORY}/binutils-2.30[cet(-)?] )
kernel_Darwin? (
|| ( ${CATEGORY}/binutils-apple ${CATEGORY}/native-cctools )
)"

src_unpack() {
if use elibc_Darwin ; then
# just use Ian's source, not the main one
S="${WORKDIR}/gcc-13-branch-${IANSGCCVER}"
fi
default
}

src_prepare() {
if [[ ${CHOST} == *-darwin* ]] ; then
# https://bugs.gentoo.org/898610#c17
# kill no_pie patch, it breaks things here
rm "${WORKDIR}"/patch/09_all_nopie-all-flags.patch || die
# fails on Darwin's sources
rm "${WORKDIR}"/patch/81_all_match.p*.patch
fi
# doesn't apply on official and Darwin sources
rm "${WORKDIR}"/patch/31_all_gm2_make_P_var.patch

toolchain_src_prepare

eapply_user

eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch

# make it have correct install_names on Darwin
eapply -p1 "${FILESDIR}"/4.3.3/darwin-libgcc_s-installname.patch

if [[ ${CHOST} == powerpc*-darwin* ]] ; then
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44107
sed -i -e 's|^ifeq (/usr/lib,|ifneq (/usr/lib,|' \
libgcc/config/t-slibgcc-darwin || die
fi

if [[ ${CHOST} == *-solaris* ]] ; then
# madvise is not available in the compatibility mode GCC uses,
# posix_madvise however, is
sed -i -e 's/madvise/posix_madvise/' gcc/cp/module.cc || die
fi

if [[ ${CHOST} == *-darwin* ]] ; then
# 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

# rip out specific macos version min
sed -i -e 's/-mmacosx-version-min=11.0//' \
libgcc/config/aarch64/t-darwin \
libgcc/config/aarch64/t-heap-trampoline \
|| die
fi
}

src_configure() {
local myconf=()
case ${CTARGET}:" ${USE} " in
powerpc*-darwin*)
# bug #381179
filter-flags "-mcpu=*" "-mtune=*"
# bug #657522
# A bug in configure checks whether -no-pie works, but the
# compiler doesn't pass -no-pie onto the linker if -fno-PIE
# isn't passed, so the configure check always finds -no-pie
# is accepted. (Likewise, when -fno-PIE is passed, the
# compiler passes -no_pie onto the linker.)
# Since our linker doesn't grok this, avoid above checks to
# be run
# NOTE: later ld64 does grok -no_pie, not -no-pie (as checked)
export gcc_cv_c_no_fpie=no
export gcc_cv_no_pie=no
;;
*-darwin20)
# use sysroot with the linker, #756160
export gcc_cv_ld_sysroot=yes
;;
*-solaris*)
# todo: some magic for native vs. GNU linking?
myconf+=( --with-gnu-ld --with-gnu-as --enable-largefile )
# Solaris 11 defines this in its headers, but that causes a
# mismatch whilst compiling, bug #657514
#export ac_cv_func_aligned_alloc=no
#export ac_cv_func_memalign=no
#export ac_cv_func_posix_memalign=no
append-ldflags -L"${EPREFIX}"/usr/lib \
-Wl,-rpath -Wl,"${EPREFIX}"/usr/lib
;;
i[34567]86-*-linux*:*" prefix "*)
# to allow the linux-x86-on-amd64.patch become useful, we need
# to enable multilib, even if there is just one multilib option.
myconf+=( --enable-multilib )
if [[ ${CBUILD:-${CHOST}} == "${CHOST}" ]]; then
# we might be on x86_64-linux, but don't do cross-compile, so
# tell the host-compiler to really create 32bits (for stage1)
# (real x86-linux-gcc also accept -m32).
append-flags -m32
fi
;;
esac

if [[ ${CHOST} == *-darwin ]] ; then
# GCC' Darwin fork enables support for "-stdlib=libc++"
# unconditionally, and its default include path is invalid,
# causing package build failures due to missing header.
# But more importantly, it breaks the assumption of many build
# scripts and changes their CFLAGS and linking behaviors. The
# situation is tricky and needs careful considerations.
# For now, just disable support for "-stdlib=libc++".
myconf+=( --with-gxx-libcxx-include-dir=no )
fi

# Since GCC 4.1.2 some non-posix (?) /bin/sh compatible code is used, at
# least on Solaris, and AIX /bin/sh is way too slow,
# so force it to use $BASH (that portage uses) - it can't be EPREFIX
# in case that doesn't exist yet
export CONFIG_SHELL="${CONFIG_SHELL:-${BASH}}"
toolchain_src_configure "${myconf[@]}"
}

0 comments on commit 1469562

Please sign in to comment.