commit:     d0da2d0ede93b9d4a2f97725f47d7c9bf3d9eaf2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  2 06:51:44 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun  2 07:15:41 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0da2d0e

toolchain.eclass: fetch patches from git for 9999 ebuilds

Saves us spinning a new patchset all the time, especially
for e.g. 13 which won't have a release for a long time.

Suggested-by: WANG Xuerui <xen0n <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 eclass/toolchain.eclass            | 23 ++++++++++++++++++++---
 sys-devel/gcc/gcc-12.2.9999.ebuild |  2 --
 sys-devel/gcc/gcc-13.0.9999.ebuild |  6 ++----
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 33306d3d92b1..90e596f94561 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -26,7 +26,7 @@ tc_is_live() {
 }
 
 if tc_is_live ; then
-       EGIT_REPO_URI="https://gcc.gnu.org/git/gcc.git";
+       EGIT_REPO_URI="https://gcc.gnu.org/git/gcc.git 
https://github.com/gcc-mirror/gcc";
        # Naming style:
        # gcc-10.1.0_pre9999 -> gcc-10-branch
        #  Note that the micro version is required or lots of stuff will break.
@@ -505,6 +505,23 @@ toolchain_pkg_setup() {
 toolchain_src_unpack() {
        if tc_is_live ; then
                git-r3_src_unpack
+
+               if [[ -z ${PATCH_VER} ]] && ! use vanilla ; then
+                       local 
gcc_patches_repo="https://anongit.gentoo.org/git/proj/gcc-patches.git 
https://github.com/gentoo/gcc-patches";
+                       # If we weren't given a patchset number, pull it from 
git too.
+                       einfo "Fetching patchset from git as PATCH_VER is unset"
+                       EGIT_REPO_URI=${gcc_patches_repo} EGIT_BRANCH="master" \
+                               EGIT_CHECKOUT_DIR="${WORKDIR}"/patch.tmp \
+                               git-r3_src_unpack
+
+                       mkdir "${WORKDIR}"/patch || die
+                       mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/gentoo/* 
"${WORKDIR}"/patch || die
+
+                       if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ 
${CTARGET} == *musl* ]] ; then
+                               mkdir "${WORKDIR}"/musl || die
+                               mv 
"${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/musl/* "${WORKDIR}"/musl || die
+                       fi
+               fi
        fi
 
        default_src_unpack
@@ -596,13 +613,13 @@ toolchain_src_prepare() {
 
 do_gcc_gentoo_patches() {
        if ! use vanilla ; then
-               if [[ -n ${PATCH_VER} ]] ; then
+               if [[ -n ${PATCH_VER} || -d "${WORKDIR}"/patch ]] ; then
                        einfo "Applying Gentoo patches ..."
                        eapply "${WORKDIR}"/patch/*.patch
                        BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} 
p${PATCH_VER}"
                fi
 
-               if [[ -n ${MUSL_VER} ]] && [[ ${CTARGET} == *musl* ]] ; then
+               if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ 
${CTARGET} == *musl* ]] ; then
                        if [[ ${CATEGORY} == cross-* ]] ; then
                                # We don't want to apply some patches when 
cross-compiling.
                                if [[ -d "${WORKDIR}"/musl/nocross ]] ; then

diff --git a/sys-devel/gcc/gcc-12.2.9999.ebuild 
b/sys-devel/gcc/gcc-12.2.9999.ebuild
index e3d8d3c19867..14cde425d874 100644
--- a/sys-devel/gcc/gcc-12.2.9999.ebuild
+++ b/sys-devel/gcc/gcc-12.2.9999.ebuild
@@ -3,9 +3,7 @@
 
 EAPI=8
 
-PATCH_VER="7"
 PATCH_GCC_VER="12.1.0"
-MUSL_VER="4"
 MUSL_GCC_VER="12.1.0"
 
 if [[ $(ver_cut 3) == 9999 ]] ; then

diff --git a/sys-devel/gcc/gcc-13.0.9999.ebuild 
b/sys-devel/gcc/gcc-13.0.9999.ebuild
index a9ec2dbc272b..fa2f56b460d6 100644
--- a/sys-devel/gcc/gcc-13.0.9999.ebuild
+++ b/sys-devel/gcc/gcc-13.0.9999.ebuild
@@ -3,10 +3,8 @@
 
 EAPI=8
 
-PATCH_VER="5"
-PATCH_GCC_VER="12.0.0"
-MUSL_VER="4"
-MUSL_GCC_VER="12.0.0"
+PATCH_GCC_VER="13.1.0"
+MUSL_GCC_VER="13.1.0"
 
 if [[ $(ver_cut 3) == 9999 ]] ; then
        MY_PV_2=$(ver_cut 2)

Reply via email to