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