Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/
Date: Sun, 15 Jul 2018 12:55:27
Message-Id: 1531659304.9fae8a49a964ee34e8cba59da3e1a0c16a339b37.dilfridge@gentoo
1 commit: 9fae8a49a964ee34e8cba59da3e1a0c16a339b37
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 15 12:54:27 2018 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 15 12:55:04 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9fae8a49
7
8 sys-devel/binutils: Zero-day 2.31 bump for the brave or stupid
9
10 === ld Summary ===
11 unexpected failures 1
12 FAIL: --warn-shared-textrel --fatal-warnings (?)
13
14 Gold testsuite fully b0rken, needs investigation:
15 /bin/sh: /var/tmp/portage/sys-devel/binutils-2.31/work/binutils-2.31
16 /gold/../test-driver: No such file or directory
17 make[5]: *** [Makefile:1394: bootstrap-test-r.log] Error 127
18 Package-Manager: Portage-2.3.40, Repoman-2.3.9
19
20 sys-devel/binutils/Manifest | 2 +
21 sys-devel/binutils/binutils-2.31.ebuild | 423 ++++++++++++++++++++++++++++++++
22 2 files changed, 425 insertions(+)
23
24 diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest
25 index de8b3b1b3d3..2f09e530523 100644
26 --- a/sys-devel/binutils/Manifest
27 +++ b/sys-devel/binutils/Manifest
28 @@ -11,4 +11,6 @@ DIST binutils-2.29.1.tar.bz2 29123355 BLAKE2B 83de518a27bae0f13c57b1979493dd7f7c
29 DIST binutils-2.30-patches-2.tar.xz 490272 BLAKE2B a28a5b5bb8faa33fec269f2c69d6ed0e4e7d5a9169861aa4b3c45511794e1e749c216862a8258c2029f1b40c511dcb2a0aeaecda57e75d52418f10d6f345718f SHA512 1686d5b58ee968f2000647acab2bee4c263d1c85fd43fed8c820fccfc0d7024a01211e7853cd5ce452fa90da500bc17309edf6dbc901c7fd6fc7b3e3d6f42581
30 DIST binutils-2.30-patches-3.tar.xz 548804 BLAKE2B 428a1750233ae3f019e20cb5ed1d8e6fe6455181e8f5961dbfe7b66493d1c42050f889e45c02c1fc1a84d545c9e61f81ad6ffd5afc0b1099a702ccc7637c3abe SHA512 c91e902d1d9fc2e9782df04c93173c3207c771f1c063e2ff12c9336593c954ea3f1b2474a8fc045927d72fe18f7401874059599d100c4a1fd152081f05913d03
31 DIST binutils-2.30.tar.xz 20286700 BLAKE2B 2dd5436a15a601011a1950e6082ec00082f5916fb82ce95ceab424fd8dc19f6daa7ac32a149f222ccdcc603354165cc206fde070eaa44fe2cc5e57486efc7868 SHA512 e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
32 +DIST binutils-2.31-patches-1.tar.xz 16692 BLAKE2B ee9c7b344b12073c881eaf6fa80e8cb3187add720a26b60e7ef7db9dc3eb8e6e2b83cd0afb3115c4846aa914f8957554bd010f67af34dc5ad81e676639cf361e SHA512 4004d52327babd00f946b199f71e9eca840e66c65a287730af80b5a69138fe5f946f33c13400e028088238314c644f00b858049f8923948d2e6144dc779c24c0
33 +DIST binutils-2.31.tar.xz 20445772 BLAKE2B 02d9ef7f8ea0d24682716b6890916d507762b4672a3148192afbbc1d6323b3f3970eb630ec9af5e18c60ba1d4579d49d847e571bcd8b1236c24b04c9e3815481 SHA512 3448a71c42d790569c1159c1042aa520b2d8ac8af7506fb1f2a4199dfb13b39f1c2271a5cb3a643d10c7d8a388a73f190e90503d4793a016da7893473aa1c635
34 DIST binutils-9999-patches-1.tar.xz 10116 BLAKE2B 1ae970fd13ea1b94f554ed5b3fde4b6bdd90efcfc2488efc2f1465511279027c2e7f2a7371069afadb91bf833680a24e1a5df50d3169c9ee132c933b3c1fdba9 SHA512 a5d97d7070b876bf072db2a99a2876c239e03409849b9c93467bd3e70cd97c468110031a09e1c182c05d48004ec3e1651f44a1850b0275a385c3bae598cd98d7
35
36 diff --git a/sys-devel/binutils/binutils-2.31.ebuild b/sys-devel/binutils/binutils-2.31.ebuild
37 new file mode 100644
38 index 00000000000..a2e72661a56
39 --- /dev/null
40 +++ b/sys-devel/binutils/binutils-2.31.ebuild
41 @@ -0,0 +1,423 @@
42 +# Copyright 1999-2018 Gentoo Foundation
43 +# Distributed under the terms of the GNU General Public License v2
44 +
45 +EAPI=6
46 +
47 +inherit eutils libtool flag-o-matic gnuconfig multilib versionator
48 +
49 +DESCRIPTION="Tools necessary to build programs"
50 +HOMEPAGE="https://sourceware.org/binutils/"
51 +LICENSE="GPL-3+"
52 +IUSE="+cxx doc multitarget +nls static-libs test"
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 +
65 +case ${PV} in
66 + 9999)
67 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
68 + inherit git-r3
69 + S=${WORKDIR}/binutils
70 + EGIT_CHECKOUT_DIR=${S}
71 + SLOT=${PV}
72 + ;;
73 + *.9999)
74 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
75 + inherit git-r3
76 + S=${WORKDIR}/binutils
77 + EGIT_CHECKOUT_DIR=${S}
78 + EGIT_BRANCH=${PV%.9999}
79 + EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
80 + SLOT=${PV%.9999}
81 + ;;
82 + *)
83 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
84 + SLOT=${PV}
85 + ;;
86 +esac
87 +
88 +#
89 +# The Gentoo patchset
90 +#
91 +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
92 +PATCH_DEV=${PATCH_DEV:-dilfridge}
93 +
94 +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
95 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
96 +
97 +#
98 +# The cross-compile logic
99 +#
100 +export CTARGET=${CTARGET:-${CHOST}}
101 +if [[ ${CTARGET} == ${CHOST} ]] ; then
102 + if [[ ${CATEGORY} == cross-* ]] ; then
103 + export CTARGET=${CATEGORY#cross-}
104 + fi
105 +fi
106 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
107 +
108 +#
109 +# The dependencies
110 +#
111 +RDEPEND="
112 + >=sys-devel/binutils-config-3
113 + sys-libs/zlib
114 +"
115 +DEPEND="${RDEPEND}
116 + doc? ( sys-apps/texinfo )
117 + test? ( dev-util/dejagnu )
118 + nls? ( sys-devel/gettext )
119 + sys-devel/flex
120 + virtual/yacc
121 +"
122 +if is_cross ; then
123 + # The build assumes the host has libiberty and such when cross-compiling
124 + # its build tools. We should probably make binutils itself build a local
125 + # copy to use, but until then, be lazy.
126 + DEPEND+=" >=sys-libs/binutils-libs-${PV}"
127 +fi
128 +
129 +MY_BUILDDIR=${WORKDIR}/build
130 +
131 +src_unpack() {
132 + case ${PV} in
133 + *9999)
134 + git-r3_src_unpack
135 + ;;
136 + *)
137 + ;;
138 + esac
139 + default
140 + mkdir -p "${MY_BUILDDIR}"
141 +}
142 +
143 +src_prepare() {
144 + if [[ ! -z ${PATCH_VER} ]] ; then
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 + # enable gold (installed as ld.gold) and ld's plugin architecture
224 + if use cxx ; then
225 + myconf+=( --enable-gold )
226 + myconf+=( --enable-plugins )
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 + )
293 + echo ./configure "${myconf[@]}"
294 + "${S}"/configure "${myconf[@]}" || die
295 +
296 + # Prevent makeinfo from running if doc is unset.
297 + if ! use doc ; then
298 + sed -i \
299 + -e '/^MAKEINFO/s:=.*:= true:' \
300 + Makefile || die
301 + fi
302 +}
303 +
304 +src_compile() {
305 + cd "${MY_BUILDDIR}"
306 + # see Note [tooldir hack for ldscripts]
307 + emake tooldir="${EPREFIX}${TOOLPATH}" all
308 +
309 + # only build info pages if the user wants them
310 + if use doc ; then
311 + emake info
312 + fi
313 +
314 + # we nuke the manpages when we're left with junk
315 + # (like when we bootstrap, no perl -> no manpages)
316 + find . -name '*.1' -a -size 0 -delete
317 +}
318 +
319 +src_test() {
320 + cd "${MY_BUILDDIR}"
321 + emake -k check
322 +}
323 +
324 +src_install() {
325 + local x d
326 +
327 + cd "${MY_BUILDDIR}"
328 + # see Note [tooldir hack for ldscripts]
329 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
330 + rm -rf "${ED}"/${LIBPATH}/bin
331 + use static-libs || find "${ED}" -name '*.la' -delete
332 +
333 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
334 + cd "${ED}"/${LIBPATH}
335 + for d in ../* ; do
336 + [[ ${d} == ../${PV} ]] && continue
337 + mv ${d}/* . || die
338 + rmdir ${d} || die
339 + done
340 +
341 + # Now we collect everything intp the proper SLOT-ed dirs
342 + # When something is built to cross-compile, it installs into
343 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
344 + if is_cross ; then
345 + cd "${ED}"/${BINPATH}
346 + for x in * ; do
347 + mv ${x} ${x/${CTARGET}-}
348 + done
349 +
350 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
351 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
352 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
353 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
354 + fi
355 + fi
356 + insinto ${INCPATH}
357 + local libiberty_headers=(
358 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
359 + demangle.h
360 + dyn-string.h
361 + fibheap.h
362 + hashtab.h
363 + libiberty.h
364 + objalloc.h
365 + splay-tree.h
366 + )
367 + doins "${libiberty_headers[@]/#/${S}/include/}" || die
368 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
369 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
370 + rm -r "${ED}"/${LIBPATH}/lib
371 + fi
372 +
373 + # Generate an env.d entry for this binutils
374 + insinto /etc/env.d/binutils
375 + cat <<-EOF > "${T}"/env.d
376 + TARGET="${CTARGET}"
377 + VER="${PV}"
378 + LIBPATH="${EPREFIX}${LIBPATH}"
379 + EOF
380 + newins "${T}"/env.d ${CTARGET}-${PV}
381 +
382 + # Handle documentation
383 + if ! is_cross ; then
384 + cd "${S}"
385 + dodoc README
386 + docinto bfd
387 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
388 + docinto binutils
389 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
390 + docinto gas
391 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
392 + docinto gprof
393 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
394 + docinto ld
395 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
396 + docinto libiberty
397 + dodoc libiberty/ChangeLog* libiberty/README
398 + docinto opcodes
399 + dodoc opcodes/ChangeLog*
400 + fi
401 +
402 + # Remove shared info pages
403 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
404 +
405 + # Trim all empty dirs
406 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
407 +}
408 +
409 +pkg_postinst() {
410 + # Make sure this ${CTARGET} has a binutils version selected
411 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
412 + binutils-config ${CTARGET}-${PV}
413 +}
414 +
415 +pkg_postrm() {
416 + local current_profile=$(binutils-config -c ${CTARGET})
417 +
418 + # If no other versions exist, then uninstall for this
419 + # target ... otherwise, switch to the newest version
420 + # Note: only do this if this version is unmerged. We
421 + # rerun binutils-config if this is a remerge, as
422 + # we want the mtimes on the symlinks updated (if
423 + # it is the same as the current selected profile)
424 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
425 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
426 + choice=${choice//$'\n'/ }
427 + choice=${choice/* }
428 + if [[ -z ${choice} ]] ; then
429 + binutils-config -u ${CTARGET}
430 + else
431 + binutils-config ${choice}
432 + fi
433 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
434 + binutils-config ${CTARGET}-${PV}
435 + fi
436 +}
437 +
438 +# Note [slotting support]
439 +# -----------------------
440 +# Gentoo's layout for binutils files is non-standard as Gentoo
441 +# supports slotted installation for binutils. Many tools
442 +# still expect binutils to reside in known locations.
443 +# binutils-config package restores symlinks into known locations,
444 +# like:
445 +# /usr/bin/${CTARGET}-<tool>
446 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
447 +# /usr/include/
448 +#
449 +# Note [tooldir hack for ldscripts]
450 +# ---------------------------------
451 +# Build system does not allow ./configure to tweak every location
452 +# we need for slotting binutils hence all the shuffling in
453 +# src_install(). This note is about SCRIPTDIR define handling.
454 +#
455 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
456 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
457 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
458 +# Thus we can't just move files around after compilation finished.
459 +#
460 +# Our goal is the following:
461 +# - at build-time set scriptdir to point to symlinked location:
462 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
463 +# - at install-time set scriptdir to point to slotted location:
464 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}