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