Gentoo Archives: gentoo-commits

From: Michael Haubenwallner <haubi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils/
Date: Thu, 04 Oct 2018 11:46:06
Message-Id: 1538653534.743a6c48a754a71890bfb723cd394ccbe2eb1f1c.haubi@gentoo
1 commit: 743a6c48a754a71890bfb723cd394ccbe2eb1f1c
2 Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 4 11:45:34 2018 +0000
4 Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 4 11:45:34 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=743a6c48
7
8 sys-devel/binutils: sync
9
10 Package-Manager: Portage-2.3.40.3-prefix, Repoman-2.3.9
11 RepoMan-Options: --force
12
13 sys-devel/binutils/Manifest | 2 +
14 sys-devel/binutils/binutils-2.31.1-r1.ebuild | 449 +++++++++++++++++++++++++++
15 2 files changed, 451 insertions(+)
16
17 diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
18 index f5bc42ca16..8e9fc88f0c 100644
19 --- a/sys-devel/binutils/Manifest
20 +++ b/sys-devel/binutils/Manifest
21 @@ -4,3 +4,5 @@ DIST binutils-2.28.1-patches-1.0.tar.xz 19772 BLAKE2B 146b393b49ba868c7c064c5827
22 DIST binutils-2.28.1.tar.bz2 28120394 BLAKE2B 3a0ed2bcf0c859638546b7460d9e6f0a55518402ff0c65c90ce462a318f5ae6690961616d188ce6cf0271c9f2fb8b7902782d32cf0e711068c53d3d06956d89e SHA512 5ec5212497b0fa8324f6a0884c284cb71c01942bbd39356d1ae745a5c9d97274c10f9d9c723f4bef6f0217662dfcd0c36e4e955a7599b11217658dc7b97553eb
23 DIST binutils-2.29.1-patches-3.tar.xz 20904 BLAKE2B 5549cb2412123e4ad3a13935762cc0dca46215950dbf38a149caf4c6416da382a0fd7ecffe97b10bce4dfdcef5edc2673d49bb21e9d37be37e33b454a8c2bc1a SHA512 ba54efaf9e9f668d2922972acd2cdf5c3e6f174cfcc73d29953ab4ba6e157ce0cb500c583568a4e3baaaa92c9d30c394a327f29b51292acc66f8d3f20f5eae2a
24 DIST binutils-2.29.1.tar.bz2 29123355 BLAKE2B 83de518a27bae0f13c57b1979493dd7f7cabae424cff5e8495d1f064da24b6ef9e1c19d1d1adad2dca7142372782023f66b4b4223170a49b96ba3834266fe878 SHA512 4063d34555526922376ccceb3f14b43e287442e82a8038cf50f4f51ad97d438c672c0e310ca4b856c9aff5aa9911073e256e8298a7a3f1844eeb60b90d955592
25 +DIST binutils-2.31.1-patches-3.tar.xz 12640 BLAKE2B 3444b219dd02ad513e6c36214d649a8a74638382103c88ec8de76a579be0ee13f8d1450e3b8d82dfddad55f2f851b32aee910a99230c7d8673f8426fc79a4cd9 SHA512 67b23c17518305561d190a15cba4a1af18a0a3cf1d7e62583ac7667d2fa40e7c7ec024cc981009d5d1caf1939633ab55fc0a198b69af02dc7841be43ff1acd13
26 +DIST binutils-2.31.1.tar.xz 20467996 BLAKE2B 6b914df1fbb7cf54f2159f71b2c2b09f3f6a569b7a3cb4cf9790d0a3733a7548bc0ea32334a178ed3b56e8b97656ae99c7abaf212601beeaeae9a0884c0f6051 SHA512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30
27
28 diff --git a/sys-devel/binutils/binutils-2.31.1-r1.ebuild b/sys-devel/binutils/binutils-2.31.1-r1.ebuild
29 new file mode 100644
30 index 0000000000..ae9497d18b
31 --- /dev/null
32 +++ b/sys-devel/binutils/binutils-2.31.1-r1.ebuild
33 @@ -0,0 +1,449 @@
34 +# Copyright 1999-2018 Gentoo Foundation
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=6
38 +
39 +inherit eutils libtool flag-o-matic gnuconfig multilib versionator
40 +
41 +DESCRIPTION="Tools necessary to build programs"
42 +HOMEPAGE="https://sourceware.org/binutils/"
43 +LICENSE="GPL-3+"
44 +IUSE="+cxx doc multitarget +nls static-libs test"
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 +# Default: dilfridge :)
54 +
55 +PATCH_VER=3
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=$(get_version_component_range 1-2)
71 + EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
72 + SLOT=$(get_version_component_range 1-2)
73 + ;;
74 + *)
75 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
76 + SLOT=$(get_version_component_range 1-2)
77 + KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
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 +if is_cross ; then
116 + # The build assumes the host has libiberty and such when cross-compiling
117 + # its build tools. We should probably make binutils itself build a local
118 + # copy to use, but until then, be lazy.
119 + DEPEND+=" >=sys-libs/binutils-libs-${PV}"
120 +fi
121 +
122 +MY_BUILDDIR=${WORKDIR}/build
123 +
124 +# Additional patches to apply in default src_prepare
125 +PATCHES=(
126 + "${FILESDIR}"/${PN}-2.22-solaris-anonymous-version-script-fix.patch
127 + "${FILESDIR}"/${PN}-2.24-cygwin-nointl.patch
128 +)
129 +
130 +pkg_setup() {
131 + [[ ${CHOST} == *-mint* ]] && die "mint patches require rebasing to ${P}" # 609274
132 +}
133 +
134 +src_unpack() {
135 + case ${PV} in
136 + *9999)
137 + git-r3_src_unpack
138 + ;;
139 + *)
140 + ;;
141 + esac
142 + default
143 + mkdir -p "${MY_BUILDDIR}"
144 +}
145 +
146 +src_prepare() {
147 + if [[ ! -z ${PATCH_VER} ]] ; then
148 + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
149 + eapply "${WORKDIR}/patch"/*.patch
150 + fi
151 +
152 + # This check should probably go somewhere else, like pkg_pretend.
153 + if [[ ${CTARGET} == *-uclibc* ]] ; then
154 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
155 + die "sorry, but this binutils doesn't yet support uClibc :("
156 + fi
157 + fi
158 +
159 + # Make sure our explicit libdir paths don't get clobbered. #562460
160 + sed -i \
161 + -e 's:@bfdlibdir@:@libdir@:g' \
162 + -e 's:@bfdincludedir@:@includedir@:g' \
163 + {bfd,opcodes}/Makefile.in || die
164 +
165 + # Fix locale issues if possible #122216
166 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
167 + einfo "Fixing misc issues in configure files"
168 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
169 + ebegin " Updating ${f/${S}\/}"
170 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
171 + || eerror "Please file a bug about this"
172 + eend $?
173 + done
174 + fi
175 +
176 + # Fix conflicts with newer glibc #272594
177 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
178 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
179 + fi
180 +
181 + # Apply things from PATCHES and user dirs
182 + default
183 +
184 + # Run misc portage update scripts
185 + gnuconfig_update
186 + elibtoolize --portage --no-uclibc
187 +}
188 +
189 +toolchain-binutils_bugurl() {
190 + printf "https://bugs.gentoo.org/"
191 +}
192 +toolchain-binutils_pkgversion() {
193 + printf "Gentoo ${PV}"
194 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
195 +}
196 +
197 +src_configure() {
198 + # Setup some paths
199 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
200 + INCPATH=${LIBPATH}/include
201 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
202 + if is_cross ; then
203 + TOOLPATH=/usr/${CHOST}/${CTARGET}
204 + else
205 + TOOLPATH=/usr/${CTARGET}
206 + fi
207 + BINPATH=${TOOLPATH}/binutils-bin/${PV}
208 +
209 + # Make sure we filter $LINGUAS so that only ones that
210 + # actually work make it through #42033
211 + strip-linguas -u */po
212 +
213 + # Keep things sane
214 + strip-flags
215 +
216 + local x
217 + echo
218 + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
219 + einfo "$(printf '%10s' ${x}:) ${!x}"
220 + done
221 + echo
222 +
223 + cd "${MY_BUILDDIR}"
224 + local myconf=()
225 +
226 + # enable gold (installed as ld.gold) and ld's plugin architecture
227 + # PREFIX LOCAL: Linux only (fails to compile on Solaris, MiNT #353410)
228 + [[ ${CHOST} == *-linux* ]] &&
229 + if use cxx ; then
230 + myconf+=( --enable-gold )
231 + myconf+=( --enable-plugins )
232 + fi
233 +
234 + if use nls ; then
235 + myconf+=( --without-included-gettext )
236 + else
237 + myconf+=( --disable-nls )
238 + fi
239 +
240 + myconf+=( --with-system-zlib )
241 +
242 + # For bi-arch systems, enable a 64bit bfd. This matches
243 + # the bi-arch logic in toolchain.eclass. #446946
244 + # We used to do it for everyone, but it's slow on 32bit arches. #438522
245 + case $(tc-arch) in
246 + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
247 + esac
248 +
249 + [[ ${CHOST} == *"-solaris"* ]] && use nls && append-libs -lintl
250 +
251 + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
252 +
253 + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
254 +
255 + is_cross && myconf+=(
256 + --with-sysroot="${EPREFIX}"/usr/${CTARGET}
257 + --enable-poison-system-directories
258 + )
259 +
260 + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
261 + # on everyone in alpha (for now), we'll just enable it when possible
262 + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
263 + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
264 +
265 + # mips can't do hash-style=gnu ...
266 + if [[ $(tc-arch) != mips ]] ; then
267 + myconf+=( --enable-default-hash-style=gnu )
268 + fi
269 +
270 + myconf+=(
271 + --prefix="${EPREFIX}"/usr
272 + --host=${CHOST}
273 + --target=${CTARGET}
274 + --datadir="${EPREFIX}"${DATAPATH}
275 + --datarootdir="${EPREFIX}"${DATAPATH}
276 + --infodir="${EPREFIX}"${DATAPATH}/info
277 + --mandir="${EPREFIX}"${DATAPATH}/man
278 + --bindir="${EPREFIX}"${BINPATH}
279 + --libdir="${EPREFIX}"${LIBPATH}
280 + --libexecdir="${EPREFIX}"${LIBPATH}
281 + --includedir="${EPREFIX}"${INCPATH}
282 + --enable-obsolete
283 + --enable-shared
284 + --enable-threads
285 + # Newer versions (>=2.27) offer a configure flag now.
286 + --enable-relro
287 + # Newer versions (>=2.24) make this an explicit option. #497268
288 + --enable-install-libiberty
289 + --disable-werror
290 + --with-bugurl="$(toolchain-binutils_bugurl)"
291 + --with-pkgversion="$(toolchain-binutils_pkgversion)"
292 + $(use_enable static-libs static)
293 + ${EXTRA_ECONF}
294 + # Disable modules that are in a combined binutils/gdb tree. #490566
295 + --disable-{gdb,libdecnumber,readline,sim}
296 + # Strip out broken static link flags.
297 + # https://gcc.gnu.org/PR56750
298 + --without-stage1-ldflags
299 + # Change SONAME to avoid conflict across
300 + # {native,cross}/binutils, binutils-libs. #666100
301 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
302 + )
303 + echo ./configure "${myconf[@]}"
304 + "${S}"/configure "${myconf[@]}" || die
305 +
306 + # Prevent makeinfo from running if doc is unset.
307 + if ! use doc ; then
308 + sed -i \
309 + -e '/^MAKEINFO/s:=.*:= true:' \
310 + Makefile || die
311 + fi
312 +}
313 +
314 +src_compile() {
315 + local makeargs=()
316 + if has noinfo "${FEATURES}" \
317 + || ! type -p makeinfo >/dev/null
318 + then
319 + # binutils >= 2.17 (accidentally?) requires 'makeinfo'
320 + makeargs+=("MAKEINFO=true")
321 + fi
322 +
323 + cd "${MY_BUILDDIR}"
324 + # see Note [tooldir hack for ldscripts]
325 + emake tooldir="${EPREFIX}${TOOLPATH}" all "${makeargs[@]}"
326 +
327 + # only build info pages if the user wants them
328 + if use doc ; then
329 + emake info
330 + fi
331 +
332 + # we nuke the manpages when we're left with junk
333 + # (like when we bootstrap, no perl -> no manpages)
334 + find . -name '*.1' -a -size 0 -delete
335 +}
336 +
337 +src_test() {
338 + cd "${MY_BUILDDIR}"
339 + emake -k check
340 +}
341 +
342 +src_install() {
343 + local x d
344 +
345 + cd "${MY_BUILDDIR}"
346 + # see Note [tooldir hack for ldscripts]
347 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
348 + rm -rf "${ED}"/${LIBPATH}/bin
349 + use static-libs || find "${ED}" -name '*.la' -delete
350 +
351 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
352 + cd "${ED}"/${LIBPATH}
353 + for d in ../* ; do
354 + [[ ${d} == ../${PV} ]] && continue
355 + mv ${d}/* . || die
356 + rmdir ${d} || die
357 + done
358 +
359 + # Now we collect everything intp the proper SLOT-ed dirs
360 + # When something is built to cross-compile, it installs into
361 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
362 + if is_cross ; then
363 + cd "${ED}"/${BINPATH}
364 + for x in * ; do
365 + mv ${x} ${x/${CTARGET}-}
366 + done
367 +
368 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
369 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
370 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
371 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
372 + fi
373 + fi
374 + insinto ${INCPATH}
375 + local libiberty_headers=(
376 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
377 + demangle.h
378 + dyn-string.h
379 + fibheap.h
380 + hashtab.h
381 + libiberty.h
382 + objalloc.h
383 + splay-tree.h
384 + )
385 + doins "${libiberty_headers[@]/#/${S}/include/}" || die
386 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
387 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
388 + rm -r "${ED}"/${LIBPATH}/lib
389 + fi
390 +
391 + # Generate an env.d entry for this binutils
392 + insinto /etc/env.d/binutils
393 + cat <<-EOF > "${T}"/env.d
394 + TARGET="${CTARGET}"
395 + VER="${PV}"
396 + LIBPATH="${EPREFIX}${LIBPATH}"
397 + EOF
398 + newins "${T}"/env.d ${CTARGET}-${PV}
399 +
400 + # Handle documentation
401 + if ! is_cross ; then
402 + cd "${S}"
403 + dodoc README
404 + docinto bfd
405 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
406 + docinto binutils
407 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
408 + docinto gas
409 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
410 + docinto gprof
411 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
412 + docinto ld
413 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
414 + docinto libiberty
415 + dodoc libiberty/ChangeLog* libiberty/README
416 + docinto opcodes
417 + dodoc opcodes/ChangeLog*
418 + fi
419 +
420 + # Remove shared info pages
421 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
422 +
423 + # Trim all empty dirs
424 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
425 +}
426 +
427 +pkg_postinst() {
428 + # Make sure this ${CTARGET} has a binutils version selected
429 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
430 + binutils-config ${CTARGET}-${PV}
431 +}
432 +
433 +pkg_postrm() {
434 + local current_profile=$(binutils-config -c ${CTARGET})
435 +
436 + # If no other versions exist, then uninstall for this
437 + # target ... otherwise, switch to the newest version
438 + # Note: only do this if this version is unmerged. We
439 + # rerun binutils-config if this is a remerge, as
440 + # we want the mtimes on the symlinks updated (if
441 + # it is the same as the current selected profile)
442 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
443 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
444 + choice=${choice//$'\n'/ }
445 + choice=${choice/* }
446 + if [[ -z ${choice} ]] ; then
447 + env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
448 + else
449 + binutils-config ${choice}
450 + fi
451 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
452 + binutils-config ${CTARGET}-${PV}
453 + fi
454 +}
455 +
456 +# Note [slotting support]
457 +# -----------------------
458 +# Gentoo's layout for binutils files is non-standard as Gentoo
459 +# supports slotted installation for binutils. Many tools
460 +# still expect binutils to reside in known locations.
461 +# binutils-config package restores symlinks into known locations,
462 +# like:
463 +# /usr/bin/${CTARGET}-<tool>
464 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
465 +# /usr/include/
466 +#
467 +# Note [tooldir hack for ldscripts]
468 +# ---------------------------------
469 +# Build system does not allow ./configure to tweak every location
470 +# we need for slotting binutils hence all the shuffling in
471 +# src_install(). This note is about SCRIPTDIR define handling.
472 +#
473 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
474 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
475 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
476 +# Thus we can't just move files around after compilation finished.
477 +#
478 +# Our goal is the following:
479 +# - at build-time set scriptdir to point to symlinked location:
480 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
481 +# - at install-time set scriptdir to point to slotted location:
482 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}