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, 30 Oct 2020 21:45:47
Message-Id: 1604094320.a7067c3c19ddc3b38b69195cf06dc4de5ef855ab.dilfridge@gentoo
1 commit: a7067c3c19ddc3b38b69195cf06dc4de5ef855ab
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 30 21:42:08 2020 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 30 21:45:20 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7067c3c
7
8 sys-devel/binutils: 2.35.1 patchset bump
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.2
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.35.1-r1.ebuild | 437 +++++++++++++++++++++++++++
15 2 files changed, 438 insertions(+)
16
17 diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
18 index 3d995073da3..1c4e8ce1c45 100644
19 --- a/sys-devel/binutils/Manifest
20 +++ b/sys-devel/binutils/Manifest
21 @@ -6,4 +6,5 @@ DIST binutils-2.33.1.tar.xz 21490848 BLAKE2B c336a8412938dc8c224f40a763a8bea9937
22 DIST binutils-2.34-patches-6.tar.xz 103028 BLAKE2B d0e866d0941d2b550c7d7f23530c6ee393fa13b4f2f27832f07790989476f11d1beddb5ad5a9be5c65c1d4dff9d4598d21adcb00c1d0490f69a99127f4527447 SHA512 e05ed8886acb5cb95a3e97c5bc0564215f7d44b604610f5c4545997fd9625d6de909c37063127e819926cd1548a48d3529dd3e82e98ee6a5dbaced028c57355d
23 DIST binutils-2.34.tar.xz 21637796 BLAKE2B 07dd23916a7d27f71c3f160c8c16abe2bd4fce294c738c665a012a3be6a87dbe8160d0c38740524f9025e01d438e99b2a94bcf9f9f79ee214f5dd033de8aad3d SHA512 2c7976939dcf5e8c5b7374cccd39bfe803b1bec73c6abfa0eb17c24e1942574c6bdb874c66a092a82adc443182eacd8a5a8001c19a76101f0c7ba40c27de0bbd
24 DIST binutils-2.35.1-patches-1.tar.xz 10088 BLAKE2B fa4b0c417b6452757f90243921c60b2406c9bf60d1aaa393654fb23ce52e32fb3e7ed90f6d59286786dd95398a10d008c75bfdca065d704025cc828ff65b225f SHA512 dccb4407f4f2a8b38488f9f42638c10777ee344239cf5d4fcc8f580df3e8ff15d03211dc51ef18d905c326a71771da4b38f47381d6d549422a8353b5da0e7b0b
25 +DIST binutils-2.35.1-patches-2.tar.xz 72236 BLAKE2B 584cb3edbda28c69171ed64e941535f992150d86f25201cadd07b63daaa36bf76b07dc0aa8a4837da17d1672feb47a7b15f83efdeec5409e695965a10142147a SHA512 b704ebe82c4402f058f9c96991a89256a6b369d28f844bf020ed2c77766894d9a2ca0596cd609de7b389fa8cd52bfab674b6deb10ea2096e50aa57921be2083e
26 DIST binutils-2.35.1.tar.xz 22031720 BLAKE2B d3468da90b75e9b5fa7fbd64d3fdb0a4bc445e4cb7da5ae058f73a1e9d948b3e9438bc9f1b5b351db369b76a25960c9c1f58f828fd2c7646f555de45fa3c052b SHA512 94ff72708403413b70b247f3af4099ebaa882b6659249869f1ed9941a0f1912e313f08357d470f9fd2359e7f5e5b0eb86285e5eaf883fa8187789d6b1bd304eb
27
28 diff --git a/sys-devel/binutils/binutils-2.35.1-r1.ebuild b/sys-devel/binutils/binutils-2.35.1-r1.ebuild
29 new file mode 100644
30 index 00000000000..03297128b67
31 --- /dev/null
32 +++ b/sys-devel/binutils/binutils-2.35.1-r1.ebuild
33 @@ -0,0 +1,437 @@
34 +# Copyright 1999-2020 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
40 +
41 +DESCRIPTION="Tools necessary to build programs"
42 +HOMEPAGE="https://sourceware.org/binutils/"
43 +LICENSE="GPL-3+"
44 +IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test vanilla"
45 +REQUIRED_USE="default-gold? ( gold )"
46 +
47 +# Variables that can be set here (ignored for live ebuilds)
48 +# PATCH_VER - the patchset version
49 +# Default: empty, no patching
50 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
51 +# - Default: PV
52 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
53 +# for the patchsets
54 +
55 +PATCH_VER=2
56 +PATCH_DEV=dilfridge
57 +
58 +if [[ ${PV} == 9999* ]]; then
59 + inherit git-r3
60 + SLOT=${PV}
61 +else
62 + PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
63 + PATCH_DEV=${PATCH_DEV:-slyfox}
64 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
65 + [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
66 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
67 + SLOT=$(ver_cut 1-2)
68 + # live ebuild
69 + #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
70 +fi
71 +
72 +#
73 +# The cross-compile logic
74 +#
75 +export CTARGET=${CTARGET:-${CHOST}}
76 +if [[ ${CTARGET} == ${CHOST} ]] ; then
77 + if [[ ${CATEGORY} == cross-* ]] ; then
78 + export CTARGET=${CATEGORY#cross-}
79 + fi
80 +fi
81 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
82 +
83 +#
84 +# The dependencies
85 +#
86 +RDEPEND="
87 + >=sys-devel/binutils-config-3
88 + sys-libs/zlib
89 +"
90 +DEPEND="${RDEPEND}"
91 +BDEPEND="
92 + doc? ( sys-apps/texinfo )
93 + test? ( dev-util/dejagnu )
94 + nls? ( sys-devel/gettext )
95 + sys-devel/flex
96 + virtual/yacc
97 +"
98 +
99 +RESTRICT="!test? ( test )"
100 +
101 +MY_BUILDDIR=${WORKDIR}/build
102 +
103 +src_unpack() {
104 + if [[ ${PV} == 9999* ]] ; then
105 + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
106 + EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
107 + git-r3_src_unpack
108 + mv patches-git/9999 patch || die
109 +
110 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
111 + S=${WORKDIR}/binutils
112 + EGIT_CHECKOUT_DIR=${S}
113 + git-r3_src_unpack
114 + else
115 + unpack ${P}.tar.xz
116 +
117 + cd "${WORKDIR}" || die
118 + unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz
119 + fi
120 +
121 + cd "${WORKDIR}" || die
122 + mkdir -p "${MY_BUILDDIR}" || die
123 +}
124 +
125 +src_prepare() {
126 + local patchsetname
127 + if [[ ${PV} == 9999* ]] ; then
128 + patchsetname="from git master"
129 + else
130 + patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}"
131 + fi
132 +
133 + if [[ ! -z ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then
134 + if ! use vanilla; then
135 + einfo "Applying binutils patchset ${patchsetname}"
136 + eapply "${WORKDIR}/patch"
137 + einfo "Done."
138 + fi
139 + fi
140 +
141 + # This check should probably go somewhere else, like pkg_pretend.
142 + if [[ ${CTARGET} == *-uclibc* ]] ; then
143 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
144 + die "sorry, but this binutils doesn't yet support uClibc :("
145 + fi
146 + fi
147 +
148 + # Make sure our explicit libdir paths don't get clobbered. #562460
149 + sed -i \
150 + -e 's:@bfdlibdir@:@libdir@:g' \
151 + -e 's:@bfdincludedir@:@includedir@:g' \
152 + {bfd,opcodes}/Makefile.in || die
153 +
154 + # Fix locale issues if possible #122216
155 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
156 + einfo "Fixing misc issues in configure files"
157 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
158 + ebegin " Updating ${f/${S}\/}"
159 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
160 + || eerror "Please file a bug about this"
161 + eend $?
162 + done
163 + fi
164 +
165 + # Fix conflicts with newer glibc #272594
166 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
167 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
168 + fi
169 +
170 + # Apply things from PATCHES and user dirs
171 + default
172 +
173 + # Run misc portage update scripts
174 + gnuconfig_update
175 + elibtoolize --portage --no-uclibc
176 +}
177 +
178 +toolchain-binutils_bugurl() {
179 + printf "https://bugs.gentoo.org/"
180 +}
181 +toolchain-binutils_pkgversion() {
182 + printf "Gentoo ${PV}"
183 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
184 +}
185 +
186 +src_configure() {
187 + # Setup some paths
188 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
189 + INCPATH=${LIBPATH}/include
190 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
191 + if is_cross ; then
192 + TOOLPATH=/usr/${CHOST}/${CTARGET}
193 + else
194 + TOOLPATH=/usr/${CTARGET}
195 + fi
196 + BINPATH=${TOOLPATH}/binutils-bin/${PV}
197 +
198 + # Make sure we filter $LINGUAS so that only ones that
199 + # actually work make it through #42033
200 + strip-linguas -u */po
201 +
202 + # Keep things sane
203 + strip-flags
204 +
205 + local x
206 + echo
207 + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
208 + einfo "$(printf '%10s' ${x}:) ${!x}"
209 + done
210 + echo
211 +
212 + cd "${MY_BUILDDIR}"
213 + local myconf=()
214 +
215 + if use plugins ; then
216 + myconf+=( --enable-plugins )
217 + fi
218 + # enable gold (installed as ld.gold) and ld's plugin architecture
219 + if use gold ; then
220 + myconf+=( --enable-gold )
221 + if use default-gold; then
222 + myconf+=( --enable-gold=default )
223 + fi
224 + fi
225 +
226 + if use nls ; then
227 + myconf+=( --without-included-gettext )
228 + else
229 + myconf+=( --disable-nls )
230 + fi
231 +
232 + myconf+=( --with-system-zlib )
233 +
234 + # For bi-arch systems, enable a 64bit bfd. This matches
235 + # the bi-arch logic in toolchain.eclass. #446946
236 + # We used to do it for everyone, but it's slow on 32bit arches. #438522
237 + case $(tc-arch) in
238 + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
239 + esac
240 +
241 + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
242 +
243 + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
244 +
245 + is_cross && myconf+=(
246 + --with-sysroot="${EPREFIX}"/usr/${CTARGET}
247 + --enable-poison-system-directories
248 + )
249 +
250 + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
251 + # on everyone in alpha (for now), we'll just enable it when possible
252 + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
253 + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
254 +
255 + # mips can't do hash-style=gnu ...
256 + if [[ $(tc-arch) != mips ]] ; then
257 + myconf+=( --enable-default-hash-style=gnu )
258 + fi
259 +
260 + myconf+=(
261 + --prefix="${EPREFIX}"/usr
262 + --host=${CHOST}
263 + --target=${CTARGET}
264 + --datadir="${EPREFIX}"${DATAPATH}
265 + --datarootdir="${EPREFIX}"${DATAPATH}
266 + --infodir="${EPREFIX}"${DATAPATH}/info
267 + --mandir="${EPREFIX}"${DATAPATH}/man
268 + --bindir="${EPREFIX}"${BINPATH}
269 + --libdir="${EPREFIX}"${LIBPATH}
270 + --libexecdir="${EPREFIX}"${LIBPATH}
271 + --includedir="${EPREFIX}"${INCPATH}
272 + --enable-obsolete
273 + --enable-shared
274 + --enable-threads
275 + # Newer versions (>=2.27) offer a configure flag now.
276 + --enable-relro
277 + # Newer versions (>=2.24) make this an explicit option. #497268
278 + --enable-install-libiberty
279 + # Available from 2.35 on
280 + --enable-textrel-check=warning
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}