Gentoo Archives: gentoo-commits

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