Gentoo Archives: gentoo-dev

From: Michael Haubenwallner <haubi@g.o>
To: gentoo-dev@l.g.o
Cc: Michael Haubenwallner <haubi@g.o>
Subject: [gentoo-dev] [PATCH 5/5] toolchain.eclass: support gcc patches from cygwinports
Date: Fri, 22 Jun 2018 13:12:59
Message-Id: 20180622131028.13132-6-haubi@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/5]-r1 toolchain.eclass: Prefix patches, Cygwin related by Michael Haubenwallner
1 Download and apply patches found in Cygwin's gcc.cygport, maintained at
2 github/cygwinports/gcc, for a compiler running on cygwin. The ebuild
3 can define the cygwinports' git commit id as CYGWINPORTS_GITREV.
4 ---
5 eclass/toolchain.eclass | 28 ++++++++++++++++++++++++++++
6 1 file changed, 28 insertions(+)
7
8 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
9 index aa62010be6e..22936175125 100644
10 --- a/eclass/toolchain.eclass
11 +++ b/eclass/toolchain.eclass
12 @@ -309,6 +309,14 @@ gentoo_urls() {
13 # ten Brugge's bounds-checking patches. If you want to use a patch
14 # for an older gcc version with a new gcc, make sure you set
15 # HTB_GCC_VER to that version of gcc.
16 +#
17 +# CYGWINPORTS_GITREV
18 +# If set, this variable signals that we should apply additional patches
19 +# maintained by upstream Cygwin developers at github/cygwinports/gcc,
20 +# using the specified git commit id there. The list of patches to
21 +# apply is extracted from gcc.cygport, maintained there as well.
22 +# This is done for compilers running on Cygwin, not for cross compilers
23 +# with a Cygwin target.
24 get_gcc_src_uri() {
25 export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
26 export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
27 @@ -375,6 +383,11 @@ get_gcc_src_uri() {
28 fi
29 fi
30
31 + # Cygwin patches from https://github.com/cygwinports/gcc
32 + [[ -n ${CYGWINPORTS_GITREV} ]] && \
33 + GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.tar.gz
34 + -> gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )"
35 +
36 echo "${GCC_SRC_URI}"
37 }
38
39 @@ -481,6 +494,8 @@ gcc_quick_unpack() {
40
41 use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
42
43 + [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "${CYGWINPORTS_GITREV}.tar.gz"
44 +
45 popd > /dev/null
46 }
47
48 @@ -505,6 +520,7 @@ toolchain_src_prepare() {
49 fi
50 do_gcc_HTB_patches
51 do_gcc_PIE_patches
52 + do_gcc_CYGWINPORTS_patches
53 epatch_user
54
55 if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
56 @@ -645,6 +661,18 @@ do_gcc_PIE_patches() {
57 BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
58 }
59
60 +do_gcc_CYGWINPORTS_patches() {
61 + [[ -n ${CYGWINPORTS_GITREV} ]] || return 0
62 + use elibc_Cygwin || return 0
63 +
64 + local -a patches
65 + local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
66 + readarray -t patches < <(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport)
67 + for p in ${patches[*]}; do
68 + epatch "${d}/${p}"
69 + done
70 +}
71 +
72 # configure to build with the hardened GCC specs as the default
73 make_gcc_hard() {
74
75 --
76 2.16.1

Replies