Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/
Date: Fri, 08 May 2020 18:20:57
Message-Id: 1588962038.99fab1f056c44b2f568895262eaebc859319932c.dilfridge@gentoo
1 commit: 99fab1f056c44b2f568895262eaebc859319932c
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 8 18:20:01 2020 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri May 8 18:20:38 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99fab1f0
7
8 sys-devel/binutils: 2.34 revbump (unkeyworded) for testing
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
12
13 sys-devel/binutils/Manifest | 1 +
14 sys-devel/binutils/binutils-2.34-r1.ebuild | 442 +++++++++++++++++++++++++++++
15 2 files changed, 443 insertions(+)
16
17 diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
18 index 6c5a265a878..0ba20b32a59 100644
19 --- a/sys-devel/binutils/Manifest
20 +++ b/sys-devel/binutils/Manifest
21 @@ -4,5 +4,6 @@ DIST binutils-2.32.tar.xz 20774880 BLAKE2B d1bdbd9c8487c091665c197974ce4bdf520b7
22 DIST binutils-2.33.1-patches-2.tar.xz 18636 BLAKE2B 0e0757329b6a83aeff4f4c450c95e73fd48fcc89f83e63f294568632bee0972552cf2f57494352c5d9a7c16a51cdbc4108b38fa6028d4388c8e76046b3da9212 SHA512 d982f68d1f5fdb384309a2a1b7426bf840a90e7a85b37229b4223b62c36cab9dd9ec0c08382c85c68adf996dec21133df3180a2fc649363adae8645f8282f71d
23 DIST binutils-2.33.1.tar.xz 21490848 BLAKE2B c336a8412938dc8c224f40a763a8bea9937cca0462a8fb80e62f14aabe590107fc061a3f4b9327e1f4652cb026384d36a91b4766d4d469d2d0680932874b638c SHA512 b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac
24 DIST binutils-2.34-patches-1.tar.xz 20388 BLAKE2B 8828505f62259a307de445357320827e7f6bc416a7f4c72140add505f62eef3928c7daec13be158b52c2a7a1d989f539025e4be6ec27ef80ede81477a42c5042 SHA512 951dffcc30ad5706dc48e71995217655c5d96472446ab66a357f19486b57d1868143a9809887eab7ba8c42c33124f8b37d3bab6618388ea8a08b4399d348a645
25 +DIST binutils-2.34-patches-3.tar.xz 93968 BLAKE2B e39b02ccd87e5ec68a36390b7b26d897d3c0ff81f9ec1d873ea239bd6c46605cb750d608916f2973547781aeed2d5d89a985900644e0eafb10925d7c42efe7f9 SHA512 d478775bce42f3bcb16bc60d9ca6ead1ab5ae969e9d8817db209aa5dea8f96626d575852a7d2b77d187ae5521eebf8efef2dcff5dfe68433fad1fd59b80039b7
26 DIST binutils-2.34.tar.xz 21637796 BLAKE2B 07dd23916a7d27f71c3f160c8c16abe2bd4fce294c738c665a012a3be6a87dbe8160d0c38740524f9025e01d438e99b2a94bcf9f9f79ee214f5dd033de8aad3d SHA512 2c7976939dcf5e8c5b7374cccd39bfe803b1bec73c6abfa0eb17c24e1942574c6bdb874c66a092a82adc443182eacd8a5a8001c19a76101f0c7ba40c27de0bbd
27 DIST binutils-9999-patches-5.tar.xz 17492 BLAKE2B 4d5072d26d714dbc2a65899102c35791887b3c1298eb40a72088f5f964f500fa82581ac27a47f075812610e1757ba1ca5ac7d055dccc0d819ec06a86ca98f395 SHA512 c8a843cf04b72f010eef405cc2d029e49fb1f4582686f1e0409579d544b02d249c31f7cb9cd59747bc94727e29ddaba89951043b392017c6963ca14f3a0202b1
28
29 diff --git a/sys-devel/binutils/binutils-2.34-r1.ebuild b/sys-devel/binutils/binutils-2.34-r1.ebuild
30 new file mode 100644
31 index 00000000000..bf97cbe7957
32 --- /dev/null
33 +++ b/sys-devel/binutils/binutils-2.34-r1.ebuild
34 @@ -0,0 +1,442 @@
35 +# Copyright 1999-2020 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
41 +
42 +DESCRIPTION="Tools necessary to build programs"
43 +HOMEPAGE="https://sourceware.org/binutils/"
44 +LICENSE="GPL-3+"
45 +IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test"
46 +REQUIRED_USE="default-gold? ( gold )"
47 +
48 +# Variables that can be set here:
49 +# PATCH_VER - the patchset version
50 +# Default: empty, no patching
51 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
52 +# - Default: PV
53 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
54 +# for the patchsets
55 +
56 +PATCH_VER=3
57 +PATCH_DEV=dilfridge
58 +
59 +case ${PV} in
60 + 9999)
61 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
62 + inherit git-r3
63 + S=${WORKDIR}/binutils
64 + EGIT_CHECKOUT_DIR=${S}
65 + SLOT=${PV}
66 + ;;
67 + *.9999)
68 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
69 + inherit git-r3
70 + S=${WORKDIR}/binutils
71 + EGIT_CHECKOUT_DIR=${S}
72 + EGIT_BRANCH=$(ver_cut 1-2)
73 + EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
74 + SLOT=$(ver_cut 1-2)
75 + ;;
76 + *)
77 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
78 + SLOT=$(ver_cut 1-2)
79 + #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
80 + ;;
81 +esac
82 +
83 +#
84 +# The Gentoo patchset
85 +#
86 +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
87 +PATCH_DEV=${PATCH_DEV:-slyfox}
88 +
89 +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
90 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
91 +
92 +#
93 +# The cross-compile logic
94 +#
95 +export CTARGET=${CTARGET:-${CHOST}}
96 +if [[ ${CTARGET} == ${CHOST} ]] ; then
97 + if [[ ${CATEGORY} == cross-* ]] ; then
98 + export CTARGET=${CATEGORY#cross-}
99 + fi
100 +fi
101 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
102 +
103 +#
104 +# The dependencies
105 +#
106 +RDEPEND="
107 + >=sys-devel/binutils-config-3
108 + sys-libs/zlib
109 +"
110 +DEPEND="${RDEPEND}"
111 +BDEPEND="
112 + doc? ( sys-apps/texinfo )
113 + test? ( dev-util/dejagnu )
114 + nls? ( sys-devel/gettext )
115 + sys-devel/flex
116 + virtual/yacc
117 +"
118 +
119 +RESTRICT="!test? ( test )"
120 +
121 +PATCHES=(
122 + "${FILESDIR}"/${PN}-2.33-gcc-10.patch
123 + "${FILESDIR}"/${PN}-2.34-riscv-SEGV.patch
124 +)
125 +
126 +MY_BUILDDIR=${WORKDIR}/build
127 +
128 +src_unpack() {
129 + case ${PV} in
130 + *9999)
131 + git-r3_src_unpack
132 + ;;
133 + *)
134 + ;;
135 + esac
136 + default
137 + mkdir -p "${MY_BUILDDIR}"
138 +}
139 +
140 +src_prepare() {
141 + if [[ ! -z ${PATCH_VER} ]] ; then
142 + # Use upstream patch to enable development mode
143 + rm -v "${WORKDIR}/patch"/0000-Gentoo-Git-is-development.patch || die
144 +
145 + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
146 + eapply "${WORKDIR}/patch"/*.patch
147 + fi
148 +
149 + # This check should probably go somewhere else, like pkg_pretend.
150 + if [[ ${CTARGET} == *-uclibc* ]] ; then
151 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
152 + die "sorry, but this binutils doesn't yet support uClibc :("
153 + fi
154 + fi
155 +
156 + # Make sure our explicit libdir paths don't get clobbered. #562460
157 + sed -i \
158 + -e 's:@bfdlibdir@:@libdir@:g' \
159 + -e 's:@bfdincludedir@:@includedir@:g' \
160 + {bfd,opcodes}/Makefile.in || die
161 +
162 + # Fix locale issues if possible #122216
163 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
164 + einfo "Fixing misc issues in configure files"
165 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
166 + ebegin " Updating ${f/${S}\/}"
167 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
168 + || eerror "Please file a bug about this"
169 + eend $?
170 + done
171 + fi
172 +
173 + # Fix conflicts with newer glibc #272594
174 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
175 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
176 + fi
177 +
178 + # Apply things from PATCHES and user dirs
179 + default
180 +
181 + # Run misc portage update scripts
182 + gnuconfig_update
183 + elibtoolize --portage --no-uclibc
184 +}
185 +
186 +toolchain-binutils_bugurl() {
187 + printf "https://bugs.gentoo.org/"
188 +}
189 +toolchain-binutils_pkgversion() {
190 + printf "Gentoo ${PV}"
191 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
192 +}
193 +
194 +src_configure() {
195 + # Setup some paths
196 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
197 + INCPATH=${LIBPATH}/include
198 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
199 + if is_cross ; then
200 + TOOLPATH=/usr/${CHOST}/${CTARGET}
201 + else
202 + TOOLPATH=/usr/${CTARGET}
203 + fi
204 + BINPATH=${TOOLPATH}/binutils-bin/${PV}
205 +
206 + # Make sure we filter $LINGUAS so that only ones that
207 + # actually work make it through #42033
208 + strip-linguas -u */po
209 +
210 + # Keep things sane
211 + strip-flags
212 +
213 + local x
214 + echo
215 + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
216 + einfo "$(printf '%10s' ${x}:) ${!x}"
217 + done
218 + echo
219 +
220 + cd "${MY_BUILDDIR}"
221 + local myconf=()
222 +
223 + if use plugins ; then
224 + myconf+=( --enable-plugins )
225 + fi
226 + # enable gold (installed as ld.gold) and ld's plugin architecture
227 + if use gold ; then
228 + myconf+=( --enable-gold )
229 + if use default-gold; then
230 + myconf+=( --enable-gold=default )
231 + fi
232 + fi
233 +
234 + if use nls ; then
235 + myconf+=( --without-included-gettext )
236 + else
237 + myconf+=( --disable-nls )
238 + fi
239 +
240 + myconf+=( --with-system-zlib )
241 +
242 + # For bi-arch systems, enable a 64bit bfd. This matches
243 + # the bi-arch logic in toolchain.eclass. #446946
244 + # We used to do it for everyone, but it's slow on 32bit arches. #438522
245 + case $(tc-arch) in
246 + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
247 + esac
248 +
249 + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
250 +
251 + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
252 +
253 + is_cross && myconf+=(
254 + --with-sysroot="${EPREFIX}"/usr/${CTARGET}
255 + --enable-poison-system-directories
256 + )
257 +
258 + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
259 + # on everyone in alpha (for now), we'll just enable it when possible
260 + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
261 + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
262 +
263 + # mips can't do hash-style=gnu ...
264 + if [[ $(tc-arch) != mips ]] ; then
265 + myconf+=( --enable-default-hash-style=gnu )
266 + fi
267 +
268 + myconf+=(
269 + --prefix="${EPREFIX}"/usr
270 + --host=${CHOST}
271 + --target=${CTARGET}
272 + --datadir="${EPREFIX}"${DATAPATH}
273 + --datarootdir="${EPREFIX}"${DATAPATH}
274 + --infodir="${EPREFIX}"${DATAPATH}/info
275 + --mandir="${EPREFIX}"${DATAPATH}/man
276 + --bindir="${EPREFIX}"${BINPATH}
277 + --libdir="${EPREFIX}"${LIBPATH}
278 + --libexecdir="${EPREFIX}"${LIBPATH}
279 + --includedir="${EPREFIX}"${INCPATH}
280 + --enable-obsolete
281 + --enable-shared
282 + --enable-threads
283 + # Newer versions (>=2.27) offer a configure flag now.
284 + --enable-relro
285 + # Newer versions (>=2.24) make this an explicit option. #497268
286 + --enable-install-libiberty
287 + --disable-werror
288 + --with-bugurl="$(toolchain-binutils_bugurl)"
289 + --with-pkgversion="$(toolchain-binutils_pkgversion)"
290 + $(use_enable static-libs static)
291 + ${EXTRA_ECONF}
292 + # Disable modules that are in a combined binutils/gdb tree. #490566
293 + --disable-{gdb,libdecnumber,readline,sim}
294 + # Strip out broken static link flags.
295 + # https://gcc.gnu.org/PR56750
296 + --without-stage1-ldflags
297 + # Change SONAME to avoid conflict across
298 + # {native,cross}/binutils, binutils-libs. #666100
299 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
300 + )
301 + echo ./configure "${myconf[@]}"
302 + "${S}"/configure "${myconf[@]}" || die
303 +
304 + # Prevent makeinfo from running if doc is unset.
305 + if ! use doc ; then
306 + sed -i \
307 + -e '/^MAKEINFO/s:=.*:= true:' \
308 + Makefile || die
309 + fi
310 +}
311 +
312 +src_compile() {
313 + cd "${MY_BUILDDIR}"
314 + # see Note [tooldir hack for ldscripts]
315 + emake tooldir="${EPREFIX}${TOOLPATH}" all
316 +
317 + # only build info pages if the user wants them
318 + if use doc ; then
319 + emake info
320 + fi
321 +
322 + # we nuke the manpages when we're left with junk
323 + # (like when we bootstrap, no perl -> no manpages)
324 + find . -name '*.1' -a -size 0 -delete
325 +}
326 +
327 +src_test() {
328 + cd "${MY_BUILDDIR}"
329 +
330 + # bug 637066
331 + filter-flags -Wall -Wreturn-type
332 +
333 + emake -k check
334 +}
335 +
336 +src_install() {
337 + local x d
338 +
339 + cd "${MY_BUILDDIR}"
340 + # see Note [tooldir hack for ldscripts]
341 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
342 + rm -rf "${ED}"/${LIBPATH}/bin
343 + use static-libs || find "${ED}" -name '*.la' -delete
344 +
345 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
346 + cd "${ED}"/${LIBPATH}
347 + for d in ../* ; do
348 + [[ ${d} == ../${PV} ]] && continue
349 + mv ${d}/* . || die
350 + rmdir ${d} || die
351 + done
352 +
353 + # Now we collect everything intp the proper SLOT-ed dirs
354 + # When something is built to cross-compile, it installs into
355 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
356 + if is_cross ; then
357 + cd "${ED}"/${BINPATH}
358 + for x in * ; do
359 + mv ${x} ${x/${CTARGET}-}
360 + done
361 +
362 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
363 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
364 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
365 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
366 + fi
367 + fi
368 + insinto ${INCPATH}
369 + local libiberty_headers=(
370 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
371 + demangle.h
372 + dyn-string.h
373 + fibheap.h
374 + hashtab.h
375 + libiberty.h
376 + objalloc.h
377 + splay-tree.h
378 + )
379 + doins "${libiberty_headers[@]/#/${S}/include/}"
380 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
381 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
382 + rm -r "${ED}"/${LIBPATH}/lib
383 + fi
384 +
385 + # Generate an env.d entry for this binutils
386 + insinto /etc/env.d/binutils
387 + cat <<-EOF > "${T}"/env.d
388 + TARGET="${CTARGET}"
389 + VER="${PV}"
390 + LIBPATH="${EPREFIX}${LIBPATH}"
391 + EOF
392 + newins "${T}"/env.d ${CTARGET}-${PV}
393 +
394 + # Handle documentation
395 + if ! is_cross ; then
396 + cd "${S}"
397 + dodoc README
398 + docinto bfd
399 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
400 + docinto binutils
401 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
402 + docinto gas
403 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
404 + docinto gprof
405 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
406 + docinto ld
407 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
408 + docinto libiberty
409 + dodoc libiberty/ChangeLog* libiberty/README
410 + docinto opcodes
411 + dodoc opcodes/ChangeLog*
412 + fi
413 +
414 + # Remove shared info pages
415 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
416 +
417 + # Trim all empty dirs
418 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
419 +}
420 +
421 +pkg_postinst() {
422 + # Make sure this ${CTARGET} has a binutils version selected
423 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
424 + binutils-config ${CTARGET}-${PV}
425 +}
426 +
427 +pkg_postrm() {
428 + local current_profile=$(binutils-config -c ${CTARGET})
429 +
430 + # If no other versions exist, then uninstall for this
431 + # target ... otherwise, switch to the newest version
432 + # Note: only do this if this version is unmerged. We
433 + # rerun binutils-config if this is a remerge, as
434 + # we want the mtimes on the symlinks updated (if
435 + # it is the same as the current selected profile)
436 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
437 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
438 + choice=${choice//$'\n'/ }
439 + choice=${choice/* }
440 + if [[ -z ${choice} ]] ; then
441 + binutils-config -u ${CTARGET}
442 + else
443 + binutils-config ${choice}
444 + fi
445 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
446 + binutils-config ${CTARGET}-${PV}
447 + fi
448 +}
449 +
450 +# Note [slotting support]
451 +# -----------------------
452 +# Gentoo's layout for binutils files is non-standard as Gentoo
453 +# supports slotted installation for binutils. Many tools
454 +# still expect binutils to reside in known locations.
455 +# binutils-config package restores symlinks into known locations,
456 +# like:
457 +# /usr/bin/${CTARGET}-<tool>
458 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
459 +# /usr/include/
460 +#
461 +# Note [tooldir hack for ldscripts]
462 +# ---------------------------------
463 +# Build system does not allow ./configure to tweak every location
464 +# we need for slotting binutils hence all the shuffling in
465 +# src_install(). This note is about SCRIPTDIR define handling.
466 +#
467 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
468 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
469 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
470 +# Thus we can't just move files around after compilation finished.
471 +#
472 +# Our goal is the following:
473 +# - at build-time set scriptdir to point to symlinked location:
474 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
475 +# - at install-time set scriptdir to point to slotted location:
476 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}