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