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