1 |
commit: 52559cb5d4e44090725130b6a926dcf40a85ac87 |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon May 23 10:56:05 2016 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon May 23 10:56:05 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/android.git/commit/?id=52559cb5 |
7 |
|
8 |
sys-devel/binutils-config: clean up. |
9 |
|
10 |
sys-devel/binutils-config/Manifest | 1 + |
11 |
.../binutils-config/binutils-config-4-r2.ebuild | 24 -- |
12 |
.../binutils-config/binutils-config-4-r3.ebuild | 24 -- |
13 |
.../binutils-config/binutils-config-4-r4.ebuild | 28 -- |
14 |
sys-devel/binutils-config/binutils-config-4.ebuild | 24 -- |
15 |
sys-devel/binutils-config/files/binutils-config-4 | 465 -------------------- |
16 |
.../binutils-config/files/binutils-config-5.orig | 479 --------------------- |
17 |
7 files changed, 1 insertion(+), 1044 deletions(-) |
18 |
|
19 |
diff --git a/sys-devel/binutils-config/Manifest b/sys-devel/binutils-config/Manifest |
20 |
index 532217b..bdbd34c 100644 |
21 |
--- a/sys-devel/binutils-config/Manifest |
22 |
+++ b/sys-devel/binutils-config/Manifest |
23 |
@@ -1,3 +1,4 @@ |
24 |
+AUX binutils-config-2 11440 SHA256 5e923d1445910b9b9d1e455e52313087098689359846db0dc3fa52d33b63b192 SHA512 16b8bc2277bb50fb803377b192368a7abf7c97b5959bdd0d67fcf508220164d29ee2cfc1526ecfce7125b7492a0a5e4f094e948fa5ba9af44487229af3d91197 WHIRLPOOL 3acedb96e6c0c97e2223aa5fffcfb59f7e7b311c883e1557191db14b166a01d14ecd6eafbd4a4dbd33ceb2ca388fa7bf54d8291a24bb5e26a5634e2c8fb2a2df |
25 |
AUX binutils-config-4 11570 SHA256 09ca8e043c07da03ea247bb8cff2777d989f8d435421299de59307c78db1cd8b SHA512 cd987bada67cc222230c3592edf5391caa6c5fcb15081f9acb40befdd351f8a539bde8b9d921cb5c13d6f246b5eecf4fdda9f49bf899f086c966ff6fe558c12e WHIRLPOOL e840e7c1137c4598bdd7989f584d18cefa820c86d74d8755718f5aa5e572e79e669cecff23ba6bfc0027110991e5f72c457cb15c910c4bb1e60b8d1e6f660b86 |
26 |
AUX binutils-config-5 12290 SHA256 cc2c12e218d02b5d2bcfdbee27e14d0769a8fbcb0f0d69d2baec65672752debe SHA512 c3334ff4a07a56246abfb32823c098d977c92a849de84a360a7d103c64abd7ed29c4fc03eff029781bd15a01270e63d4b718a7697a99306d1f639e54e3b4ea91 WHIRLPOOL c5371d7f4e71fcd16e9f7233d7303f08298f599d9fc7059e9e373865b75863f44860b2c6177cd9edb6123b88c32c3048c08f3c930c74f744b776c5fc77715f48 |
27 |
AUX binutils-config-5.orig 12023 SHA256 261c32814ec804961bb919a53db58618e765784bd646d635455c8ca96c5ed7df SHA512 61d8b1849661ff8424635abc06c14e92cbbe7c8f23ce1d96d0297d3f569ddc5cf52f29aab18be276b70dc85d320b0699c960631dfffc583ba5e232a6731df14f WHIRLPOOL cc07c5e9deec78a053d44b79cd714c43815d73e93fbae795335c688bc14cdc71fbc232c9c1b47e2f73f2f0b65e8c0a3a83aec5747d89a52096eab302315dbe4b |
28 |
|
29 |
diff --git a/sys-devel/binutils-config/binutils-config-4-r2.ebuild b/sys-devel/binutils-config/binutils-config-4-r2.ebuild |
30 |
deleted file mode 100644 |
31 |
index ed29997..0000000 |
32 |
--- a/sys-devel/binutils-config/binutils-config-4-r2.ebuild |
33 |
+++ /dev/null |
34 |
@@ -1,24 +0,0 @@ |
35 |
-# Copyright 1999-2015 Gentoo Foundation |
36 |
-# Distributed under the terms of the GNU General Public License v2 |
37 |
-# $Id$ |
38 |
- |
39 |
-EAPI="4" |
40 |
- |
41 |
-DESCRIPTION="Utility to change the binutils version being used" |
42 |
-HOMEPAGE="https://www.gentoo.org/" |
43 |
-SRC_URI="" |
44 |
- |
45 |
-LICENSE="GPL-2" |
46 |
-SLOT="0" |
47 |
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
48 |
-IUSE="" |
49 |
- |
50 |
-# We also RDEPEND on sys-apps/findutils which is in base @system |
51 |
-RDEPEND="sys-apps/gentoo-functions" |
52 |
- |
53 |
-S=${WORKDIR} |
54 |
- |
55 |
-src_install() { |
56 |
- newbin "${FILESDIR}"/${PN}-${PV} ${PN} |
57 |
- doman "${FILESDIR}"/${PN}.8 |
58 |
-} |
59 |
|
60 |
diff --git a/sys-devel/binutils-config/binutils-config-4-r3.ebuild b/sys-devel/binutils-config/binutils-config-4-r3.ebuild |
61 |
deleted file mode 100644 |
62 |
index 58ade48..0000000 |
63 |
--- a/sys-devel/binutils-config/binutils-config-4-r3.ebuild |
64 |
+++ /dev/null |
65 |
@@ -1,24 +0,0 @@ |
66 |
-# Copyright 1999-2015 Gentoo Foundation |
67 |
-# Distributed under the terms of the GNU General Public License v2 |
68 |
-# $Id$ |
69 |
- |
70 |
-EAPI="4" |
71 |
- |
72 |
-DESCRIPTION="Utility to change the binutils version being used" |
73 |
-HOMEPAGE="https://www.gentoo.org/" |
74 |
-SRC_URI="" |
75 |
- |
76 |
-LICENSE="GPL-2" |
77 |
-SLOT="0" |
78 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
79 |
-IUSE="" |
80 |
- |
81 |
-# We also RDEPEND on sys-apps/findutils which is in base @system |
82 |
-RDEPEND="sys-apps/gentoo-functions" |
83 |
- |
84 |
-S=${WORKDIR} |
85 |
- |
86 |
-src_install() { |
87 |
- newbin "${FILESDIR}"/${PN}-${PV} ${PN} |
88 |
- doman "${FILESDIR}"/${PN}.8 |
89 |
-} |
90 |
|
91 |
diff --git a/sys-devel/binutils-config/binutils-config-4-r4.ebuild b/sys-devel/binutils-config/binutils-config-4-r4.ebuild |
92 |
deleted file mode 100644 |
93 |
index c70e4bb..0000000 |
94 |
--- a/sys-devel/binutils-config/binutils-config-4-r4.ebuild |
95 |
+++ /dev/null |
96 |
@@ -1,28 +0,0 @@ |
97 |
-# Copyright 1999-2015 Gentoo Foundation |
98 |
-# Distributed under the terms of the GNU General Public License v2 |
99 |
-# $Id$ |
100 |
- |
101 |
-EAPI="4" |
102 |
- |
103 |
-DESCRIPTION="Utility to change the binutils version being used" |
104 |
-HOMEPAGE="https://www.gentoo.org/" |
105 |
-SRC_URI="" |
106 |
- |
107 |
-LICENSE="GPL-2" |
108 |
-SLOT="0" |
109 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
110 |
-IUSE="" |
111 |
- |
112 |
-# We also RDEPEND on sys-apps/findutils which is in base @system |
113 |
-RDEPEND="sys-apps/gentoo-functions |
114 |
- !<app-admin/eselect-1.4.5" |
115 |
- |
116 |
-S=${WORKDIR} |
117 |
- |
118 |
-src_install() { |
119 |
- newbin "${FILESDIR}"/${PN}-${PV} ${PN} |
120 |
- doman "${FILESDIR}"/${PN}.8 |
121 |
- |
122 |
- insinto /usr/share/eselect/modules |
123 |
- doins "${FILESDIR}"/binutils.eselect |
124 |
-} |
125 |
|
126 |
diff --git a/sys-devel/binutils-config/binutils-config-4.ebuild b/sys-devel/binutils-config/binutils-config-4.ebuild |
127 |
deleted file mode 100644 |
128 |
index e709158..0000000 |
129 |
--- a/sys-devel/binutils-config/binutils-config-4.ebuild |
130 |
+++ /dev/null |
131 |
@@ -1,24 +0,0 @@ |
132 |
-# Copyright 1999-2014 Gentoo Foundation |
133 |
-# Distributed under the terms of the GNU General Public License v2 |
134 |
-# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-4.ebuild,v 1.1 2014/07/29 11:15:38 vapier Exp $ |
135 |
- |
136 |
-EAPI="4" |
137 |
- |
138 |
-inherit prefix |
139 |
-DESCRIPTION="Utility to change the binutils version being used" |
140 |
-HOMEPAGE="http://www.gentoo.org/" |
141 |
-SRC_URI="" |
142 |
- |
143 |
-LICENSE="GPL-2" |
144 |
-SLOT="0" |
145 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
146 |
-IUSE="" |
147 |
- |
148 |
-S=${WORKDIR} |
149 |
- |
150 |
-src_install() { |
151 |
- cp "${FILESDIR}"/${PN}-${PV} "${T}"/ |
152 |
- eprefixify "${T}"/${PN}-${PV} |
153 |
- newbin "${T}"/${PN}-${PV} ${PN} |
154 |
- doman "${FILESDIR}"/${PN}.8 |
155 |
-} |
156 |
|
157 |
diff --git a/sys-devel/binutils-config/files/binutils-config-4 b/sys-devel/binutils-config/files/binutils-config-4 |
158 |
deleted file mode 100644 |
159 |
index 18fc00d..0000000 |
160 |
--- a/sys-devel/binutils-config/files/binutils-config-4 |
161 |
+++ /dev/null |
162 |
@@ -1,465 +0,0 @@ |
163 |
-#!/bin/bash |
164 |
-# Copyright 1999-2015 Gentoo Foundation |
165 |
-# Distributed under the terms of the GNU General Public License v2 |
166 |
-# $Id$ |
167 |
- |
168 |
-# Format of /etc/env.d/binutils/: |
169 |
-# config-TARGET: CURRENT=version for TARGET |
170 |
-# TARGET-VER: has a TARGET and VER variable |
171 |
- |
172 |
-: ${ROOT:=/} |
173 |
-[[ ${ROOT} != */ ]] && ROOT="${ROOT}/" |
174 |
-[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}" |
175 |
- |
176 |
-cd / |
177 |
- |
178 |
-trap ":" INT QUIT TSTP |
179 |
- |
180 |
-argv0=${0##*/} |
181 |
-FUNCTIONS_SH="/lib/gentoo/functions.sh" |
182 |
-source ${FUNCTIONS_SH} || { |
183 |
- echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2 |
184 |
- exit 1 |
185 |
-} |
186 |
-esyslog() { :; } |
187 |
-die() { eerror "${argv0}: $*"; exit 1; } |
188 |
-umask 022 |
189 |
- |
190 |
-usage() { |
191 |
-cat << USAGE_END |
192 |
-Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL} |
193 |
- |
194 |
-${HILITE}General Options:${NORMAL} |
195 |
- ${GOOD}-c, --get-current-profile${NORMAL} Print current profile |
196 |
- ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles |
197 |
- ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target |
198 |
- ${GOOD}-d, --debug${NORMAL} Execute with debug output |
199 |
- |
200 |
-${HILITE}General Cruft:${NORMAL} |
201 |
- ${GOOD}--linker${NORMAL} <linker> Switch to specified linker (if supported) |
202 |
- |
203 |
-Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL} |
204 |
-For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL} |
205 |
- |
206 |
-For more info, please see ${HILITE}binutils-config${NORMAL}(8). |
207 |
-USAGE_END |
208 |
- |
209 |
- exit ${1:-1} |
210 |
-} |
211 |
- |
212 |
-mv_if_diff() { |
213 |
- if cmp -s "$1" "$2" ; then |
214 |
- rm -f "$1" |
215 |
- else |
216 |
- mv -f "$1" "$2" |
217 |
- fi |
218 |
-} |
219 |
-atomic_ln() { |
220 |
- local target=$1 linkdir=$2 linkname=$3 linktmp linkfull |
221 |
- linktmp="${linkdir}/.binutils-config.tmp.${linkname}" |
222 |
- linkfull="${linkdir}/${linkname}" |
223 |
- if [[ -d ${linkfull} ]] ; then |
224 |
- # if linking to a dir, we need a little magic to |
225 |
- # make it atomic since `mv -T` is not portable |
226 |
- rm -rf "${linktmp}" |
227 |
- mkdir -p "${linktmp}" |
228 |
- ln -sf "${target}" "${linktmp}/${linkname}" |
229 |
- mv "${linktmp}/${linkname}" "${linktmp}/../" |
230 |
- rmdir "${linktmp}" |
231 |
- else |
232 |
- # `ln` will expand into unlink();symlink(); which |
233 |
- # is not atomic for a small amount of time, but |
234 |
- # `mv` is a single rename() call |
235 |
- ln -sf "${target}" "${linktmp}" |
236 |
- mv "${linktmp}" "${linkfull}" |
237 |
- fi |
238 |
-} |
239 |
- |
240 |
-setup_env() { |
241 |
- unset TARGET VER LIBPATH |
242 |
- source "${ENV_D}/${PROFILE}" |
243 |
- if [[ -z ${TARGET} ]] ; then |
244 |
- eerror "${PROFILE} is invalid (no \$TARGET defined) :(" |
245 |
- return 1 |
246 |
- fi |
247 |
- if [[ -z ${VER} ]] ; then |
248 |
- eerror "${PROFILE} is invalid (no \$VER defined) :(" |
249 |
- return 1 |
250 |
- fi |
251 |
- |
252 |
- # |
253 |
- # Generate binary symlinks |
254 |
- # |
255 |
- BINPATH="" |
256 |
- BINPATH_LINKS="" |
257 |
- if [[ ${TARGET} != ${HOST} ]] ; then |
258 |
- # |
259 |
- # Newer paths: /usr/${HOST}/${TARGET}/... |
260 |
- # Older paths: /usr/${TARGET}/... |
261 |
- # |
262 |
- if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then |
263 |
- BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER} |
264 |
- BINPATH_LINKS=/usr/libexec/gcc/${TARGET} |
265 |
- fi |
266 |
- fi |
267 |
- if [[ -z ${BINPATH} ]] ; then |
268 |
- BINPATH=/usr/${TARGET}/binutils-bin/${VER} |
269 |
- BINPATH_LINKS=/usr/${TARGET}/bin |
270 |
- fi |
271 |
-} |
272 |
- |
273 |
-switch_profile() { |
274 |
- ebegin "Switching to ${PROFILE}" |
275 |
- |
276 |
- setup_env || return 1 |
277 |
- |
278 |
- cd "${ROOT}/${BINPATH}" || exit 1 |
279 |
- mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin" |
280 |
- for x in * ; do |
281 |
- atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}" |
282 |
- atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin" "${TARGET}-${x}" |
283 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
284 |
- atomic_ln "${TARGET}-${x}" "${ROOT}/usr/bin" "${x}" |
285 |
- fi |
286 |
- done |
287 |
- |
288 |
- # |
289 |
- # Generate library / ldscripts symlinks |
290 |
- # |
291 |
- : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}} |
292 |
- cd "${ROOT}/${LIBPATH}" || exit 1 |
293 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
294 |
- dstlib=${ROOT}/usr/${HOST}/lib |
295 |
- else |
296 |
- dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib |
297 |
- fi |
298 |
- # When upgrading, we need to clean up ldscripts and libs |
299 |
- mkdir -p "${dstlib}" |
300 |
- rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts |
301 |
- atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts" |
302 |
- find -L "${dstlib}" -type l -exec rm -v {} + |
303 |
- for x in lib* ; do |
304 |
- atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}" |
305 |
- done |
306 |
- |
307 |
- # |
308 |
- # Generate include symlinks |
309 |
- # |
310 |
- INCPATH=${LIBPATH}/include |
311 |
- if [[ -d ${ROOT}/${INCPATH} ]] ; then |
312 |
- cd "${ROOT}/${INCPATH}" || exit 1 |
313 |
- if [[ ${HOST} == ${TARGET} ]] ; then |
314 |
- mkdir -p "${ROOT}/usr/include" |
315 |
- for x in * ; do |
316 |
- atomic_ln "${INCPATH}/${x}" "${ROOT}/usr/include" "${x}" |
317 |
- done |
318 |
- else |
319 |
- # Clean out old path -- cannot use '-exec {} +' syntax here |
320 |
- find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \; |
321 |
- rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null |
322 |
- rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null |
323 |
- rmdir "${ROOT}/usr/${TARGET}" >& /dev/null |
324 |
- fi |
325 |
- fi |
326 |
- |
327 |
- # |
328 |
- # Make sure proper paths get updated |
329 |
- # |
330 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
331 |
- DATAPATH=/usr/share/binutils-data/${TARGET}/${VER} |
332 |
- local e="${ROOT}"/etc/env.d/05binutils |
333 |
- local ee="${e}.tmp" |
334 |
- rm -f "${ee}" |
335 |
- [[ -d ${ROOT}/${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}" |
336 |
- [[ -d ${ROOT}/${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}" |
337 |
- # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ... |
338 |
- if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then |
339 |
- local l="${ROOT}"/etc/ld.so.conf.d/05binutils.conf |
340 |
- local ll="${l}.tmp" |
341 |
- echo "/usr/${TARGET}/lib" > "${ll}" |
342 |
- mv_if_diff "${ll}" "${l}" |
343 |
- else |
344 |
- echo "LDPATH=/usr/${TARGET}/lib" >> "${ee}" |
345 |
- fi |
346 |
- mv_if_diff "${ee}" "${e}" |
347 |
- fi |
348 |
- |
349 |
- local c="${ENV_D}/config-${TARGET}" |
350 |
- local cc="${c}.tmp" |
351 |
- echo "CURRENT=${VER}" > "${cc}" |
352 |
- mv_if_diff "${cc}" "${c}" |
353 |
- |
354 |
- eend 0 |
355 |
- |
356 |
- # |
357 |
- # Regen env.d if need/can be |
358 |
- # |
359 |
- if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then |
360 |
- env-update |
361 |
- echo |
362 |
- ewarn "Please remember to run:" |
363 |
- echo |
364 |
- ewarn " # . /etc/profile" |
365 |
- echo |
366 |
- fi |
367 |
- |
368 |
- return 0 |
369 |
-} |
370 |
- |
371 |
-uninstall_target() { |
372 |
- : ${TARGET:=${UARG}} |
373 |
- |
374 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
375 |
- die "refusing to uninstall native binutils" |
376 |
- fi |
377 |
- |
378 |
- shopt -s nullglob |
379 |
- PROFILE="" |
380 |
- |
381 |
- for PROFILE in "${ENV_D}"/${TARGET}-* ; do |
382 |
- ewarn "Removing all signs of ${PROFILE##*/}" |
383 |
- rm -f "${ENV_D}"/${PROFILE} |
384 |
- done |
385 |
- if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then |
386 |
- die "no profiles exist for '${TARGET}'" |
387 |
- fi |
388 |
- |
389 |
- rm -f "${ENV_D}"/config-${TARGET} |
390 |
- |
391 |
- local x |
392 |
- for x in \ |
393 |
- addr2line ar as c++filt elf2flt elfedit flthdr gprof \ |
394 |
- ld ld.{bfd,gold,real} \ |
395 |
- nm objcopy objdump ranlib readelf size strings strip |
396 |
- do |
397 |
- x=( |
398 |
- "${ROOT}"/usr/bin/${TARGET}-${x} |
399 |
- "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x} |
400 |
- "${ROOT}"/usr/libexec/gcc/${TARGET}/${x} |
401 |
- ) |
402 |
- rm -f "${x[@]}" |
403 |
- done |
404 |
- for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do |
405 |
- rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x} |
406 |
- done |
407 |
- for x in bfd iberty opcodes ; do |
408 |
- rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la} |
409 |
- done |
410 |
- # Delete broken symlinks |
411 |
- local destdir="${ROOT}/usr/${HOST}/${TARGET}" |
412 |
- rm -f "${destdir}"/lib/ldscripts |
413 |
- find -L "${destdir}"/lib -type l -exec rm {} + |
414 |
- rmdir \ |
415 |
- "${destdir}"/{bin,include,lib,usr} \ |
416 |
- "${destdir}" \ |
417 |
- "${ROOT}"/var/db/pkg/cross-${TARGET} \ |
418 |
- "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin \ |
419 |
- "${ROOT}"/usr/libexec/gcc/${TARGET} \ |
420 |
- 2>/dev/null |
421 |
- |
422 |
- rm -f "${ENV_D}"/${TARGET}-* |
423 |
-} |
424 |
- |
425 |
-set_current_profile() { |
426 |
- if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then |
427 |
- eerror "${argv0}: unable to locate a profile for target: ${TARGET}" |
428 |
- return 1 |
429 |
- fi |
430 |
- |
431 |
- source "${ENV_D}/config-${TARGET}" |
432 |
- |
433 |
- if [[ -z ${CURRENT} ]] ; then |
434 |
- eerror "${argv0}: no binutils profile is active!" |
435 |
- return 1 |
436 |
- fi |
437 |
- |
438 |
- echo "${TARGET}-${CURRENT}" |
439 |
- |
440 |
- return 0 |
441 |
-} |
442 |
-get_current_profile() { echo "${PROFILE}" ; } |
443 |
- |
444 |
-list_profiles() { |
445 |
- local x i target |
446 |
- |
447 |
- if [[ ${ROOT} != / ]] ; then |
448 |
- echo "Using binutils-config info in ${ROOT}" |
449 |
- fi |
450 |
- |
451 |
- set -- "${ENV_D}"/* |
452 |
- target= |
453 |
- i=1 |
454 |
- |
455 |
- for x ; do |
456 |
- # skip broken links and config files |
457 |
- [[ -f ${x} ]] || continue |
458 |
- [[ ${x} == */config-* ]] && continue |
459 |
- |
460 |
- source "${x}" |
461 |
- if [[ ${target} != ${TARGET} ]] ; then |
462 |
- [[ -n ${target} ]] && echo |
463 |
- target=${TARGET} |
464 |
- fi |
465 |
- |
466 |
- x=${x##*/} |
467 |
- if [[ -e ${ENV_D}/config-${TARGET} ]] ; then |
468 |
- source "${ENV_D}/config-${TARGET}" |
469 |
- if [[ ${VER} == ${CURRENT} ]] ; then |
470 |
- [[ ${TARGET} == ${HOST} ]] \ |
471 |
- && x="${x} ${GOOD}*${NORMAL}" \ |
472 |
- || x="${x} ${HILITE}*${NORMAL}" |
473 |
- fi |
474 |
- fi |
475 |
- |
476 |
- # We would align the [...] field like so: |
477 |
- #printf ' [%*ss] %s\n' ${##} "${i}" "${x}" |
478 |
- # but this breaks simple scripting: `binutils -l | awk '{print $2}'` |
479 |
- |
480 |
- # Or we could align the target col like so: |
481 |
- #printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}" |
482 |
- # but i'm not sold that it looks better |
483 |
- |
484 |
- # So keep it simple ... only makes a diff anyways for crazy people |
485 |
- # like me which have 100+ binutils packages installed ... |
486 |
- echo " [$i] ${x}" |
487 |
- ((++i)) |
488 |
- done |
489 |
-} |
490 |
- |
491 |
-switch_linker() { |
492 |
- local bpath ld=$1 |
493 |
- |
494 |
- case ${ld} in |
495 |
- ld.*) ;; |
496 |
- *) die "not supported: linker must start with 'ld.'" ;; |
497 |
- esac |
498 |
- |
499 |
- setup_env || return 1 |
500 |
- bpath="${ROOT}/${BINPATH}" |
501 |
- |
502 |
- # does this binutils even support the requested linker ? |
503 |
- if [[ ! -e ${bpath}/${ld} ]] ; then |
504 |
- die "sorry, but ${PROFILE} doesn't support the ${ld} linker" |
505 |
- fi |
506 |
- |
507 |
- # switch it up |
508 |
- ebegin "Setting default linker to ${ld} for ${PROFILE}" |
509 |
- atomic_ln ${ld} "${bpath}" ld |
510 |
- eend $? |
511 |
-} |
512 |
- |
513 |
-set_HOST() { |
514 |
- # Set HOST to CHOST if it isn't already set |
515 |
- : ${HOST:=${CHOST:-$(portageq envvar CHOST)}} |
516 |
-} |
517 |
- |
518 |
-ENV_D="${ROOT}etc/env.d/binutils" |
519 |
- |
520 |
-DEBUG="no" |
521 |
-NEED_ACTION="yes" |
522 |
-DOIT="switch_profile" |
523 |
-PROFILE="current" |
524 |
-HOST="" |
525 |
-TARGET="" |
526 |
-unset UARG |
527 |
- |
528 |
-select_action() { |
529 |
- if [[ ${NEED_ACTION} != "no" ]] ; then |
530 |
- NEED_ACTION="no" |
531 |
- DOIT=$1 |
532 |
- else |
533 |
- die "one action at a time!" |
534 |
- fi |
535 |
-} |
536 |
- |
537 |
-while [[ $# -gt 0 ]] ; do |
538 |
- x=$1 |
539 |
- shift |
540 |
- case ${x} in |
541 |
- -c|--get-current-profile) select_action get_current_profile ;; |
542 |
- -l|--list|--list-profiles) select_action list_profiles ;; |
543 |
- -u|--uninstall) select_action uninstall_target ;; |
544 |
- --linker) select_action "switch_linker $1"; shift ;; |
545 |
- -d|--debug) DEBUG="yes" ;; |
546 |
- -h|--help) usage 0 ;; |
547 |
- -V|--version) |
548 |
- unset Header |
549 |
- cvsver="$Id$" |
550 |
- cvsver=${cvsver##*binutils-config-} |
551 |
- bver=${cvsver%%,v *} |
552 |
- cvsver=${cvsver#* } |
553 |
- echo "binutils-config-${bver} (r${cvsver%% *})" |
554 |
- exit 0 |
555 |
- ;; |
556 |
- -*) |
557 |
- die "invalid switch! Try '--help'." |
558 |
- ;; |
559 |
- *) |
560 |
- if [[ ${UARG+set} == "set" ]] ; then |
561 |
- die "only one profile/target at a time please" |
562 |
- fi |
563 |
- NEED_ACTION="maybe" |
564 |
- UARG=${x} |
565 |
- ;; |
566 |
- esac |
567 |
-done |
568 |
- |
569 |
-[[ ${NEED_ACTION} == "yes" ]] && usage 1 |
570 |
-[[ ${DEBUG} == "yes" ]] && set -x |
571 |
- |
572 |
-# All operations need to know the current HOST to figure out |
573 |
-# what is a native target and what is a cross target |
574 |
-set_HOST |
575 |
- |
576 |
-# All operations need to know the profile the user wants |
577 |
-case ${DOIT} in |
578 |
-switch_profile|switch_linker_*) |
579 |
- # decode user's profile choice |
580 |
- x=${UARG:-$(TARGET=${HOST} set_current_profile)} |
581 |
- PROFILE="" |
582 |
- if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then |
583 |
- # User gave us a # representing the profile |
584 |
- i=1 |
585 |
- for y in "${ENV_D}"/* ; do |
586 |
- [[ ${y/config-} != ${y} ]] && continue |
587 |
- |
588 |
- if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then |
589 |
- PROFILE=${y##*/} |
590 |
- break |
591 |
- fi |
592 |
- ((++i)) |
593 |
- done |
594 |
- fi |
595 |
- |
596 |
- if [[ -z ${PROFILE} ]] ; then |
597 |
- # User gave us a full HOST-ver |
598 |
- x=${x##*/} |
599 |
- if [[ -f ${ENV_D}/${x} ]] ; then |
600 |
- # Valid HOST-ver yeah! |
601 |
- PROFILE=${x} |
602 |
- else |
603 |
- # Not a valid HOST-ver ... |
604 |
- if [[ ! -f ${ENV_D}/config-${x} ]] ; then |
605 |
- # Maybe they just gave us a ver ... |
606 |
- if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then |
607 |
- x=${HOST}-${x} |
608 |
- else |
609 |
- die "could not locate '$x' in '${ENV_D}/'!" |
610 |
- fi |
611 |
- PROFILE=${x} |
612 |
- else |
613 |
- # Maybe they just gave us a target ... pick active profile |
614 |
- PROFILE=$(TARGET=${x} set_current_profile) |
615 |
- fi |
616 |
- fi |
617 |
- fi |
618 |
- ;; |
619 |
-*) |
620 |
- # lookup current profile as the user gave us a target |
621 |
- PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1 |
622 |
- ;; |
623 |
-esac |
624 |
- |
625 |
-eval ${DOIT} |
626 |
- |
627 |
-# vim:ts=4 |
628 |
|
629 |
diff --git a/sys-devel/binutils-config/files/binutils-config-5.orig b/sys-devel/binutils-config/files/binutils-config-5.orig |
630 |
deleted file mode 100755 |
631 |
index 3afc963..0000000 |
632 |
--- a/sys-devel/binutils-config/files/binutils-config-5.orig |
633 |
+++ /dev/null |
634 |
@@ -1,479 +0,0 @@ |
635 |
-#!/bin/bash |
636 |
-# Copyright 1999-2015 Gentoo Foundation |
637 |
-# Distributed under the terms of the GNU General Public License v2 |
638 |
-# $Id$ |
639 |
- |
640 |
-# Format of /etc/env.d/binutils/: |
641 |
-# config-TARGET: CURRENT=version for TARGET |
642 |
-# TARGET-VER: has a TARGET and VER variable |
643 |
- |
644 |
-: ${ROOT:=/} |
645 |
-[[ ${ROOT} != */ ]] && ROOT="${ROOT}/" |
646 |
-[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}" |
647 |
- |
648 |
-cd / |
649 |
- |
650 |
-trap ":" INT QUIT TSTP |
651 |
- |
652 |
-argv0=${0##*/} |
653 |
-FUNCTIONS_SH="/lib/gentoo/functions.sh" |
654 |
-source ${FUNCTIONS_SH} || { |
655 |
- echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2 |
656 |
- exit 1 |
657 |
-} |
658 |
-esyslog() { :; } |
659 |
-die() { eerror "${argv0}: $*"; exit 1; } |
660 |
-umask 022 |
661 |
- |
662 |
-usage() { |
663 |
-cat << USAGE_END |
664 |
-Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL} |
665 |
- |
666 |
-${HILITE}General Options:${NORMAL} |
667 |
- ${GOOD}-c, --get-current-profile${NORMAL} Print current profile |
668 |
- ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles |
669 |
- ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target |
670 |
- ${GOOD}-d, --debug${NORMAL} Execute with debug output |
671 |
- |
672 |
-${HILITE}General Cruft:${NORMAL} |
673 |
- ${GOOD}--linker${NORMAL} <linker> Switch to specified linker (if supported) |
674 |
- |
675 |
-Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL} |
676 |
-For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL} |
677 |
- |
678 |
-For more info, please see ${HILITE}binutils-config${NORMAL}(8). |
679 |
-USAGE_END |
680 |
- |
681 |
- exit ${1:-1} |
682 |
-} |
683 |
- |
684 |
-mv_if_diff() { |
685 |
- if cmp -s "$1" "$2" ; then |
686 |
- rm -f "$1" |
687 |
- else |
688 |
- mv -f "$1" "$2" |
689 |
- fi |
690 |
-} |
691 |
-atomic_ln() { |
692 |
- local target=$1 linkdir=$2 linkname=$3 linktmp linkfull |
693 |
- linktmp="${linkdir}/.binutils-config.tmp.${linkname}" |
694 |
- linkfull="${linkdir}/${linkname}" |
695 |
- if [[ -d ${linkfull} ]] ; then |
696 |
- # if linking to a dir, we need a little magic to |
697 |
- # make it atomic since `mv -T` is not portable |
698 |
- rm -rf "${linktmp}" |
699 |
- mkdir -p "${linktmp}" |
700 |
- ln -sf "${target}" "${linktmp}/${linkname}" |
701 |
- mv "${linktmp}/${linkname}" "${linktmp}/../" |
702 |
- rmdir "${linktmp}" |
703 |
- else |
704 |
- # `ln` will expand into unlink();symlink(); which |
705 |
- # is not atomic for a small amount of time, but |
706 |
- # `mv` is a single rename() call |
707 |
- ln -sf "${target}" "${linktmp}" |
708 |
- mv "${linktmp}" "${linkfull}" |
709 |
- fi |
710 |
-} |
711 |
- |
712 |
-setup_env() { |
713 |
- unset TARGET VER LIBPATH |
714 |
- source "${ENV_D}/${PROFILE}" |
715 |
- if [[ -z ${TARGET} ]] ; then |
716 |
- eerror "${PROFILE} is invalid (no \$TARGET defined) :(" |
717 |
- return 1 |
718 |
- fi |
719 |
- if [[ -z ${VER} ]] ; then |
720 |
- eerror "${PROFILE} is invalid (no \$VER defined) :(" |
721 |
- return 1 |
722 |
- fi |
723 |
- |
724 |
- # |
725 |
- # Generate binary symlinks |
726 |
- # |
727 |
- BINPATH="" |
728 |
- BINPATH_LINKS="" |
729 |
- if [[ ${TARGET} != ${HOST} ]] ; then |
730 |
- # |
731 |
- # Newer paths: /usr/${HOST}/${TARGET}/... |
732 |
- # Older paths: /usr/${TARGET}/... |
733 |
- # |
734 |
- if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then |
735 |
- BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER} |
736 |
- BINPATH_LINKS=/usr/libexec/gcc/${TARGET} |
737 |
- fi |
738 |
- fi |
739 |
- if [[ -z ${BINPATH} ]] ; then |
740 |
- BINPATH=/usr/${TARGET}/binutils-bin/${VER} |
741 |
- BINPATH_LINKS=/usr/${TARGET}/bin |
742 |
- fi |
743 |
-} |
744 |
- |
745 |
-# Lists of headers that various versions have installed. |
746 |
-HEADERS=( |
747 |
- ansidecl.h bfd.h bfdlink.h demangle.h dis-asm.h dyn-string.h |
748 |
- fibheap.h hashtab.h libiberty.h objalloc.h plugin-api.h |
749 |
- splay-tree.h symcat.h |
750 |
-) |
751 |
- |
752 |
-switch_profile() { |
753 |
- local x |
754 |
- |
755 |
- ebegin "Switching to ${PROFILE}" |
756 |
- |
757 |
- setup_env || return 1 |
758 |
- |
759 |
- cd "${ROOT}/${BINPATH}" || exit 1 |
760 |
- mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin" |
761 |
- for x in * ; do |
762 |
- atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}" |
763 |
- atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin" "${TARGET}-${x}" |
764 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
765 |
- atomic_ln "${TARGET}-${x}" "${ROOT}/usr/bin" "${x}" |
766 |
- fi |
767 |
- done |
768 |
- |
769 |
- # |
770 |
- # Generate library / ldscripts symlinks |
771 |
- # |
772 |
- : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}} |
773 |
- cd "${ROOT}/${LIBPATH}" || exit 1 |
774 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
775 |
- dstlib=${ROOT}/usr/${HOST}/lib |
776 |
- else |
777 |
- dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib |
778 |
- fi |
779 |
- # When upgrading, we need to clean up ldscripts and libs. |
780 |
- # Don't symlink back in the libs -- the binutils-lib package handles |
781 |
- # these now. |
782 |
- # TODO: Stop requiring even the ldscripts symlink. |
783 |
- mkdir -p "${dstlib}" |
784 |
- rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts |
785 |
- atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts" |
786 |
- find -L "${dstlib}" -xtype l -name 'lib*' -exec rm -f {} + |
787 |
- |
788 |
- # |
789 |
- # Clean out old generated include symlinks |
790 |
- # |
791 |
- INCPATH=${LIBPATH}/include |
792 |
- if [[ -d ${ROOT}/${INCPATH} ]] ; then |
793 |
- cd "${ROOT}/${INCPATH}" || exit 1 |
794 |
- if [[ ${HOST} == ${TARGET} ]] ; then |
795 |
- # The binutils-lib package handles these files now. |
796 |
- for x in libiberty "${HEADERS[@]}" ; do |
797 |
- x="${ROOT}/usr/include/${x}" |
798 |
- if [[ -L ${x} ]] ; then |
799 |
- rm "${x}" |
800 |
- fi |
801 |
- done |
802 |
- else |
803 |
- # Clean out old path -- cannot use '-exec {} +' syntax here |
804 |
- find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \; |
805 |
- rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null |
806 |
- rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null |
807 |
- rmdir "${ROOT}/usr/${TARGET}" >& /dev/null |
808 |
- fi |
809 |
- fi |
810 |
- |
811 |
- # |
812 |
- # Make sure proper paths get updated |
813 |
- # |
814 |
- local env_update_flag="--no-ldconfig" |
815 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
816 |
- # Delete old config now that binutils-libs installs these files. |
817 |
- # Note: This skips ldconfig update if env.d had LDPATH, but meh. |
818 |
- # Most people have upgraded to ld.so.conf.d, and someone else will |
819 |
- # eventually re-run ldconfig for us. |
820 |
- x="${ROOT}"/etc/ld.so.conf.d/05binutils.conf |
821 |
- if [[ -e ${x} ]]; then |
822 |
- rm -f "${x}" |
823 |
- env_update_flag="" |
824 |
- fi |
825 |
- |
826 |
- DATAPATH=/usr/share/binutils-data/${TARGET}/${VER} |
827 |
- local e="${ROOT}"/etc/env.d/05binutils |
828 |
- local ee="${e}.tmp" |
829 |
- rm -f "${ee}" |
830 |
- [[ -d ${ROOT}/${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}" |
831 |
- [[ -d ${ROOT}/${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}" |
832 |
- mv_if_diff "${ee}" "${e}" |
833 |
- fi |
834 |
- |
835 |
- local c="${ENV_D}/config-${TARGET}" |
836 |
- local cc="${c}.tmp" |
837 |
- echo "CURRENT=${VER}" > "${cc}" |
838 |
- mv_if_diff "${cc}" "${c}" |
839 |
- |
840 |
- eend 0 |
841 |
- |
842 |
- # |
843 |
- # Regen env.d if need/can be |
844 |
- # |
845 |
- if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then |
846 |
- env-update ${env_update_flag} |
847 |
- echo |
848 |
- ewarn "Please remember to run:" |
849 |
- echo |
850 |
- ewarn " # . /etc/profile" |
851 |
- echo |
852 |
- fi |
853 |
- |
854 |
- return 0 |
855 |
-} |
856 |
- |
857 |
-uninstall_target() { |
858 |
- : ${TARGET:=${UARG}} |
859 |
- |
860 |
- if [[ ${TARGET} == ${HOST} ]] ; then |
861 |
- die "refusing to uninstall native binutils" |
862 |
- fi |
863 |
- |
864 |
- shopt -s nullglob |
865 |
- PROFILE="" |
866 |
- |
867 |
- for PROFILE in "${ENV_D}"/${TARGET}-* ; do |
868 |
- ewarn "Removing all signs of ${PROFILE##*/}" |
869 |
- rm -f "${ENV_D}"/${PROFILE} |
870 |
- done |
871 |
- if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then |
872 |
- die "no profiles exist for '${TARGET}'" |
873 |
- fi |
874 |
- |
875 |
- rm -f "${ENV_D}"/config-${TARGET} |
876 |
- |
877 |
- local x |
878 |
- for x in \ |
879 |
- addr2line ar as c++filt elf2flt elfedit flthdr gprof \ |
880 |
- ld ld.{bfd,gold,real} \ |
881 |
- nm objcopy objdump ranlib readelf size strings strip |
882 |
- do |
883 |
- x=( |
884 |
- "${ROOT}"/usr/bin/${TARGET}-${x} |
885 |
- "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x} |
886 |
- "${ROOT}"/usr/libexec/gcc/${TARGET}/${x} |
887 |
- ) |
888 |
- rm -f "${x[@]}" |
889 |
- done |
890 |
- for x in "${HEADERS[@]}" ; do |
891 |
- rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x} |
892 |
- done |
893 |
- for x in bfd iberty opcodes ; do |
894 |
- rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la} |
895 |
- done |
896 |
- # Delete broken symlinks |
897 |
- local destdir="${ROOT}/usr/${HOST}/${TARGET}" |
898 |
- rm -f "${destdir}"/lib/ldscripts |
899 |
- find -L "${destdir}"/lib -type l -exec rm {} + |
900 |
- rmdir \ |
901 |
- "${destdir}"/{bin,include,lib,usr} \ |
902 |
- "${destdir}" \ |
903 |
- "${ROOT}"/var/db/pkg/cross-${TARGET} \ |
904 |
- "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin \ |
905 |
- "${ROOT}"/usr/libexec/gcc/${TARGET} \ |
906 |
- 2>/dev/null |
907 |
- |
908 |
- rm -f "${ENV_D}"/${TARGET}-* |
909 |
-} |
910 |
- |
911 |
-set_current_profile() { |
912 |
- if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then |
913 |
- eerror "${argv0}: unable to locate a profile for target: ${TARGET}" |
914 |
- return 1 |
915 |
- fi |
916 |
- |
917 |
- source "${ENV_D}/config-${TARGET}" |
918 |
- |
919 |
- if [[ -z ${CURRENT} ]] ; then |
920 |
- eerror "${argv0}: no binutils profile is active!" |
921 |
- return 1 |
922 |
- fi |
923 |
- |
924 |
- echo "${TARGET}-${CURRENT}" |
925 |
- |
926 |
- return 0 |
927 |
-} |
928 |
-get_current_profile() { echo "${PROFILE}" ; } |
929 |
- |
930 |
-list_profiles() { |
931 |
- local x i target |
932 |
- |
933 |
- if [[ ${ROOT} != / ]] ; then |
934 |
- echo "Using binutils-config info in ${ROOT}" |
935 |
- fi |
936 |
- |
937 |
- set -- "${ENV_D}"/* |
938 |
- target= |
939 |
- i=1 |
940 |
- |
941 |
- for x ; do |
942 |
- # skip broken links and config files |
943 |
- [[ -f ${x} ]] || continue |
944 |
- [[ ${x} == */config-* ]] && continue |
945 |
- |
946 |
- source "${x}" |
947 |
- if [[ ${target} != ${TARGET} ]] ; then |
948 |
- [[ -n ${target} ]] && echo |
949 |
- target=${TARGET} |
950 |
- fi |
951 |
- |
952 |
- x=${x##*/} |
953 |
- if [[ -e ${ENV_D}/config-${TARGET} ]] ; then |
954 |
- source "${ENV_D}/config-${TARGET}" |
955 |
- if [[ ${VER} == ${CURRENT} ]] ; then |
956 |
- [[ ${TARGET} == ${HOST} ]] \ |
957 |
- && x="${x} ${GOOD}*${NORMAL}" \ |
958 |
- || x="${x} ${HILITE}*${NORMAL}" |
959 |
- fi |
960 |
- fi |
961 |
- |
962 |
- # We would align the [...] field like so: |
963 |
- #printf ' [%*ss] %s\n' ${##} "${i}" "${x}" |
964 |
- # but this breaks simple scripting: `binutils -l | awk '{print $2}'` |
965 |
- |
966 |
- # Or we could align the target col like so: |
967 |
- #printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}" |
968 |
- # but i'm not sold that it looks better |
969 |
- |
970 |
- # So keep it simple ... only makes a diff anyways for crazy people |
971 |
- # like me which have 100+ binutils packages installed ... |
972 |
- echo " [$i] ${x}" |
973 |
- ((++i)) |
974 |
- done |
975 |
-} |
976 |
- |
977 |
-switch_linker() { |
978 |
- local bpath ld=$1 |
979 |
- |
980 |
- case ${ld} in |
981 |
- ld.*) ;; |
982 |
- *) die "not supported: linker must start with 'ld.'" ;; |
983 |
- esac |
984 |
- |
985 |
- setup_env || return 1 |
986 |
- bpath="${ROOT}/${BINPATH}" |
987 |
- |
988 |
- # does this binutils even support the requested linker ? |
989 |
- if [[ ! -e ${bpath}/${ld} ]] ; then |
990 |
- die "sorry, but ${PROFILE} doesn't support the ${ld} linker" |
991 |
- fi |
992 |
- |
993 |
- # switch it up |
994 |
- ebegin "Setting default linker to ${ld} for ${PROFILE}" |
995 |
- atomic_ln ${ld} "${bpath}" ld |
996 |
- eend $? |
997 |
-} |
998 |
- |
999 |
-set_HOST() { |
1000 |
- # Set HOST to CHOST if it isn't already set |
1001 |
- : ${HOST:=${CHOST:-$(portageq envvar CHOST)}} |
1002 |
-} |
1003 |
- |
1004 |
-ENV_D="${ROOT}etc/env.d/binutils" |
1005 |
- |
1006 |
-DEBUG="no" |
1007 |
-NEED_ACTION="yes" |
1008 |
-DOIT="switch_profile" |
1009 |
-PROFILE="current" |
1010 |
-HOST="" |
1011 |
-TARGET="" |
1012 |
-unset UARG |
1013 |
- |
1014 |
-select_action() { |
1015 |
- if [[ ${NEED_ACTION} != "no" ]] ; then |
1016 |
- NEED_ACTION="no" |
1017 |
- DOIT=$1 |
1018 |
- else |
1019 |
- die "one action at a time!" |
1020 |
- fi |
1021 |
-} |
1022 |
- |
1023 |
-while [[ $# -gt 0 ]] ; do |
1024 |
- x=$1 |
1025 |
- shift |
1026 |
- case ${x} in |
1027 |
- -c|--get-current-profile) select_action get_current_profile ;; |
1028 |
- -l|--list|--list-profiles) select_action list_profiles ;; |
1029 |
- -u|--uninstall) select_action uninstall_target ;; |
1030 |
- --linker) select_action "switch_linker $1"; shift ;; |
1031 |
- -d|--debug) DEBUG="yes" ;; |
1032 |
- -h|--help) usage 0 ;; |
1033 |
- -V|--version) |
1034 |
- unset Header |
1035 |
- cvsver="$Id$" |
1036 |
- cvsver=${cvsver##*binutils-config-} |
1037 |
- bver=${cvsver%%,v *} |
1038 |
- cvsver=${cvsver#* } |
1039 |
- echo "binutils-config-${bver} (r${cvsver%% *})" |
1040 |
- exit 0 |
1041 |
- ;; |
1042 |
- -*) |
1043 |
- die "invalid switch! Try '--help'." |
1044 |
- ;; |
1045 |
- *) |
1046 |
- if [[ ${UARG+set} == "set" ]] ; then |
1047 |
- die "only one profile/target at a time please" |
1048 |
- fi |
1049 |
- NEED_ACTION="maybe" |
1050 |
- UARG=${x} |
1051 |
- ;; |
1052 |
- esac |
1053 |
-done |
1054 |
- |
1055 |
-[[ ${NEED_ACTION} == "yes" ]] && usage 1 |
1056 |
-[[ ${DEBUG} == "yes" ]] && set -x |
1057 |
- |
1058 |
-# All operations need to know the current HOST to figure out |
1059 |
-# what is a native target and what is a cross target |
1060 |
-set_HOST |
1061 |
- |
1062 |
-# All operations need to know the profile the user wants |
1063 |
-case ${DOIT} in |
1064 |
-switch_profile|switch_linker_*) |
1065 |
- # decode user's profile choice |
1066 |
- x=${UARG:-$(TARGET=${HOST} set_current_profile)} |
1067 |
- PROFILE="" |
1068 |
- if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then |
1069 |
- # User gave us a # representing the profile |
1070 |
- i=1 |
1071 |
- for y in "${ENV_D}"/* ; do |
1072 |
- [[ ${y/config-} != ${y} ]] && continue |
1073 |
- |
1074 |
- if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then |
1075 |
- PROFILE=${y##*/} |
1076 |
- break |
1077 |
- fi |
1078 |
- ((++i)) |
1079 |
- done |
1080 |
- fi |
1081 |
- |
1082 |
- if [[ -z ${PROFILE} ]] ; then |
1083 |
- # User gave us a full HOST-ver |
1084 |
- x=${x##*/} |
1085 |
- if [[ -f ${ENV_D}/${x} ]] ; then |
1086 |
- # Valid HOST-ver yeah! |
1087 |
- PROFILE=${x} |
1088 |
- else |
1089 |
- # Not a valid HOST-ver ... |
1090 |
- if [[ ! -f ${ENV_D}/config-${x} ]] ; then |
1091 |
- # Maybe they just gave us a ver ... |
1092 |
- if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then |
1093 |
- x=${HOST}-${x} |
1094 |
- else |
1095 |
- die "could not locate '$x' in '${ENV_D}/'!" |
1096 |
- fi |
1097 |
- PROFILE=${x} |
1098 |
- else |
1099 |
- # Maybe they just gave us a target ... pick active profile |
1100 |
- PROFILE=$(TARGET=${x} set_current_profile) |
1101 |
- fi |
1102 |
- fi |
1103 |
- fi |
1104 |
- ;; |
1105 |
-*) |
1106 |
- # lookup current profile as the user gave us a target |
1107 |
- PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1 |
1108 |
- ;; |
1109 |
-esac |
1110 |
- |
1111 |
-eval ${DOIT} |
1112 |
- |
1113 |
-# vim:ts=4 |