Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-devel/binutils/
Date: Sat, 25 Apr 2020 03:07:18
Message-Id: 1587784020.8b739f64206b56e191d870250d124c28d6717b1b.anarchy@gentoo
1 commit: 8b739f64206b56e191d870250d124c28d6717b1b
2 Author: Jory Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 25 02:58:07 2020 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 25 03:07:00 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=8b739f64
7
8 sys-devel/binutils: add stable with 2MB stack size for musl users
9
10 Package-Manager: Portage-2.3.89, Repoman-2.3.20
11 Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>
12
13 sys-devel/binutils/Manifest | 2 +
14 sys-devel/binutils/binutils-2.33.1-r1.ebuild | 439 +++++++++++++++++++++++++++
15 2 files changed, 441 insertions(+)
16
17 diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
18 index 7cea121..6a78d89 100644
19 --- a/sys-devel/binutils/Manifest
20 +++ b/sys-devel/binutils/Manifest
21 @@ -1,2 +1,4 @@
22 +DIST binutils-2.33.1-patches-2.tar.xz 18636 BLAKE2B 0e0757329b6a83aeff4f4c450c95e73fd48fcc89f83e63f294568632bee0972552cf2f57494352c5d9a7c16a51cdbc4108b38fa6028d4388c8e76046b3da9212 SHA512 d982f68d1f5fdb384309a2a1b7426bf840a90e7a85b37229b4223b62c36cab9dd9ec0c08382c85c68adf996dec21133df3180a2fc649363adae8645f8282f71d
23 +DIST binutils-2.33.1.tar.xz 21490848 BLAKE2B c336a8412938dc8c224f40a763a8bea9937cca0462a8fb80e62f14aabe590107fc061a3f4b9327e1f4652cb026384d36a91b4766d4d469d2d0680932874b638c SHA512 b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac
24 DIST binutils-2.34-patches-1.tar.xz 20388 BLAKE2B 8828505f62259a307de445357320827e7f6bc416a7f4c72140add505f62eef3928c7daec13be158b52c2a7a1d989f539025e4be6ec27ef80ede81477a42c5042 SHA512 951dffcc30ad5706dc48e71995217655c5d96472446ab66a357f19486b57d1868143a9809887eab7ba8c42c33124f8b37d3bab6618388ea8a08b4399d348a645
25 DIST binutils-2.34.tar.xz 21637796 BLAKE2B 07dd23916a7d27f71c3f160c8c16abe2bd4fce294c738c665a012a3be6a87dbe8160d0c38740524f9025e01d438e99b2a94bcf9f9f79ee214f5dd033de8aad3d SHA512 2c7976939dcf5e8c5b7374cccd39bfe803b1bec73c6abfa0eb17c24e1942574c6bdb874c66a092a82adc443182eacd8a5a8001c19a76101f0c7ba40c27de0bbd
26
27 diff --git a/sys-devel/binutils/binutils-2.33.1-r1.ebuild b/sys-devel/binutils/binutils-2.33.1-r1.ebuild
28 new file mode 100644
29 index 0000000..49473ad
30 --- /dev/null
31 +++ b/sys-devel/binutils/binutils-2.33.1-r1.ebuild
32 @@ -0,0 +1,439 @@
33 +# Copyright 1999-2020 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=7
37 +
38 +inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
39 +
40 +DESCRIPTION="Tools necessary to build programs"
41 +HOMEPAGE="https://sourceware.org/binutils/"
42 +LICENSE="GPL-3+"
43 +IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test"
44 +REQUIRED_USE="default-gold? ( gold )"
45 +
46 +# Variables that can be set here:
47 +# PATCH_VER - the patchset version
48 +# Default: empty, no patching
49 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
50 +# - Default: PV
51 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
52 +# for the patchsets
53 +
54 +PATCH_VER=2
55 +PATCH_DEV=slyfox
56 +
57 +case ${PV} in
58 + 9999)
59 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
60 + inherit git-r3
61 + S=${WORKDIR}/binutils
62 + EGIT_CHECKOUT_DIR=${S}
63 + SLOT=${PV}
64 + ;;
65 + *.9999)
66 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
67 + inherit git-r3
68 + S=${WORKDIR}/binutils
69 + EGIT_CHECKOUT_DIR=${S}
70 + EGIT_BRANCH=$(ver_cut 1-2)
71 + EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
72 + SLOT=$(ver_cut 1-2)
73 + ;;
74 + *)
75 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
76 + SLOT=$(ver_cut 1-2)
77 + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
78 + ;;
79 +esac
80 +
81 +#
82 +# The Gentoo patchset
83 +#
84 +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
85 +PATCH_DEV=${PATCH_DEV:-slyfox}
86 +
87 +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
88 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
89 +
90 +#
91 +# The cross-compile logic
92 +#
93 +export CTARGET=${CTARGET:-${CHOST}}
94 +if [[ ${CTARGET} == ${CHOST} ]] ; then
95 + if [[ ${CATEGORY} == cross-* ]] ; then
96 + export CTARGET=${CATEGORY#cross-}
97 + fi
98 +fi
99 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
100 +
101 +#
102 +# The dependencies
103 +#
104 +RDEPEND="
105 + >=sys-devel/binutils-config-3
106 + sys-libs/zlib
107 +"
108 +DEPEND="${RDEPEND}
109 + doc? ( sys-apps/texinfo )
110 + test? ( dev-util/dejagnu )
111 + nls? ( sys-devel/gettext )
112 + sys-devel/flex
113 + virtual/yacc
114 +"
115 +
116 +RESTRICT="!test? ( test )"
117 +
118 +PATCHES=(
119 + "${FILESDIR}"/${PN}-2.33-gcc-10.patch
120 +)
121 +
122 +MY_BUILDDIR=${WORKDIR}/build
123 +
124 +src_unpack() {
125 + case ${PV} in
126 + *9999)
127 + git-r3_src_unpack
128 + ;;
129 + *)
130 + ;;
131 + esac
132 + default
133 + mkdir -p "${MY_BUILDDIR}"
134 +}
135 +
136 +src_prepare() {
137 + if [[ ! -z ${PATCH_VER} ]] ; then
138 + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
139 + eapply "${WORKDIR}/patch"/*.patch
140 + fi
141 +
142 + # This check should probably go somewhere else, like pkg_pretend.
143 + if [[ ${CTARGET} == *-uclibc* ]] ; then
144 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
145 + die "sorry, but this binutils doesn't yet support uClibc :("
146 + fi
147 + fi
148 +
149 + # Make sure our explicit libdir paths don't get clobbered. #562460
150 + sed -i \
151 + -e 's:@bfdlibdir@:@libdir@:g' \
152 + -e 's:@bfdincludedir@:@includedir@:g' \
153 + {bfd,opcodes}/Makefile.in || die
154 +
155 + # Fix locale issues if possible #122216
156 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
157 + einfo "Fixing misc issues in configure files"
158 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
159 + ebegin " Updating ${f/${S}\/}"
160 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
161 + || eerror "Please file a bug about this"
162 + eend $?
163 + done
164 + fi
165 +
166 + # Fix conflicts with newer glibc #272594
167 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
168 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
169 + fi
170 +
171 + # Apply things from PATCHES and user dirs
172 + default
173 +
174 + # Run misc portage update scripts
175 + gnuconfig_update
176 + elibtoolize --portage --no-uclibc
177 +}
178 +
179 +toolchain-binutils_bugurl() {
180 + printf "https://bugs.gentoo.org/"
181 +}
182 +toolchain-binutils_pkgversion() {
183 + printf "Gentoo ${PV}"
184 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
185 +}
186 +
187 +src_configure() {
188 + # Setup some paths
189 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
190 + INCPATH=${LIBPATH}/include
191 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
192 + if is_cross ; then
193 + TOOLPATH=/usr/${CHOST}/${CTARGET}
194 + else
195 + TOOLPATH=/usr/${CTARGET}
196 + fi
197 + BINPATH=${TOOLPATH}/binutils-bin/${PV}
198 +
199 + # Make sure we filter $LINGUAS so that only ones that
200 + # actually work make it through #42033
201 + strip-linguas -u */po
202 +
203 + # Keep things sane
204 + strip-flags
205 +
206 + use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152
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 + --disable-werror
283 + --with-bugurl="$(toolchain-binutils_bugurl)"
284 + --with-pkgversion="$(toolchain-binutils_pkgversion)"
285 + $(use_enable static-libs static)
286 + ${EXTRA_ECONF}
287 + # Disable modules that are in a combined binutils/gdb tree. #490566
288 + --disable-{gdb,libdecnumber,readline,sim}
289 + # Strip out broken static link flags.
290 + # https://gcc.gnu.org/PR56750
291 + --without-stage1-ldflags
292 + # Change SONAME to avoid conflict across
293 + # {native,cross}/binutils, binutils-libs. #666100
294 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
295 + )
296 + echo ./configure "${myconf[@]}"
297 + "${S}"/configure "${myconf[@]}" || die
298 +
299 + # Prevent makeinfo from running if doc is unset.
300 + if ! use doc ; then
301 + sed -i \
302 + -e '/^MAKEINFO/s:=.*:= true:' \
303 + Makefile || die
304 + fi
305 +}
306 +
307 +src_compile() {
308 + cd "${MY_BUILDDIR}"
309 + # see Note [tooldir hack for ldscripts]
310 + emake tooldir="${EPREFIX}${TOOLPATH}" all
311 +
312 + # only build info pages if the user wants them
313 + if use doc ; then
314 + emake info
315 + fi
316 +
317 + # we nuke the manpages when we're left with junk
318 + # (like when we bootstrap, no perl -> no manpages)
319 + find . -name '*.1' -a -size 0 -delete
320 +}
321 +
322 +src_test() {
323 + cd "${MY_BUILDDIR}"
324 +
325 + # bug 637066
326 + filter-flags -Wall -Wreturn-type
327 +
328 + emake -k check
329 +}
330 +
331 +src_install() {
332 + local x d
333 +
334 + cd "${MY_BUILDDIR}"
335 + # see Note [tooldir hack for ldscripts]
336 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
337 + rm -rf "${ED}"/${LIBPATH}/bin
338 + use static-libs || find "${ED}" -name '*.la' -delete
339 +
340 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
341 + cd "${ED}"/${LIBPATH}
342 + for d in ../* ; do
343 + [[ ${d} == ../${PV} ]] && continue
344 + mv ${d}/* . || die
345 + rmdir ${d} || die
346 + done
347 +
348 + # Now we collect everything intp the proper SLOT-ed dirs
349 + # When something is built to cross-compile, it installs into
350 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
351 + if is_cross ; then
352 + cd "${ED}"/${BINPATH}
353 + for x in * ; do
354 + mv ${x} ${x/${CTARGET}-}
355 + done
356 +
357 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
358 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
359 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
360 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
361 + fi
362 + fi
363 + insinto ${INCPATH}
364 + local libiberty_headers=(
365 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
366 + demangle.h
367 + dyn-string.h
368 + fibheap.h
369 + hashtab.h
370 + libiberty.h
371 + objalloc.h
372 + splay-tree.h
373 + )
374 + doins "${libiberty_headers[@]/#/${S}/include/}"
375 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
376 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
377 + rm -r "${ED}"/${LIBPATH}/lib
378 + fi
379 +
380 + # Generate an env.d entry for this binutils
381 + insinto /etc/env.d/binutils
382 + cat <<-EOF > "${T}"/env.d
383 + TARGET="${CTARGET}"
384 + VER="${PV}"
385 + LIBPATH="${EPREFIX}${LIBPATH}"
386 + EOF
387 + newins "${T}"/env.d ${CTARGET}-${PV}
388 +
389 + # Handle documentation
390 + if ! is_cross ; then
391 + cd "${S}"
392 + dodoc README
393 + docinto bfd
394 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
395 + docinto binutils
396 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
397 + docinto gas
398 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
399 + docinto gprof
400 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
401 + docinto ld
402 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
403 + docinto libiberty
404 + dodoc libiberty/ChangeLog* libiberty/README
405 + docinto opcodes
406 + dodoc opcodes/ChangeLog*
407 + fi
408 +
409 + # Remove shared info pages
410 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
411 +
412 + # Trim all empty dirs
413 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
414 +}
415 +
416 +pkg_postinst() {
417 + # Make sure this ${CTARGET} has a binutils version selected
418 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
419 + binutils-config ${CTARGET}-${PV}
420 +}
421 +
422 +pkg_postrm() {
423 + local current_profile=$(binutils-config -c ${CTARGET})
424 +
425 + # If no other versions exist, then uninstall for this
426 + # target ... otherwise, switch to the newest version
427 + # Note: only do this if this version is unmerged. We
428 + # rerun binutils-config if this is a remerge, as
429 + # we want the mtimes on the symlinks updated (if
430 + # it is the same as the current selected profile)
431 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
432 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
433 + choice=${choice//$'\n'/ }
434 + choice=${choice/* }
435 + if [[ -z ${choice} ]] ; then
436 + binutils-config -u ${CTARGET}
437 + else
438 + binutils-config ${choice}
439 + fi
440 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
441 + binutils-config ${CTARGET}-${PV}
442 + fi
443 +}
444 +
445 +# Note [slotting support]
446 +# -----------------------
447 +# Gentoo's layout for binutils files is non-standard as Gentoo
448 +# supports slotted installation for binutils. Many tools
449 +# still expect binutils to reside in known locations.
450 +# binutils-config package restores symlinks into known locations,
451 +# like:
452 +# /usr/bin/${CTARGET}-<tool>
453 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
454 +# /usr/include/
455 +#
456 +# Note [tooldir hack for ldscripts]
457 +# ---------------------------------
458 +# Build system does not allow ./configure to tweak every location
459 +# we need for slotting binutils hence all the shuffling in
460 +# src_install(). This note is about SCRIPTDIR define handling.
461 +#
462 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
463 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
464 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
465 +# Thus we can't just move files around after compilation finished.
466 +#
467 +# Our goal is the following:
468 +# - at build-time set scriptdir to point to symlinked location:
469 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
470 +# - at install-time set scriptdir to point to slotted location:
471 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}