Gentoo Archives: gentoo-dev

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