1 |
W dniu śro, 20.06.2018 o godzinie 19∶49 +0200, użytkownik Michael |
2 |
Haubenwallner napisał: |
3 |
> Download and apply patches found in Cygwin's gcc.cygport, maintained |
4 |
> at |
5 |
> github/cygwinports/gcc, for a compiler running on cygwin. The ebuild |
6 |
> can define the cygwinports' git commit id as CYGWINPORTS_GITREV. |
7 |
> --- |
8 |
> eclass/toolchain.eclass | 28 ++++++++++++++++++++++++++++ |
9 |
> 1 file changed, 28 insertions(+) |
10 |
> |
11 |
> diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
12 |
> index faf96d2a41f..a16bfadc301 100644 |
13 |
> --- a/eclass/toolchain.eclass |
14 |
> +++ b/eclass/toolchain.eclass |
15 |
> @@ -309,6 +309,14 @@ gentoo_urls() { |
16 |
> # ten Brugge's bounds-checking patches. If |
17 |
> you want to use a patch |
18 |
> # for an older gcc version with a new gcc, |
19 |
> make sure you set |
20 |
> # HTB_GCC_VER to that version of gcc. |
21 |
> +# |
22 |
> +# CYGWINPORTS_GITREV |
23 |
> +# If set, this variable signals that we |
24 |
> should apply additional patches |
25 |
> +# maintained by upstream Cygwin developers at |
26 |
> github/cygwinports/gcc, |
27 |
> +# using the specified git commit id |
28 |
> there. The list of patches to |
29 |
> +# apply is extracted from gcc.cygport, |
30 |
> maintained there as well. |
31 |
> +# This is done for compilers running on |
32 |
> Cygwin, not for cross compilers |
33 |
> +# with a Cygwin target. |
34 |
> get_gcc_src_uri() { |
35 |
> export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} |
36 |
> export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} |
37 |
> @@ -375,6 +383,10 @@ get_gcc_src_uri() { |
38 |
> fi |
39 |
> fi |
40 |
> |
41 |
> + # Cygwin patches from https://github.com/cygwinports/gcc |
42 |
> + [[ -n ${CYGWINPORTS_GITREV} ]] && \ |
43 |
> + GCC_SRC_URI+=" elibc_Cygwin? ( |
44 |
> https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.zip |
45 |
> )" |
46 |
|
47 |
Why not .tar.gz? |
48 |
|
49 |
> + |
50 |
> echo "${GCC_SRC_URI}" |
51 |
> } |
52 |
> |
53 |
> @@ -481,6 +493,8 @@ gcc_quick_unpack() { |
54 |
> |
55 |
> use_if_iuse boundschecking && unpack "bounds-checking-gcc- |
56 |
> ${HTB_GCC_VER}-${HTB_VER}.patch.bz2" |
57 |
> |
58 |
> + [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack |
59 |
> "${CYGWINPORTS_GITREV}.zip" |
60 |
> + |
61 |
> popd > /dev/null |
62 |
> } |
63 |
> |
64 |
> @@ -505,6 +519,7 @@ toolchain_src_prepare() { |
65 |
> fi |
66 |
> do_gcc_HTB_patches |
67 |
> do_gcc_PIE_patches |
68 |
> + do_gcc_CYGWINPORTS_patches |
69 |
> epatch_user |
70 |
> |
71 |
> if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) |
72 |
> && ! use vanilla ; then |
73 |
> @@ -645,6 +660,19 @@ do_gcc_PIE_patches() { |
74 |
> BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie- |
75 |
> ${PIE_VER}" |
76 |
> } |
77 |
> |
78 |
> +do_gcc_CYGWINPORTS_patches() { |
79 |
> + [[ -n ${CYGWINPORTS_GITREV} ]] || return 0 |
80 |
> + use elibc_Cygwin || return 0 |
81 |
> + |
82 |
> + local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}" |
83 |
> + for p in $( |
84 |
> + eval "$(sed -ne '/PATCH_URI="/,/"/p' < |
85 |
> "${d}"/gcc.cygport)" |
86 |
|
87 |
The eval here is completely unnecessary, and can easily wreak havoc. |
88 |
Don't do that. |
89 |
|
90 |
> + echo ${PATCH_URI} |
91 |
> + ); do |
92 |
> + epatch "${d}/${p}" |
93 |
> + done |
94 |
> +} |
95 |
> + |
96 |
> # configure to build with the hardened GCC specs as the default |
97 |
> make_gcc_hard() { |
98 |
> |
99 |
-- |
100 |
Best regards, |
101 |
Michał Górny |