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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 01E29138334 for ; Fri, 22 Jun 2018 12:00:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1C1FCE07F0; Fri, 22 Jun 2018 12:00:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 89C9FE07E0 for ; Fri, 22 Jun 2018 12:00:20 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 38075335C92; Fri, 22 Jun 2018 12:00:18 +0000 (UTC) Message-ID: <1529668806.20951.6.camel@gentoo.org> Subject: Re: [gentoo-dev] Re: [PATCH 5/5] toolchain.eclass: support gcc patches from cygwinports From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Date: Fri, 22 Jun 2018 14:00:06 +0200 In-Reply-To: <6b837a26-6e7a-0a0a-e6e2-03a74a143f95@gentoo.org> References: <20180620174905.7733-1-haubi@gentoo.org> <20180620174905.7733-6-haubi@gentoo.org> <1529524613.1791.1.camel@gentoo.org> <6b837a26-6e7a-0a0a-e6e2-03a74a143f95@gentoo.org> Organization: Gentoo Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-q7HmvudRXQsoJxJQvf93" X-Mailer: Evolution 3.24.6 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 X-Archives-Salt: 7ba4779b-7637-4ffb-b82a-445fad0c1b54 X-Archives-Hash: 9e4ebef728caf1e3ced07bb404a91db2 --=-q7HmvudRXQsoJxJQvf93 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable W dniu pi=C4=85, 22.06.2018 o godzinie 13=E2=88=B622=E2=80=89+0200, u=C5=BC= ytkownik Michael Haubenwallner napisa=C5=82: > On 06/20/2018 09:56 PM, Micha=C5=82 G=C3=B3rny wrote: > > W dniu =C5=9Bro, 20.06.2018 o godzinie 19=E2=88=B649=E2=80=89+0200, u= =C5=BCytkownik Michael > > Haubenwallner napisa=C5=82: > > > Download and apply patches found in Cygwin's gcc.cygport, maintained > > > at > > > github/cygwinports/gcc, for a compiler running on cygwin. The ebuild > > > can define the cygwinports' git commit id as CYGWINPORTS_GITREV. > > > --- > > > eclass/toolchain.eclass | 28 ++++++++++++++++++++++++++++ > > > 1 file changed, 28 insertions(+) > > >=20 > > > diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass > > > index faf96d2a41f..a16bfadc301 100644 > > > --- a/eclass/toolchain.eclass > > > +++ b/eclass/toolchain.eclass > > > @@ -309,6 +309,14 @@ gentoo_urls() { > > > # ten Brugge's bounds-checking patches. If > > > you want to use a patch > > > # for an older gcc version with a new gcc, > > > make sure you set > > > # HTB_GCC_VER to that version of gcc. > > > +# > > > +# CYGWINPORTS_GITREV > > > +# If set, this variable signals that we > > > should apply additional patches > > > +# maintained by upstream Cygwin developers at > > > github/cygwinports/gcc, > > > +# using the specified git commit id > > > there. The list of patches to > > > +# apply is extracted from gcc.cygport, > > > maintained there as well. > > > +# This is done for compilers running on > > > Cygwin, not for cross compilers > > > +# with a Cygwin target. > > > get_gcc_src_uri() { > > > export PATCH_GCC_VER=3D${PATCH_GCC_VER:-${GCC_RELEASE_VER}} > > > export UCLIBC_GCC_VER=3D${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} > > > @@ -375,6 +383,10 @@ get_gcc_src_uri() { > > > fi > > > fi > > > =20 > > > + # Cygwin patches from https://github.com/cygwinports/gcc > > > + [[ -n ${CYGWINPORTS_GITREV} ]] && \ > > > + GCC_SRC_URI+=3D" elibc_Cygwin? ( > > > https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.zip > > > )" > >=20 > > Why not .tar.gz? >=20 > Didn't know .tar.gz works - the webpage provides [Download ZIP] only, tha= nks! >=20 > >=20 > > > + > > > echo "${GCC_SRC_URI}" > > > } > > > =20 > > > @@ -481,6 +493,8 @@ gcc_quick_unpack() { > > > =20 > > > use_if_iuse boundschecking && unpack "bounds-checking-gcc- > > > ${HTB_GCC_VER}-${HTB_VER}.patch.bz2" > > > =20 > > > + [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack > > > "${CYGWINPORTS_GITREV}.zip" > > > + > > > popd > /dev/null > > > } > > > =20 > > > @@ -505,6 +519,7 @@ toolchain_src_prepare() { > > > fi > > > do_gcc_HTB_patches > > > do_gcc_PIE_patches > > > + do_gcc_CYGWINPORTS_patches > > > epatch_user > > > =20 > > > if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) > > > && ! use vanilla ; then > > > @@ -645,6 +660,19 @@ do_gcc_PIE_patches() { > > > BRANDING_GCC_PKGVERSION=3D"${BRANDING_GCC_PKGVERSION}, pie- > > > ${PIE_VER}" > > > } > > > =20 > > > +do_gcc_CYGWINPORTS_patches() { > > > + [[ -n ${CYGWINPORTS_GITREV} ]] || return 0 > > > + use elibc_Cygwin || return 0 > > > + > > > + local p d=3D"${WORKDIR}/gcc-${CYGWINPORTS_GITREV}" > > > + for p in $( > > > + eval "$(sed -ne '/PATCH_URI=3D"/,/"/p' < > > > "${d}"/gcc.cygport)" > >=20 > > The eval here is completely unnecessary, and can easily wreak havoc.= =20 > > Don't do that. >=20 > Erm - multiline commands from $() seem to fail without eval: >=20 > # sed -ne '/PATCH_URI=3D"/,/"/p' < ./gcc.cygport > PATCH_URI=3D" > 0001-share-mingw-fset-stack-executable-with-cygwin.patch > ... > " >=20 > # $(sed -ne '/PATCH_URI=3D"/,/"/p' < ./gcc.cygport) > -bash: PATCH_URI=3D": command not found >=20 > # eval "$(sed -ne '/PATCH_URI=3D"/,/"/p' < ./gcc.cygport)" >=20 > # declare -p PATCH_URI > declare -- PATCH_URI=3D" > 0001-share-mingw-fset-stack-executable-with-cygwin.patch > ... > " >=20 It's not very hard if you try to find another solution to the problem rather than trying to force your solution to work without eval. For example: local patches=3D() readarray -t patches < <(sed -e '1,/PATCH_URI=3D"/d;/"/,$d' < gcc.cygport) --=20 Best regards, Micha=C5=82 G=C3=B3rny --=-q7HmvudRXQsoJxJQvf93 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQKTBAABCgB9FiEEbbsHzE8NrQbqCv5BsHoa6u+0Rk4FAlss5MdfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDZE QkIwN0NDNEYwREFEMDZFQTBBRkU0MUIwN0ExQUVBRUZCNDQ2NEUACgkQsHoa6u+0 Rk7b9A//fEzXz13L2/4TPiTCIo+nKupYf+e37TtbVjD1PyANcjR3T1o1Si6vJCyR FRL/4mIjqThiuhimXOPic3pEa4lXZwTtEvG9uT+o3O2uLqC71kp56dmlgSHeE4lc Qdn/CRhwuxKPcrJ58YjbIlYo9b6w4/29y3RqjUojUXjjmSaRCPPztvVp9b2IdpB/ Hq8mgfK+djPfqrqoaaVbMMxlw/NSpgVplSJpy9Q0THWBWiDMd2xEStt89HB0LzAT yi+jWKRMwDPdd90aQ4z4vi+fTulBoyRtHx9tn2xe/+f4Pul9WnqTDMbvH7iW8mdu 4Wz/49hmxdNGTq3fYEsZotaQ6plgFnuZlhQevQF29ZfinOw1N+NVRtAyBJET0emm y1lsNeTItqsVDCUZdp6Z5DUnqgNhmQkSIEnWoLyE+sZ3rZE8hDfPFQuz0FlzDLQV 2S79LYpVB3g2+X2mofa1uOIA3vC7SRSkDlDc4+eqJZMTS5gRIozk3OSz6mW7iNhY 7HvBuoxqf7LNOO2UBBCq38SzPrtcf361s1N6IzBUviBK5HzENccnL9OW1TZo6tCp R882Jl3ZPORwS0YHSuSK4yx/6cv1/230G9j128vEnpzU2q7xbIrpS12lBQsNAPLP esG9etW1s16/ks5E8zI15TMzbHzJ7/VzVpP1b9nqApNa3Kb3J4w= =OQel -----END PGP SIGNATURE----- --=-q7HmvudRXQsoJxJQvf93--