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