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: Tue, 25 Sep 2018 07:37:49
Message-Id: 1537860630.d8b0a8d7bb07bd2a7c4bd33a9e9598051030823a.slyfox@gentoo
1 commit: d8b0a8d7bb07bd2a7c4bd33a9e9598051030823a
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 25 07:30:30 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 25 07:30:30 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8b0a8d7
7
8 sys-devel/binutils: release patchset 5 for 2.30
9
10 One new main patch:
11 + 0098-Gentoo-add-with-extra-soversion-suffix-option.patch
12
13 And four backports:
14 + 0094-Replace-CET-bit-with-IBT-and-SHSTK-bits.patch
15 + 0095-Fix-parens-in-ld-bootstrap.exp.patch
16 + 0096-x86-64-Clear-the-R_X86_64_converted_reloc_bit-bit.patch
17 + 0097-Fix-unwind-offset-for-call_info-start_symbol.patch
18
19 Changes SONAME from
20 libopcodes-2.30.so
21 to
22 libopcodes-2.30.gentoo-sys-devel-binutils-mt.so
23
24 SONAME now encodes USE=multilib and package name.
25
26 Bug: https://bugs.gentoo.org/663690
27 Bug: https://bugs.gentoo.org/666376
28 Bug: https://bugs.gentoo.org/666100
29 Package-Manager: Portage-2.3.49, Repoman-2.3.11
30
31 sys-devel/binutils/Manifest | 1 +
32 sys-devel/binutils/binutils-2.30-r4.ebuild | 419 +++++++++++++++++++++++++++++
33 2 files changed, 420 insertions(+)
34
35 diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
36 index 56b480b7efa..7c9af85c0bf 100644
37 --- a/sys-devel/binutils/Manifest
38 +++ b/sys-devel/binutils/Manifest
39 @@ -10,6 +10,7 @@ DIST binutils-2.29.1-patches-3.tar.xz 20904 BLAKE2B 5549cb2412123e4ad3a13935762c
40 DIST binutils-2.29.1.tar.bz2 29123355 BLAKE2B 83de518a27bae0f13c57b1979493dd7f7cabae424cff5e8495d1f064da24b6ef9e1c19d1d1adad2dca7142372782023f66b4b4223170a49b96ba3834266fe878 SHA512 4063d34555526922376ccceb3f14b43e287442e82a8038cf50f4f51ad97d438c672c0e310ca4b856c9aff5aa9911073e256e8298a7a3f1844eeb60b90d955592
41 DIST binutils-2.30-patches-2.tar.xz 490272 BLAKE2B a28a5b5bb8faa33fec269f2c69d6ed0e4e7d5a9169861aa4b3c45511794e1e749c216862a8258c2029f1b40c511dcb2a0aeaecda57e75d52418f10d6f345718f SHA512 1686d5b58ee968f2000647acab2bee4c263d1c85fd43fed8c820fccfc0d7024a01211e7853cd5ce452fa90da500bc17309edf6dbc901c7fd6fc7b3e3d6f42581
42 DIST binutils-2.30-patches-3.tar.xz 548804 BLAKE2B 428a1750233ae3f019e20cb5ed1d8e6fe6455181e8f5961dbfe7b66493d1c42050f889e45c02c1fc1a84d545c9e61f81ad6ffd5afc0b1099a702ccc7637c3abe SHA512 c91e902d1d9fc2e9782df04c93173c3207c771f1c063e2ff12c9336593c954ea3f1b2474a8fc045927d72fe18f7401874059599d100c4a1fd152081f05913d03
43 +DIST binutils-2.30-patches-5.tar.xz 590864 BLAKE2B 71de4d08f92ab1898ad576a21763f955067cbbed543250888e0c5d51f4ef77d0d829049e9a835691cf2de03965fbcc9bcfa092eb304c03f9b885e7a3dadab286 SHA512 029b3be6ae9b8620f8580a35701bd4517b4e0232ff3cf9983b3808475c7443cbf500b6cace2c052df0bd1e47202838f4d2453238db28709a947117071d9ae804
44 DIST binutils-2.30.tar.xz 20286700 BLAKE2B 2dd5436a15a601011a1950e6082ec00082f5916fb82ce95ceab424fd8dc19f6daa7ac32a149f222ccdcc603354165cc206fde070eaa44fe2cc5e57486efc7868 SHA512 e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
45 DIST binutils-2.31.1-patches-2.tar.xz 11232 BLAKE2B b8ac65872017c063650d4e04855efa3fd3e9faa566e81fa9fb3ae777c1337627023c1af85b708a7933b577a69652451ff488340d7cc9f035d3a3a655da0fc8d6 SHA512 2d0ee2e727586fc39cdb8abc7251c12dd350d18dd84103ddacc08978db48d45445c05b7ea5f095842f6e0350db94d593270b23a38920a01ca59c363decaa2a58
46 DIST binutils-2.31.1-patches-3.tar.xz 12640 BLAKE2B 3444b219dd02ad513e6c36214d649a8a74638382103c88ec8de76a579be0ee13f8d1450e3b8d82dfddad55f2f851b32aee910a99230c7d8673f8426fc79a4cd9 SHA512 67b23c17518305561d190a15cba4a1af18a0a3cf1d7e62583ac7667d2fa40e7c7ec024cc981009d5d1caf1939633ab55fc0a198b69af02dc7841be43ff1acd13
47
48 diff --git a/sys-devel/binutils/binutils-2.30-r4.ebuild b/sys-devel/binutils/binutils-2.30-r4.ebuild
49 new file mode 100644
50 index 00000000000..3689025ad45
51 --- /dev/null
52 +++ b/sys-devel/binutils/binutils-2.30-r4.ebuild
53 @@ -0,0 +1,419 @@
54 +# Copyright 1999-2018 Gentoo Authors
55 +# Distributed under the terms of the GNU General Public License v2
56 +
57 +EAPI=6
58 +
59 +inherit eutils libtool flag-o-matic gnuconfig multilib versionator
60 +
61 +DESCRIPTION="Tools necessary to build programs"
62 +HOMEPAGE="https://sourceware.org/binutils/"
63 +LICENSE="GPL-3+"
64 +IUSE="+cxx doc multitarget +nls static-libs test"
65 +
66 +# Variables that can be set here:
67 +# PATCH_VER - the patchset version
68 +# Default: empty, no patching
69 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
70 +# - Default: PV
71 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
72 +# for the patchsets
73 +# Default: dilfridge :)
74 +
75 +PATCH_VER=5
76 +
77 +case ${PV} in
78 + 9999)
79 + BVER="git"
80 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
81 + inherit git-r3
82 + S=${WORKDIR}/binutils
83 + EGIT_CHECKOUT_DIR=${S}
84 + ;;
85 + *)
86 + BVER=${PV}
87 + SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${BVER}.tar.xz"
88 + ;;
89 +esac
90 +SLOT="${BVER}"
91 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
92 +
93 +#
94 +# The Gentoo patchset
95 +#
96 +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${BVER}}
97 +PATCH_DEV=${PATCH_DEV:-slyfox}
98 +
99 +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
100 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
101 +
102 +#
103 +# The cross-compile logic
104 +#
105 +export CTARGET=${CTARGET:-${CHOST}}
106 +if [[ ${CTARGET} == ${CHOST} ]] ; then
107 + if [[ ${CATEGORY} == cross-* ]] ; then
108 + export CTARGET=${CATEGORY#cross-}
109 + fi
110 +fi
111 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
112 +
113 +#
114 +# The dependencies
115 +#
116 +RDEPEND="
117 + >=sys-devel/binutils-config-3
118 + sys-libs/zlib
119 +"
120 +DEPEND="${RDEPEND}
121 + doc? ( sys-apps/texinfo )
122 + test? ( dev-util/dejagnu )
123 + nls? ( sys-devel/gettext )
124 + sys-devel/flex
125 + virtual/yacc
126 +"
127 +if is_cross ; then
128 + # The build assumes the host has libiberty and such when cross-compiling
129 + # its build tools. We should probably make binutils itself build a local
130 + # copy to use, but until then, be lazy.
131 + DEPEND+=" >=sys-libs/binutils-libs-${PV}"
132 +fi
133 +
134 +MY_BUILDDIR=${WORKDIR}/build
135 +
136 +src_unpack() {
137 + case ${PV} in
138 + 9999)
139 + git-r3_src_unpack;
140 + ;;
141 + *)
142 + default
143 + ;;
144 + esac
145 + mkdir -p "${MY_BUILDDIR}"
146 +}
147 +
148 +src_prepare() {
149 + if [[ ! -z ${PATCH_VER} ]] ; then
150 + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
151 + eapply "${WORKDIR}/patch"/*.patch
152 + fi
153 +
154 + # This check should probably go somewhere else, like pkg_pretend.
155 + if [[ ${CTARGET} == *-uclibc* ]] ; then
156 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
157 + die "sorry, but this binutils doesn't yet support uClibc :("
158 + fi
159 + fi
160 +
161 + # Make sure our explicit libdir paths don't get clobbered. #562460
162 + sed -i \
163 + -e 's:@bfdlibdir@:@libdir@:g' \
164 + -e 's:@bfdincludedir@:@includedir@:g' \
165 + {bfd,opcodes}/Makefile.in || die
166 +
167 + # Fix locale issues if possible #122216
168 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
169 + einfo "Fixing misc issues in configure files"
170 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
171 + ebegin " Updating ${f/${S}\/}"
172 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
173 + || eerror "Please file a bug about this"
174 + eend $?
175 + done
176 + fi
177 +
178 + # Fix conflicts with newer glibc #272594
179 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
180 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
181 + fi
182 +
183 + # Apply things from PATCHES and user dirs
184 + default
185 +
186 + # Run misc portage update scripts
187 + gnuconfig_update
188 + elibtoolize --portage --no-uclibc
189 +}
190 +
191 +toolchain-binutils_bugurl() {
192 + printf "https://bugs.gentoo.org/"
193 +}
194 +toolchain-binutils_pkgversion() {
195 + printf "Gentoo ${BVER}"
196 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
197 +}
198 +
199 +src_configure() {
200 + # Setup some paths
201 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
202 + INCPATH=${LIBPATH}/include
203 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
204 + if is_cross ; then
205 + TOOLPATH=/usr/${CHOST}/${CTARGET}
206 + else
207 + TOOLPATH=/usr/${CTARGET}
208 + fi
209 + BINPATH=${TOOLPATH}/binutils-bin/${BVER}
210 +
211 + # Make sure we filter $LINGUAS so that only ones that
212 + # actually work make it through #42033
213 + strip-linguas -u */po
214 +
215 + # Keep things sane
216 + strip-flags
217 +
218 + local x
219 + echo
220 + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
221 + einfo "$(printf '%10s' ${x}:) ${!x}"
222 + done
223 + echo
224 +
225 + cd "${MY_BUILDDIR}"
226 + local myconf=()
227 +
228 + # enable gold (installed as ld.gold) and ld's plugin architecture
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 + 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 + emake -k check
330 +}
331 +
332 +src_install() {
333 + local x d
334 +
335 + cd "${MY_BUILDDIR}"
336 + # see Note [tooldir hack for ldscripts]
337 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
338 + rm -rf "${ED}"/${LIBPATH}/bin
339 + use static-libs || find "${ED}" -name '*.la' -delete
340 +
341 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
342 + cd "${ED}"/${LIBPATH}
343 + for d in ../* ; do
344 + [[ ${d} == ../${BVER} ]] && continue
345 + mv ${d}/* . || die
346 + rmdir ${d} || die
347 + done
348 +
349 + # Now we collect everything intp the proper SLOT-ed dirs
350 + # When something is built to cross-compile, it installs into
351 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
352 + if is_cross ; then
353 + cd "${ED}"/${BINPATH}
354 + for x in * ; do
355 + mv ${x} ${x/${CTARGET}-}
356 + done
357 +
358 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
359 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
360 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
361 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
362 + fi
363 + fi
364 + insinto ${INCPATH}
365 + local libiberty_headers=(
366 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
367 + demangle.h
368 + dyn-string.h
369 + fibheap.h
370 + hashtab.h
371 + libiberty.h
372 + objalloc.h
373 + splay-tree.h
374 + )
375 + doins "${libiberty_headers[@]/#/${S}/include/}" || die
376 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
377 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
378 + rm -r "${ED}"/${LIBPATH}/lib
379 + fi
380 +
381 + # Generate an env.d entry for this binutils
382 + insinto /etc/env.d/binutils
383 + cat <<-EOF > "${T}"/env.d
384 + TARGET="${CTARGET}"
385 + VER="${BVER}"
386 + LIBPATH="${EPREFIX}${LIBPATH}"
387 + EOF
388 + newins "${T}"/env.d ${CTARGET}-${BVER}
389 +
390 + # Handle documentation
391 + if ! is_cross ; then
392 + cd "${S}"
393 + dodoc README
394 + docinto bfd
395 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
396 + docinto binutils
397 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
398 + docinto gas
399 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
400 + docinto gprof
401 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
402 + docinto ld
403 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
404 + docinto libiberty
405 + dodoc libiberty/ChangeLog* libiberty/README
406 + docinto opcodes
407 + dodoc opcodes/ChangeLog*
408 + fi
409 +
410 + # Remove shared info pages
411 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
412 +
413 + # Trim all empty dirs
414 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
415 +}
416 +
417 +pkg_postinst() {
418 + # Make sure this ${CTARGET} has a binutils version selected
419 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
420 + binutils-config ${CTARGET}-${BVER}
421 +}
422 +
423 +pkg_postrm() {
424 + local current_profile=$(binutils-config -c ${CTARGET})
425 +
426 + # If no other versions exist, then uninstall for this
427 + # target ... otherwise, switch to the newest version
428 + # Note: only do this if this version is unmerged. We
429 + # rerun binutils-config if this is a remerge, as
430 + # we want the mtimes on the symlinks updated (if
431 + # it is the same as the current selected profile)
432 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
433 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
434 + choice=${choice//$'\n'/ }
435 + choice=${choice/* }
436 + if [[ -z ${choice} ]] ; then
437 + binutils-config -u ${CTARGET}
438 + else
439 + binutils-config ${choice}
440 + fi
441 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
442 + binutils-config ${CTARGET}-${BVER}
443 + fi
444 +}
445 +
446 +# Note [slotting support]
447 +# -----------------------
448 +# Gentoo's layout for binutils files is non-standard as Gentoo
449 +# supports slotted installation for binutils. Many tools
450 +# still expect binutils to reside in known locations.
451 +# binutils-config package restores symlinks into known locations,
452 +# like:
453 +# /usr/bin/${CTARGET}-<tool>
454 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
455 +# /usr/include/
456 +#
457 +# Note [tooldir hack for ldscripts]
458 +# ---------------------------------
459 +# Build system does not allow ./configure to tweak every location
460 +# we need for slotting binutils hence all the shuffling in
461 +# src_install(). This note is about SCRIPTDIR define handling.
462 +#
463 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
464 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
465 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
466 +# Thus we can't just move files around after compilation finished.
467 +#
468 +# Our goal is the following:
469 +# - at build-time set scriptdir to point to symlinked location:
470 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
471 +# - at install-time set scriptdir to point to slotted location:
472 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${BVER}