Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Cc: David Seifert <soap@g.o>
Subject: [gentoo-dev] [PATCH 01/12] toolchain.eclass: remove EAPI 5 and 6
Date: Sat, 29 Jan 2022 17:31:57
Message-Id: 20220129173130.2533280-1-soap@gentoo.org
1 Signed-off-by: David Seifert <soap@g.o>
2 ---
3 eclass/toolchain.eclass | 110 +++++++++++++++-------------------------
4 1 file changed, 40 insertions(+), 70 deletions(-)
5
6 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
7 index 61718f0d9a0..741b6dfbbcc 100644
8 --- a/eclass/toolchain.eclass
9 +++ b/eclass/toolchain.eclass
10 @@ -4,7 +4,7 @@
11 # @ECLASS: toolchain.eclass
12 # @MAINTAINER:
13 # Toolchain Ninjas <toolchain@g.o>
14 -# @SUPPORTED_EAPIS: 5 6 7 8
15 +# @SUPPORTED_EAPIS: 7 8
16 # @BLURB: Common code for sys-devel/gcc ebuilds
17
18 DESCRIPTION="The GNU Compiler Collection"
19 @@ -31,7 +31,6 @@ fi
20 FEATURES=${FEATURES/multilib-strict/}
21
22 case ${EAPI} in
23 - 5|6) inherit eapi7-ver eutils ;;
24 7) inherit eutils ;;
25 8) ;;
26 *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
27 @@ -129,16 +128,6 @@ LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-excepti
28 IUSE="test vanilla +nls"
29 RESTRICT="!test? ( test )"
30
31 -tc_supports_dostrip() {
32 - case ${EAPI} in
33 - 5|6) return 1 ;;
34 - 7|8) return 0 ;;
35 - *) die "Update apply_patches() for ${EAPI}." ;;
36 - esac
37 -}
38 -
39 -tc_supports_dostrip || RESTRICT+=" strip" # cross-compilers need controlled stripping
40 -
41 TC_FEATURES=()
42
43 tc_has_feature() {
44 @@ -146,21 +135,21 @@ tc_has_feature() {
45 }
46
47 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
48 - IUSE+=" debug +cxx +nptl" TC_FEATURES+=(nptl)
49 + IUSE+=" debug +cxx +nptl" TC_FEATURES+=( nptl )
50 [[ -n ${PIE_VER} ]] && IUSE+=" nopie"
51 [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
52 - IUSE+=" +fortran" TC_FEATURES+=(fortran)
53 + IUSE+=" +fortran" TC_FEATURES+=( fortran )
54 IUSE+=" doc hardened multilib objc"
55 - tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
56 + tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=( gcj )
57 IUSE+=" pgo"
58 - IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
59 + IUSE+=" objc-gc" TC_FEATURES+=( objc-gc )
60 IUSE+=" libssp objc++"
61 IUSE+=" +openmp"
62 tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
63 tc_version_is_at_least 4.7 && IUSE+=" go"
64 # sanitizer support appeared in gcc-4.8, but <gcc-5 does not
65 # support modern glibc.
66 - tc_version_is_at_least 5 && IUSE+=" +sanitize" TC_FEATURES+=(sanitize)
67 + tc_version_is_at_least 5 && IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
68 # Note:
69 # <gcc-4.8 supported graphite, it required forked ppl
70 # versions which we dropped. Since graphite was also experimental in
71 @@ -168,7 +157,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
72 # <gcc-5 supported graphite, it required cloog
73 # <gcc-6.5 supported graphite, it required old incompatible isl
74 tc_version_is_at_least 6.5 &&
75 - IUSE+=" graphite" TC_FEATURES+=(graphite)
76 + IUSE+=" graphite" TC_FEATURES+=( graphite )
77 tc_version_is_between 4.9 8 && IUSE+=" cilk"
78 tc_version_is_at_least 4.9 && IUSE+=" ada"
79 tc_version_is_at_least 4.9 && IUSE+=" vtv"
80 @@ -177,12 +166,12 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
81 tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
82 # systemtap is a gentoo-specific switch: bug #654748
83 tc_version_is_at_least 8.0 &&
84 - IUSE+=" systemtap" TC_FEATURES+=(systemtap)
85 + IUSE+=" systemtap" TC_FEATURES+=( systemtap )
86 tc_version_is_at_least 9.0 && IUSE+=" d"
87 tc_version_is_at_least 9.1 && IUSE+=" lto"
88 tc_version_is_at_least 10 && IUSE+=" cet"
89 - tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=(zstd)
90 - tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=(valgrind)
91 + tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd )
92 + tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind )
93 tc_version_is_at_least 11 && IUSE+=" custom-cflags"
94 fi
95
96 @@ -269,10 +258,6 @@ if tc_has_feature valgrind; then
97 BDEPEND+=" valgrind? ( dev-util/valgrind )"
98 fi
99
100 -case ${EAPI} in
101 - 5|6) DEPEND+=" ${BDEPEND}" ;;
102 -esac
103 -
104 PDEPEND=">=sys-devel/gcc-config-2.3"
105
106 #---->> S + SRC_URI essentials <<----
107 @@ -447,25 +432,9 @@ toolchain_src_unpack() {
108
109 #---->> src_prepare <<----
110
111 -# 'epatch' is not available in EAPI=7. Abstract away patchset application
112 -# until we eventually get all gcc ebuilds on EAPI=7 or later.
113 -tc_apply_patches() {
114 - [[ ${#@} -lt 2 ]] && die "usage: tc_apply_patches <message> <patches...>"
115 -
116 - einfo "$1"; shift
117 -
118 - case ${EAPI} in
119 - # Note: even for EAPI=6 we used 'epatch' semantics. To avoid
120 - # breaking existing ebuilds use 'eapply' only in EAPI=7 or later.
121 - 5|6) epatch "$@" ;;
122 - 7|8) eapply "$@" ;;
123 - *) die "Update apply_patches() for ${EAPI}." ;;
124 - esac
125 -}
126 -
127 toolchain_src_prepare() {
128 export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
129 - cd "${S}"
130 + cd "${S}" || die
131
132 do_gcc_gentoo_patches
133 do_gcc_PIE_patches
134 @@ -475,11 +444,7 @@ toolchain_src_prepare() {
135 BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, commit ${EGIT_VERSION}"
136 fi
137
138 - case ${EAPI} in
139 - 5) epatch_user;;
140 - 6|7|8) eapply_user ;;
141 - *) die "Update toolchain_src_prepare() for ${EAPI}." ;;
142 - esac
143 + eapply_user
144
145 if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \
146 && ! use vanilla ; then
147 @@ -490,7 +455,7 @@ toolchain_src_prepare() {
148 # since we configure with just one --libdir, we can't use that
149 # (as gcc itself takes care of building multilibs). #435728
150 find "${S}" -name Makefile.in \
151 - -exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
152 + -exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} + || die
153
154 setup_multilib_osdirnames
155 gcc_version_patch
156 @@ -532,10 +497,11 @@ toolchain_src_prepare() {
157 || eerror "Please file a bug about this"
158 eend $?
159 done
160 - sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
161 + sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die #215828
162
163 # Prevent new texinfo from breaking old versions (see #198182, #464008)
164 - tc_apply_patches "Remove texinfo (bug #198182, bug #464008)" "${FILESDIR}"/gcc-configure-texinfo.patch
165 + einfo "Remove texinfo (bug #198182, bug #464008)"
166 + eapply "${FILESDIR}"/gcc-configure-texinfo.patch
167
168 # >=gcc-4
169 if [[ -x contrib/gcc_update ]] ; then
170 @@ -550,7 +516,8 @@ toolchain_src_prepare() {
171 do_gcc_gentoo_patches() {
172 if ! use vanilla ; then
173 if [[ -n ${PATCH_VER} ]] ; then
174 - tc_apply_patches "Applying Gentoo patches ..." "${WORKDIR}"/patch/*.patch
175 + einfo "Applying Gentoo patches ..."
176 + eapply "${WORKDIR}"/patch/*.patch
177 BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
178 fi
179
180 @@ -567,7 +534,8 @@ do_gcc_gentoo_patches() {
181
182 local shopt_save=$(shopt -p nullglob)
183 shopt -s nullglob
184 - tc_apply_patches "Applying musl patches ..." "${WORKDIR}"/musl/{,nocross/}*.patch
185 + einfo "Applying musl patches ..."
186 + eapply "${WORKDIR}"/musl/{,nocross/}*.patch
187 ${shopt_save}
188 fi
189 fi
190 @@ -577,7 +545,8 @@ do_gcc_PIE_patches() {
191 want_pie || return 0
192 use vanilla && return 0
193
194 - tc_apply_patches "Applying pie patches ..." "${WORKDIR}"/piepatch/*.patch
195 + einfo "Applying pie patches ..."
196 + eapply "${WORKDIR}"/piepatch/*.patch
197
198 BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
199 }
200 @@ -595,7 +564,8 @@ do_gcc_CYGWINPORTS_patches() {
201 echo "${d}/${p}"
202 done
203 ) )
204 - tc_apply_patches "Applying cygwin port patches ..." ${patches[*]}
205 + einfo "Applying cygwin port patches ..."
206 + eapply -- "${patches[@]}"
207 }
208
209 # configure to build with the hardened GCC specs as the default
210 @@ -663,12 +633,12 @@ make_gcc_hard() {
211 # than ALL_CFLAGS...
212 sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
213 -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
214 - -i "${S}"/gcc/Makefile.in
215 + -i "${S}"/gcc/Makefile.in || die
216 # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
217 if tc_version_is_at_least 4.7 ; then
218 sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
219 -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
220 - -i "${S}"/gcc/Makefile.in
221 + -i "${S}"/gcc/Makefile.in || die
222 fi
223
224 sed -i \
225 @@ -1744,9 +1714,9 @@ toolchain_src_install() {
226 # - "${D}${LIBPATH}"
227 # As dostrip does not specify host to override ${CHOST} tools just skip
228 # non-native binary stripping.
229 - is_crosscompile && tc_supports_dostrip && dostrip -x "${LIBPATH}"
230 + is_crosscompile && dostrip -x "${LIBPATH}"
231
232 - cd "${S}"
233 + cd "${S}" || die
234 if is_crosscompile; then
235 rm -rf "${ED}"/usr/share/{man,info}
236 rm -rf "${D}"${DATAPATH}/{man,info}
237 @@ -2061,40 +2031,40 @@ gcc_slot_java() {
238
239 toolchain_pkg_postinst() {
240 do_gcc_config
241 - if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
242 + if [[ ! ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
243 eselect compiler-shadow update all
244 fi
245
246 if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
247 # gcc stopped installing .la files fixer in June 2020.
248 # Cleaning can be removed in June 2022.
249 - rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
250 - rm -f "${EROOT%/}"/usr/sbin/fix_libtool_files.sh
251 - rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
252 + rm -f "${EROOT}"/sbin/fix_libtool_files.sh
253 + rm -f "${EROOT}"/usr/sbin/fix_libtool_files.sh
254 + rm -f "${EROOT}"/usr/share/gcc-data/fixlafiles.awk
255 fi
256 }
257
258 toolchain_pkg_postrm() {
259 do_gcc_config
260 - if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
261 + if [[ ! ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
262 eselect compiler-shadow clean all
263 fi
264
265 # clean up the cruft left behind by cross-compilers
266 if is_crosscompile ; then
267 - if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
268 + if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
269 einfo "Removing last cross-compiler instance. Deleting dangling symlinks."
270 - rm -f "${EROOT%/}"/etc/env.d/gcc/config-${CTARGET}
271 - rm -f "${EROOT%/}"/etc/env.d/??gcc-${CTARGET}
272 - rm -f "${EROOT%/}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
273 + rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
274 + rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
275 + rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
276 fi
277 return 0
278 fi
279
280 # gcc stopped installing .la files fixer in June 2020.
281 # Cleaning can be removed in June 2022.
282 - rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
283 - rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
284 + rm -f "${EROOT}"/sbin/fix_libtool_files.sh
285 + rm -f "${EROOT}"/usr/share/gcc-data/fixlafiles.awk
286 }
287
288 do_gcc_config() {
289 @@ -2113,7 +2083,7 @@ do_gcc_config() {
290 [[ -n ${current_specs} ]] && use_specs=-${current_specs}
291
292 if [[ -n ${use_specs} ]] && \
293 - [[ ! -e ${EROOT%/}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
294 + [[ ! -e ${EROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
295 then
296 ewarn "The currently selected specs-specific gcc config,"
297 ewarn "${current_specs}, doesn't exist anymore. This is usually"
298 --
299 2.35.0

Replies