From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CB3F015808B for ; Sun, 29 Sep 2024 01:07:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CA1A3E29ED; Sun, 29 Sep 2024 01:07:05 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A9611E29ED for ; Sun, 29 Sep 2024 01:07:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A9F6A3431D7 for ; Sun, 29 Sep 2024 01:07:04 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 11EC7ACC for ; Sun, 29 Sep 2024 01:07:03 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1727571884.3355cb0ab6d92d84eeff44163da5309d114726b3.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/toolchain.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 3355cb0ab6d92d84eeff44163da5309d114726b3 X-VCS-Branch: master Date: Sun, 29 Sep 2024 01:07:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 73cc3519-8022-4700-834d-ef20a84a7e8e X-Archives-Hash: ee569e8c92765c431e290abb64c92d90 commit: 3355cb0ab6d92d84eeff44163da5309d114726b3 Author: Sam James gentoo org> AuthorDate: Sun Sep 29 01:04:44 2024 +0000 Commit: Sam James gentoo org> CommitDate: Sun Sep 29 01:04:44 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3355cb0a toolchain.eclass: rework D handling The recent work for Ada makes things easier here because you don't have to try juggle both GNAT and GDC at the same time. Anyway, let's do something similar: iterate over installed GCCs and try to use the best GDC available for bootstrapping, so users don't have to manually select it with `gcc-config`. More mangling may be needed than setting GDC down the line. Bug: https://bugs.gentoo.org/868228 Signed-off-by: Sam James gentoo.org> eclass/toolchain.eclass | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index cfddba99a1a8..30d96f25aaa8 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -991,6 +991,32 @@ toolchain_src_configure() { export CC="$(tc-getCC) -specs=${T}/ada.spec" fi + if _tc_use_if_iuse d ; then + local latest_gcc=$(best_version -b "sys-devel/gcc") + latest_gcc="${latest_gcc#sys-devel/gcc-}" + latest_gcc=$(ver_cut 1 ${latest_gcc}) + + local d_bootstrap + local d_candidate + # We always prefer the version being built if possible + # as it has the greatest chance of success. Failing that, + # try the latest installed GCC and iterate downwards. + for d_candidate in ${SLOT} $(seq ${latest_gcc} -1 10) ; do + has_version -b "sys-devel/gcc:${d_candidate}" || continue + + ebegin "Testing sys-devel/gcc:${d_candidate} for D" + if has_version -b "sys-devel/gcc:${d_candidate}[d(-)]" ; then + d_bootstrap=${d_candidate} + + eend 0 + break + fi + eend 1 + done + + export GDC="${BROOT}/usr/${CTARGET}/gcc-bin/${d_bootstrap}/gdc" + fi + confgcc+=( --prefix="${PREFIX}" --bindir="${BINPATH}"