Gentoo Archives: gentoo-commits

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