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