Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/, sys-devel/binutils-config/files/
Date: Tue, 15 Dec 2015 19:49:22
Message-Id: 1450208918.0e83584b43e98eaeed13e30fb6f90391214b0b06.grobian@gentoo
1 commit: 0e83584b43e98eaeed13e30fb6f90391214b0b06
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 15 19:48:38 2015 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 15 19:48:38 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=0e83584b
7
8 sys-devel/binutils-config: sync version 5-r2
9
10 Package-Manager: portage-2.2.20-prefix
11
12 .../binutils-config/binutils-config-5-r2.ebuild | 76 ++++
13 sys-devel/binutils-config/files/binutils-config-5 | 494 +++++++++++++++++++++
14 sys-devel/binutils-config/files/binutils.eselect | 45 ++
15 3 files changed, 615 insertions(+)
16
17 diff --git a/sys-devel/binutils-config/binutils-config-5-r2.ebuild b/sys-devel/binutils-config/binutils-config-5-r2.ebuild
18 new file mode 100644
19 index 0000000..3af562d
20 --- /dev/null
21 +++ b/sys-devel/binutils-config/binutils-config-5-r2.ebuild
22 @@ -0,0 +1,76 @@
23 +# Copyright 1999-2015 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +# $Id$
26 +
27 +EAPI=5
28 +
29 +inherit eutils prefix
30 +
31 +DESCRIPTION="Utility to change the binutils version being used"
32 +HOMEPAGE="https://www.gentoo.org/"
33 +W_VER="0.3.1723"
34 +SRC_URI="http://dev.gentoo.org/~grobian/distfiles/toolchain-prefix-wrapper-${W_VER}.tar.xz"
35 +
36 +LICENSE="GPL-2"
37 +SLOT="0"
38 +KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
39 +IUSE="sunld"
40 +
41 +# We also RDEPEND on sys-apps/findutils which is in base @system
42 +RDEPEND="sys-apps/gentoo-functions
43 + !<app-admin/eselect-1.4.5"
44 +
45 +S=${WORKDIR}/toolchain-prefix-wrapper-${W_VER}
46 +
47 +# NOTE: the ld wrapper is only enabled on rpath versions of prefix.
48 +src_prepare() {
49 + cp "${FILESDIR}"/${PN}-${PV} ./${PN} || die
50 + if use prefix-guest; then
51 + epatch "${FILESDIR}/${PN}-4-ldwrapper.patch"
52 + fi
53 + eprefixify ${PN}
54 +
55 + # fix configure stupidity, until next release
56 + sed -i -e 's/x10\.\[3456789\]/x10.*/' configure
57 + epatch "${FILESDIR}"/${PN}-4-no-macosx-version-min.patch
58 + epatch "${FILESDIR}"/${PN}-4-aix-ld-svr4.patch
59 +}
60 +
61 +src_configure() {
62 + if use prefix-guest; then
63 + econf --with-macosx-version-min=${MACOSX_DEPLOYMENT_TARGET} \
64 + $(use_with sunld native-ld)
65 + fi
66 +}
67 +
68 +src_install() {
69 + if use prefix-guest; then
70 + emake install DESTDIR="${D}"
71 + fi
72 +
73 + newbin "${S}"/${PN} ${PN}
74 + doman "${FILESDIR}"/${PN}.8
75 +
76 + insinto /usr/share/eselect/modules
77 + doins "${FILESDIR}"/binutils.eselect
78 +}
79 +
80 +pkg_preinst() {
81 + # Force a refresh when upgrading from an older version that symlinked
82 + # in all the libs & includes that binutils-libs handles. #528088
83 + if has_version "<${CATEGORY}/${PN}-5" ; then
84 + local bc current
85 + bc="${ED}/usr/bin/binutils-config"
86 + if current=$("${bc}" -c) ; then
87 + "${bc}" "${current}"
88 + fi
89 + fi
90 +}
91 +
92 +pkg_postinst() {
93 + # refresh all links and the wrapper
94 + if [[ ${ROOT%/} == "" ]] ; then
95 + [[ -f ${EROOT}/etc/env.d/binutils/config-${CHOST} ]] \
96 + && binutils-config $(binutils-config --get-current-profile)
97 + fi
98 +}
99
100 diff --git a/sys-devel/binutils-config/files/binutils-config-5 b/sys-devel/binutils-config/files/binutils-config-5
101 new file mode 100755
102 index 0000000..3052a85
103 --- /dev/null
104 +++ b/sys-devel/binutils-config/files/binutils-config-5
105 @@ -0,0 +1,494 @@
106 +#!/bin/bash
107 +# Copyright 1999-2015 Gentoo Foundation
108 +# Distributed under the terms of the GNU General Public License v2
109 +# $Id$
110 +
111 +# Format of /etc/env.d/binutils/:
112 +# config-TARGET: CURRENT=version for TARGET
113 +# TARGET-VER: has a TARGET and VER variable
114 +
115 +: ${EPREFIX:="@GENTOO_PORTAGE_EPREFIX@"}
116 +[[ ${EPREFIX} = */ ]] && EPREFIX="${EPREFIX%/}"
117 +[[ -n ${EPREFIX} && ${EPREFIX} != /* ]] && EPREFIX="${PWD%/}/${EPREFIX}"
118 +
119 +: ${ROOT:=/}
120 +[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
121 +[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
122 +
123 +EROOT="${ROOT%/}${EPREFIX}/"
124 +
125 +cd "${EPREFIX}/"
126 +
127 +trap ":" INT QUIT TSTP
128 +
129 +argv0=${0##*/}
130 +FUNCTIONS_SH="@GENTOO_PORTAGE_EPREFIX@/lib/gentoo/functions.sh"
131 +source ${FUNCTIONS_SH} || {
132 + echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
133 + exit 1
134 +}
135 +esyslog() { :; }
136 +die() { eerror "${argv0}: $*"; exit 1; }
137 +umask 022
138 +
139 +usage() {
140 +cat << USAGE_END
141 +Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
142 +
143 +${HILITE}General Options:${NORMAL}
144 + ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
145 + ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
146 + ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
147 + ${GOOD}-d, --debug${NORMAL} Execute with debug output
148 +
149 +${HILITE}General Cruft:${NORMAL}
150 + ${GOOD}--linker${NORMAL} <linker> Switch to specified linker (if supported)
151 +
152 +Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
153 +For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
154 +
155 +For more info, please see ${HILITE}binutils-config${NORMAL}(8).
156 +USAGE_END
157 +
158 + exit ${1:-1}
159 +}
160 +
161 +mv_if_diff() {
162 + if cmp -s "$1" "$2" ; then
163 + rm -f "$1"
164 + else
165 + mv -f "$1" "$2"
166 + fi
167 +}
168 +atomic_ln() {
169 + local target=$1 linkdir=$2 linkname=$3 linktmp linkfull
170 + linktmp="${linkdir}/.binutils-config.tmp.${linkname}"
171 + linkfull="${linkdir}/${linkname}"
172 + if [[ -d ${linkfull} ]] ; then
173 + # if linking to a dir, we need a little magic to
174 + # make it atomic since `mv -T` is not portable
175 + rm -rf "${linktmp}"
176 + mkdir -p "${linktmp}"
177 + ln -sf "${target}" "${linktmp}/${linkname}"
178 + mv "${linktmp}/${linkname}" "${linktmp}/../"
179 + rmdir "${linktmp}"
180 + else
181 + # `ln` will expand into unlink();symlink(); which
182 + # is not atomic for a small amount of time, but
183 + # `mv` is a single rename() call
184 + ln -sf "${target}" "${linktmp}"
185 + mv "${linktmp}" "${linkfull}"
186 + fi
187 +}
188 +
189 +setup_env() {
190 + unset TARGET VER LIBPATH
191 + source "${ENV_D}/${PROFILE}"
192 + if [[ -z ${TARGET} ]] ; then
193 + eerror "${PROFILE} is invalid (no \$TARGET defined) :("
194 + return 1
195 + fi
196 + if [[ -z ${VER} ]] ; then
197 + eerror "${PROFILE} is invalid (no \$VER defined) :("
198 + return 1
199 + fi
200 +
201 + #
202 + # Generate binary symlinks
203 + #
204 + BINPATH=""
205 + BINPATH_LINKS=""
206 + if [[ ${TARGET} != ${HOST} ]] ; then
207 + #
208 + # Newer paths: /usr/${HOST}/${TARGET}/...
209 + # Older paths: /usr/${TARGET}/...
210 + #
211 + if [[ -d ${ROOT}${EPREFIX}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
212 + BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER}
213 + BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET}
214 + fi
215 + fi
216 + if [[ -z ${BINPATH} ]] ; then
217 + BINPATH="${EPREFIX}"/usr/${TARGET}/binutils-bin/${VER}
218 + BINPATH_LINKS="${EPREFIX}"/usr/${TARGET}/bin
219 + fi
220 +}
221 +
222 +# Lists of headers that various versions have installed.
223 +HEADERS=(
224 + ansidecl.h bfd.h bfdlink.h demangle.h dis-asm.h dyn-string.h
225 + fibheap.h hashtab.h libiberty.h objalloc.h plugin-api.h
226 + splay-tree.h symcat.h
227 +)
228 +
229 +switch_profile() {
230 + local x
231 +
232 + ebegin "Switching to ${PROFILE}"
233 +
234 + setup_env || return 1
235 +
236 + cd "${ROOT}/${BINPATH}" || exit 1
237 + mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
238 + for x in * ; do
239 + atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
240 + atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}"
241 + if [[ ${TARGET} == ${HOST} ]] ; then
242 + atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"
243 + fi
244 + done
245 +
246 + #
247 + # Generate library / ldscripts symlinks
248 + #
249 + : ${LIBPATH:=${EPREFIX}/usr/lib/binutils/${TARGET}/${VER}}
250 + cd "${ROOT}/${LIBPATH}" || exit 1
251 + if [[ ${TARGET} == ${HOST} ]] ; then
252 + dstlib=${EROOT}/usr/${HOST}/lib
253 + else
254 + dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib
255 + fi
256 + # When upgrading, we need to clean up ldscripts and libs.
257 + # Don't symlink back in the libs -- the binutils-lib package handles
258 + # these now.
259 + # TODO: Stop requiring even the ldscripts symlink.
260 + mkdir -p "${dstlib}"
261 + rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
262 + atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
263 + find -L "${dstlib}" -xtype l -name 'lib*' -delete
264 + # Detect older binutils w/broken rpaths. #562460
265 + # We can hardcode the "/lib" part since that's what the binutils
266 + # configure scripts have. They did not include any other path.
267 + if [[ $(scanelf -qF '%r#F' "${ROOT}/${BINPATH}/as") == */lib ]] ; then
268 + ewarn "Old cross-binutils detected; please re-emerge to fix (see bug #562460)."
269 + for x in lib* ; do
270 + atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}"
271 + done
272 + fi
273 +
274 + #
275 + # Clean out old generated include symlinks
276 + #
277 + INCPATH=${LIBPATH}/include
278 + if [[ -d ${ROOT}/${INCPATH} ]] ; then
279 + cd "${ROOT}/${INCPATH}" || exit 1
280 + if [[ ${HOST} == ${TARGET} ]] ; then
281 + # The binutils-lib package handles these files now.
282 + for x in libiberty "${HEADERS[@]}" ; do
283 + x="${EROOT}/usr/include/${x}"
284 + if [[ -L ${x} ]] ; then
285 + rm "${x}"
286 + fi
287 + done
288 + else
289 + # Clean out old path -- cannot use '-exec {} +' syntax here
290 + find . -type f -exec rm -f "${EROOT}/usr/${TARGET}/usr/include/{}" \;
291 + rmdir "${EROOT}/usr/${TARGET}/usr/include" >& /dev/null
292 + rmdir "${EROOT}/usr/${TARGET}/usr" >& /dev/null
293 + rmdir "${EROOT}/usr/${TARGET}" >& /dev/null
294 + fi
295 + fi
296 +
297 + #
298 + # Make sure proper paths get updated
299 + #
300 + local env_update_flag="--no-ldconfig"
301 + if [[ ${TARGET} == ${HOST} ]] ; then
302 + # Delete old config now that binutils-libs installs these files.
303 + # Note: This skips ldconfig update if env.d had LDPATH, but meh.
304 + # Most people have upgraded to ld.so.conf.d, and someone else will
305 + # eventually re-run ldconfig for us.
306 + x="${EROOT}"/etc/ld.so.conf.d/05binutils.conf
307 + if [[ -e ${x} ]]; then
308 + rm -f "${x}"
309 + env_update_flag=""
310 + fi
311 +
312 + DATAPATH="${EPREFIX}"/usr/share/binutils-data/${TARGET}/${VER}
313 + local e="${EROOT}"/etc/env.d/05binutils
314 + local ee="${e}.tmp"
315 + rm -f "${ee}"
316 + [[ -d ${ROOT}/${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
317 + [[ -d ${ROOT}/${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
318 + mv_if_diff "${ee}" "${e}"
319 + fi
320 +
321 + local c="${ENV_D}/config-${TARGET}"
322 + local cc="${c}.tmp"
323 + echo "CURRENT=${VER}" > "${cc}"
324 + mv_if_diff "${cc}" "${c}"
325 +
326 + eend 0
327 +
328 + #
329 + # Regen env.d if need/can be
330 + #
331 + if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
332 + env-update ${env_update_flag}
333 + echo
334 + ewarn "Please remember to run:"
335 + echo
336 + ewarn " # . ${EPREFIX}/etc/profile"
337 + echo
338 + fi
339 +
340 + return 0
341 +}
342 +
343 +uninstall_target() {
344 + : ${TARGET:=${UARG}}
345 +
346 + if [[ ${TARGET} == ${HOST} ]] ; then
347 + die "refusing to uninstall native binutils"
348 + fi
349 +
350 + shopt -s nullglob
351 + PROFILE=""
352 +
353 + for PROFILE in "${ENV_D}"/${TARGET}-* ; do
354 + ewarn "Removing all signs of ${PROFILE##*/}"
355 + rm -f "${ENV_D}"/${PROFILE}
356 + done
357 + if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
358 + die "no profiles exist for '${TARGET}'"
359 + fi
360 +
361 + rm -f "${ENV_D}"/config-${TARGET}
362 +
363 + local x
364 + for x in \
365 + addr2line ar as c++filt dwp elf2flt elfedit flthdr gprof \
366 + ld ld.{bfd,gold,real} \
367 + nm objcopy objdump ranlib readelf size strings strip
368 + do
369 + x=(
370 + "${EROOT}"/usr/bin/${TARGET}-${x}
371 + "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
372 + "${EROOT}"/usr/libexec/gcc/${TARGET}/${x}
373 + )
374 + rm -f "${x[@]}"
375 + done
376 + for x in "${HEADERS[@]}" ; do
377 + rm -f "${EROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
378 + done
379 + for x in bfd iberty opcodes ; do
380 + rm -f "${EROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
381 + done
382 + # Delete broken symlinks
383 + local destdir="${EROOT}/usr/${HOST}/${TARGET}"
384 + rm -f "${destdir}"/lib/ldscripts
385 + find -L "${destdir}"/lib -type l -exec rm {} +
386 + rmdir \
387 + "${destdir}"/{bin,include,lib,usr} \
388 + "${destdir}" \
389 + "${EROOT}"/var/db/pkg/cross-${TARGET} \
390 + "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin \
391 + "${EROOT}"/usr/libexec/gcc/${TARGET} \
392 + 2>/dev/null
393 +
394 + rm -f "${ENV_D}"/${TARGET}-*
395 +}
396 +
397 +set_current_profile() {
398 + if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then
399 + eerror "${argv0}: unable to locate a profile for target: ${TARGET}"
400 + return 1
401 + fi
402 +
403 + source "${ENV_D}/config-${TARGET}"
404 +
405 + if [[ -z ${CURRENT} ]] ; then
406 + eerror "${argv0}: no binutils profile is active!"
407 + return 1
408 + fi
409 +
410 + echo "${TARGET}-${CURRENT}"
411 +
412 + return 0
413 +}
414 +get_current_profile() { echo "${PROFILE}" ; }
415 +
416 +list_profiles() {
417 + local x i target
418 +
419 + if [[ ${ROOT} != / ]] ; then
420 + echo "Using binutils-config info in ${ROOT}"
421 + fi
422 +
423 + set -- "${ENV_D}"/*
424 + target=
425 + i=1
426 +
427 + for x ; do
428 + # skip broken links and config files
429 + [[ -f ${x} ]] || continue
430 + [[ ${x} == */config-* ]] && continue
431 +
432 + source "${x}"
433 + if [[ ${target} != ${TARGET} ]] ; then
434 + [[ -n ${target} ]] && echo
435 + target=${TARGET}
436 + fi
437 +
438 + x=${x##*/}
439 + if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
440 + source "${ENV_D}/config-${TARGET}"
441 + if [[ ${VER} == ${CURRENT} ]] ; then
442 + [[ ${TARGET} == ${HOST} ]] \
443 + && x="${x} ${GOOD}*${NORMAL}" \
444 + || x="${x} ${HILITE}*${NORMAL}"
445 + fi
446 + fi
447 +
448 + # We would align the [...] field like so:
449 + #printf ' [%*ss] %s\n' ${##} "${i}" "${x}"
450 + # but this breaks simple scripting: `binutils -l | awk '{print $2}'`
451 +
452 + # Or we could align the target col like so:
453 + #printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}"
454 + # but i'm not sold that it looks better
455 +
456 + # So keep it simple ... only makes a diff anyways for crazy people
457 + # like me which have 100+ binutils packages installed ...
458 + echo " [$i] ${x}"
459 + ((++i))
460 + done
461 +}
462 +
463 +switch_linker() {
464 + local bpath ld=$1
465 +
466 + case ${ld} in
467 + ld.*) ;;
468 + *) die "not supported: linker must start with 'ld.'" ;;
469 + esac
470 +
471 + setup_env || return 1
472 + bpath="${ROOT}/${BINPATH}"
473 +
474 + # does this binutils even support the requested linker ?
475 + if [[ ! -e ${bpath}/${ld} ]] ; then
476 + die "sorry, but ${PROFILE} doesn't support the ${ld} linker"
477 + fi
478 +
479 + # switch it up
480 + ebegin "Setting default linker to ${ld} for ${PROFILE}"
481 + atomic_ln ${ld} "${bpath}" ld
482 + eend $?
483 +}
484 +
485 +set_HOST() {
486 + # Set HOST to CHOST if it isn't already set
487 + : ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
488 +}
489 +
490 +ENV_D="${EROOT}etc/env.d/binutils"
491 +
492 +DEBUG="no"
493 +NEED_ACTION="yes"
494 +DOIT="switch_profile"
495 +PROFILE="current"
496 +HOST=""
497 +TARGET=""
498 +unset UARG
499 +
500 +select_action() {
501 + if [[ ${NEED_ACTION} != "no" ]] ; then
502 + NEED_ACTION="no"
503 + DOIT=$1
504 + else
505 + die "one action at a time!"
506 + fi
507 +}
508 +
509 +while [[ $# -gt 0 ]] ; do
510 + x=$1
511 + shift
512 + case ${x} in
513 + -c|--get-current-profile) select_action get_current_profile ;;
514 + -l|--list|--list-profiles) select_action list_profiles ;;
515 + -u|--uninstall) select_action uninstall_target ;;
516 + --linker) select_action "switch_linker $1"; shift ;;
517 + -d|--debug) DEBUG="yes" ;;
518 + -h|--help) usage 0 ;;
519 + -V|--version)
520 + unset Header
521 + cvsver="$Id$"
522 + cvsver=${cvsver##*binutils-config-}
523 + bver=${cvsver%%,v *}
524 + cvsver=${cvsver#* }
525 + echo "binutils-config-${bver} (r${cvsver%% *})"
526 + exit 0
527 + ;;
528 + -*)
529 + die "invalid switch! Try '--help'."
530 + ;;
531 + *)
532 + if [[ ${UARG+set} == "set" ]] ; then
533 + die "only one profile/target at a time please"
534 + fi
535 + NEED_ACTION="maybe"
536 + UARG=${x}
537 + ;;
538 + esac
539 +done
540 +
541 +[[ ${NEED_ACTION} == "yes" ]] && usage 1
542 +[[ ${DEBUG} == "yes" ]] && set -x
543 +
544 +# All operations need to know the current HOST to figure out
545 +# what is a native target and what is a cross target
546 +set_HOST
547 +
548 +# All operations need to know the profile the user wants
549 +case ${DOIT} in
550 +switch_profile|switch_linker_*)
551 + # decode user's profile choice
552 + x=${UARG:-$(TARGET=${HOST} set_current_profile)}
553 + PROFILE=""
554 + if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
555 + # User gave us a # representing the profile
556 + i=1
557 + for y in "${ENV_D}"/* ; do
558 + [[ ${y/config-} != ${y} ]] && continue
559 +
560 + if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
561 + PROFILE=${y##*/}
562 + break
563 + fi
564 + ((++i))
565 + done
566 + fi
567 +
568 + if [[ -z ${PROFILE} ]] ; then
569 + # User gave us a full HOST-ver
570 + x=${x##*/}
571 + if [[ -f ${ENV_D}/${x} ]] ; then
572 + # Valid HOST-ver yeah!
573 + PROFILE=${x}
574 + else
575 + # Not a valid HOST-ver ...
576 + if [[ ! -f ${ENV_D}/config-${x} ]] ; then
577 + # Maybe they just gave us a ver ...
578 + if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
579 + x=${HOST}-${x}
580 + else
581 + die "could not locate '$x' in '${ENV_D}/'!"
582 + fi
583 + PROFILE=${x}
584 + else
585 + # Maybe they just gave us a target ... pick active profile
586 + PROFILE=$(TARGET=${x} set_current_profile)
587 + fi
588 + fi
589 + fi
590 + ;;
591 +*)
592 + # lookup current profile as the user gave us a target
593 + PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1
594 + ;;
595 +esac
596 +
597 +eval ${DOIT}
598 +
599 +# vim:ts=4
600
601 diff --git a/sys-devel/binutils-config/files/binutils.eselect b/sys-devel/binutils-config/files/binutils.eselect
602 new file mode 100644
603 index 0000000..a89655a
604 --- /dev/null
605 +++ b/sys-devel/binutils-config/files/binutils.eselect
606 @@ -0,0 +1,45 @@
607 +# -*-eselect-*- vim: ft=eselect
608 +# Copyright 2005-2015 Gentoo Foundation
609 +# Distributed under the terms of the GNU GPL version 2 or later
610 +
611 +DESCRIPTION="Manage installed versions of sys-devel/binutils"
612 +MAINTAINER="toolchain@g.o"
613 +
614 +### list action
615 +
616 +describe_list() {
617 + echo "List all installed version of binutils"
618 +}
619 +
620 +do_list() {
621 + binutils-config -l
622 +}
623 +
624 +### set action
625 +
626 +describe_set() {
627 + echo "Activate one of the installed binutils"
628 +}
629 +
630 +describe_set_parameters() {
631 + echo "<target>"
632 +}
633 +
634 +describe_set_options() {
635 + echo "target : Target name or number (from 'list' action)"
636 +}
637 +
638 +do_set() {
639 + [[ $# -eq 1 ]] || die -q "Please specify exactly one version to activate!"
640 + binutils-config "$1"
641 +}
642 +
643 +### show action
644 +
645 +describe_show() {
646 + echo "Print the currently active binutils version"
647 +}
648 +
649 +do_show() {
650 + binutils-config -c
651 +}