Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/heroxbd:master commit in: sys-devel/binutils-config/files/, sys-devel/binutils-config/
Date: Mon, 21 Dec 2015 04:31:22
Message-Id: 1444309098.c439ad1e97f8d2ddd2d856a1c15cf6f71bb5b245.heroxbd@gentoo
1 commit: c439ad1e97f8d2ddd2d856a1c15cf6f71bb5b245
2 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 8 12:56:17 2015 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 8 12:58:18 2015 +0000
6 URL: https://gitweb.gentoo.org/dev/heroxbd.git/commit/?id=c439ad1e
7
8 sys-devel/binutils-config: -5 for RAP.
9
10 sys-devel/binutils-config/Manifest | 6 +-
11 .../binutils-config/binutils-config-1.9-r4.ebuild | 19 -
12 .../binutils-config/binutils-config-2-r1.ebuild | 19 -
13 .../binutils-config/binutils-config-3-r3.ebuild | 19 -
14 sys-devel/binutils-config/binutils-config-5.ebuild | 5 +-
15 .../binutils-config/files/binutils-config-1.9 | 410 ----------------
16 sys-devel/binutils-config/files/binutils-config-2 | 434 -----------------
17 sys-devel/binutils-config/files/binutils-config-3 | 515 ---------------------
18 sys-devel/binutils-config/files/binutils-config-5 | 71 +--
19 .../{binutils-config-5 => binutils-config-5.orig} | 0
20 10 files changed, 47 insertions(+), 1451 deletions(-)
21
22 diff --git a/sys-devel/binutils-config/Manifest b/sys-devel/binutils-config/Manifest
23 index 39d38f2..532217b 100644
24 --- a/sys-devel/binutils-config/Manifest
25 +++ b/sys-devel/binutils-config/Manifest
26 @@ -1,10 +1,12 @@
27 AUX binutils-config-4 11570 SHA256 09ca8e043c07da03ea247bb8cff2777d989f8d435421299de59307c78db1cd8b SHA512 cd987bada67cc222230c3592edf5391caa6c5fcb15081f9acb40befdd351f8a539bde8b9d921cb5c13d6f246b5eecf4fdda9f49bf899f086c966ff6fe558c12e WHIRLPOOL e840e7c1137c4598bdd7989f584d18cefa820c86d74d8755718f5aa5e572e79e669cecff23ba6bfc0027110991e5f72c457cb15c910c4bb1e60b8d1e6f660b86
28 -AUX binutils-config-5 12023 SHA256 261c32814ec804961bb919a53db58618e765784bd646d635455c8ca96c5ed7df SHA512 61d8b1849661ff8424635abc06c14e92cbbe7c8f23ce1d96d0297d3f569ddc5cf52f29aab18be276b70dc85d320b0699c960631dfffc583ba5e232a6731df14f WHIRLPOOL cc07c5e9deec78a053d44b79cd714c43815d73e93fbae795335c688bc14cdc71fbc232c9c1b47e2f73f2f0b65e8c0a3a83aec5747d89a52096eab302315dbe4b
29 +AUX binutils-config-5 12290 SHA256 cc2c12e218d02b5d2bcfdbee27e14d0769a8fbcb0f0d69d2baec65672752debe SHA512 c3334ff4a07a56246abfb32823c098d977c92a849de84a360a7d103c64abd7ed29c4fc03eff029781bd15a01270e63d4b718a7697a99306d1f639e54e3b4ea91 WHIRLPOOL c5371d7f4e71fcd16e9f7233d7303f08298f599d9fc7059e9e373865b75863f44860b2c6177cd9edb6123b88c32c3048c08f3c930c74f744b776c5fc77715f48
30 +AUX binutils-config-5.orig 12023 SHA256 261c32814ec804961bb919a53db58618e765784bd646d635455c8ca96c5ed7df SHA512 61d8b1849661ff8424635abc06c14e92cbbe7c8f23ce1d96d0297d3f569ddc5cf52f29aab18be276b70dc85d320b0699c960631dfffc583ba5e232a6731df14f WHIRLPOOL cc07c5e9deec78a053d44b79cd714c43815d73e93fbae795335c688bc14cdc71fbc232c9c1b47e2f73f2f0b65e8c0a3a83aec5747d89a52096eab302315dbe4b
31 AUX binutils-config.8 2837 SHA256 20817cd2e6e3a8ace12ada7b73ada556d597527adcad02876e522e0b6396d4a3 SHA512 66a260499c1100dc71469e4ca1e2b0f71410382138c381e6a6ed4e4aa19520607407ffa6a28e0388e0abe5ee86769b662cec29cdb2ff02cc6c05af64314db5d9 WHIRLPOOL 8bbc5c525b1c7a3ec147458569d570a3312034da2c75c1f31c4cd888db5205aa0a8c8ec061b2354d8ac80b43bdbdf1559a92e904dae5f681345fe758794c2535
32 AUX binutils.eselect 810 SHA256 e579d3bffc645730f396ebc01d9f9f1043ee8db5edb1f41d5aeadeedcf6aa295 SHA512 105d2c50fbe2a988e669810db3f2d278cb70c24ee85a16c85a3f63c6e8e9e32bd91f430e4f9ec347e0ccb1a88ca4edb2eba9cbda73356e44d0871cb7ab9eb203 WHIRLPOOL 5ae5fd07213e2be381824aea237aa2cc47a987a2ee6508fcd8f18424f8e3de89be71f1de781240af45b98f7525048be2ab7cb60893384efbcde8f8a92a32c73a
33 EBUILD binutils-config-4-r2.ebuild 589 SHA256 2ed036c4de98c14f8529cda7f20053fc46afa4f2d284a91c6dc2509f09823c5c SHA512 f4b5a3836a3e02a3c27ed30efe365feff8ace91c22fc9b53bce5e434b358067e2f6cdd5229c65df25794a1188327610423a76a216da96ea2a710e6c7c0e39e56 WHIRLPOOL ea5d882beb17908182762ac0159045b647858dbd73c535babfb82d67d4fd14da3c017e9ba729435ca6317175aaf5de896feecf52ba0e7e76cb47b5c3eeb02223
34 EBUILD binutils-config-4-r3.ebuild 602 SHA256 15ce445a5ff179785bc453db3284387c9c4131adc49a7ac1552842ed41a6a3f0 SHA512 e53331878b1ac1b9c748ec167965f02769f46a6fae9cc24bed3237c9e593b3eca67b25d49ab8c1d2a8b9cd5bd9aae0b33c445b4c0c3e4e62b05f7594a79af104 WHIRLPOOL 8694df18f030fd023ac79a5df65da7920bbdd4db4f80bba3bc7dbb072b90dcc641d1efca5aaea33b056bd077e3ac2479d027a16a1530884605480b9cd162ee34
35 EBUILD binutils-config-4-r4.ebuild 704 SHA256 fc57abc3f09896a2f89fa0ed0bf5be6160adf077c3d42d9af274d278f55e3687 SHA512 3df81f0b9d2a8257352239778bc7e153d03e081636eb5772d8e67625308ee2636cd9a1525df07ac44c743e80ccd285d060646e86c5656ace33ec04bbc1cf437b WHIRLPOOL fa222755455f5c7e93b592d641f29f7eb700c3158172bd4fc62452c2fdc1fa0fbb7dd08652ce550b1328750f9fc6386ac49a42a21450843c6872e4d4b1a32d5d
36 -EBUILD binutils-config-5.ebuild 1029 SHA256 9232e53f25ca5c17669b91007767c7ffb70374cfe85cb8702792e07483128011 SHA512 099451164d3704b8025eccb3135ce5988012072e746eaf284589d1371f11df4db7f7c26bd109d1e646cd574b66fbadf83993da77b84c144e9378bb2ea2f256ea WHIRLPOOL 523ea50fef3c3d5727704b05ad139031b21dd2aeadb5b1fae7a38253514508fb7f5e7ddaac83a25bae3257e36b06932315267528e62a740734b666d5dbc7384d
37 +EBUILD binutils-config-4.ebuild 694 SHA256 c3d1239293d5b9202bca8ad676589f8fc4765b2f2f020a444013d802205efb5c SHA512 642fc5e12d4f2ff18d9344e43ab8a921230374df8e3c532e01368753053d084ef95fc93bfe5c6dbfdfce6ef8eeed86e3cdcece287ccf4330b0f74581537f2a47 WHIRLPOOL 342d7c82e29142a42bacc90a5a70167b17b339a1957ecd441b866227249009959f0bcdf66ac1fff38b3f0e450e7fc322fe787ecedfb95a2717215785b08a3b63
38 +EBUILD binutils-config-5.ebuild 1125 SHA256 a1a1cd27a4b811b64bd37dcdd4197100ca70d307552e9c949b64f327cca097d1 SHA512 dfa0b5f117e9ca4e33217bef5f58af2617453812ddff0cf7df7c99f91c1ee817c3bca1f44bd257ff523e2e5f61352c124483fb88bf40bf7dc45fb51fde2e8857 WHIRLPOOL f461af19822633deeda305750bfae39464acd28b98fbf67db8b2466263b66f32ecb70cb720a0308bcf60ff7091e786905ef7afcf56337417d375d400f179904a
39 MISC ChangeLog 12757 SHA256 996edd94d7f8b82e690fa028e8e729ba1aafff0e2e8dd2fa358718ee990546df SHA512 bf644ca23b2dcd20d8a7279377711d976211e91bf4c41f10638383dc1a3e2c215864e3328984f50f0d2137474a9d07dcd499eca16a8e2df757f54295a52b5ac3 WHIRLPOOL 5de7f1e57ca53bca17deef27b6a2c52b816d7df586fbbfc92304d8a518a2fd6ef31911f4b2012fb9b8b10210038fcfab05a3871a67545b7f4dfd6eab04c85c4e
40 MISC metadata.xml 162 SHA256 65a915d44de1f01d4b7f72d313b4192c38374a9835d24988c00c1e73dca5805a SHA512 2a857e10b277827773a6c7967e070d7bfff23d75f44fa4d4fa8a7339df3225e6dba512a865d91c9c55bdb013dafdce85dface1b845acfbb5473e232666cdda45 WHIRLPOOL f7586c1570803b3e646f0be89ba6c767e82ec6889ef92d15f62a38f1410ed9d82c36892e5e83f694471959783d0d5ad667f1a39b7eb51f2080c269d5fa23d819
41
42 diff --git a/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild b/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild
43 deleted file mode 100644
44 index 38fbf8f..0000000
45 --- a/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild
46 +++ /dev/null
47 @@ -1,19 +0,0 @@
48 -# Copyright 1999-2011 Gentoo Foundation
49 -# Distributed under the terms of the GNU General Public License v2
50 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-1.9-r4.ebuild,v 1.2 2011/02/06 11:30:43 leio Exp $
51 -
52 -DESCRIPTION="Utility to change the binutils version being used"
53 -HOMEPAGE="http://www.gentoo.org/"
54 -SRC_URI=""
55 -
56 -LICENSE="GPL-2"
57 -SLOT="0"
58 -KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
59 -IUSE=""
60 -
61 -RDEPEND="userland_GNU? ( >=sys-apps/findutils-4.2 )"
62 -
63 -src_install() {
64 - newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die
65 - doman "${FILESDIR}"/${PN}.8
66 -}
67
68 diff --git a/sys-devel/binutils-config/binutils-config-2-r1.ebuild b/sys-devel/binutils-config/binutils-config-2-r1.ebuild
69 deleted file mode 100644
70 index 8edda86..0000000
71 --- a/sys-devel/binutils-config/binutils-config-2-r1.ebuild
72 +++ /dev/null
73 @@ -1,19 +0,0 @@
74 -# Copyright 1999-2011 Gentoo Foundation
75 -# Distributed under the terms of the GNU General Public License v2
76 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-2-r1.ebuild,v 1.7 2011/07/10 23:39:04 halcy0n Exp $
77 -
78 -DESCRIPTION="Utility to change the binutils version being used"
79 -HOMEPAGE="http://www.gentoo.org/"
80 -SRC_URI=""
81 -
82 -LICENSE="GPL-2"
83 -SLOT="0"
84 -KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
85 -IUSE=""
86 -
87 -RDEPEND="userland_GNU? ( >=sys-apps/findutils-4.2 )"
88 -
89 -src_install() {
90 - newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die
91 - doman "${FILESDIR}"/${PN}.8
92 -}
93
94 diff --git a/sys-devel/binutils-config/binutils-config-3-r3.ebuild b/sys-devel/binutils-config/binutils-config-3-r3.ebuild
95 deleted file mode 100644
96 index 7c73deb..0000000
97 --- a/sys-devel/binutils-config/binutils-config-3-r3.ebuild
98 +++ /dev/null
99 @@ -1,19 +0,0 @@
100 -# Copyright 1999-2014 Gentoo Foundation
101 -# Distributed under the terms of the GNU General Public License v2
102 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/binutils-config-3-r3.ebuild,v 1.10 2014/01/18 03:08:02 vapier Exp $
103 -
104 -DESCRIPTION="Utility to change the binutils version being used"
105 -HOMEPAGE="http://www.gentoo.org/"
106 -SRC_URI=""
107 -
108 -LICENSE="GPL-2"
109 -SLOT="0"
110 -KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
111 -IUSE=""
112 -
113 -RDEPEND="userland_GNU? ( !<sys-apps/findutils-4.2 )"
114 -
115 -src_install() {
116 - newbin "${FILESDIR}"/${PN}-${PV} ${PN} || die
117 - doman "${FILESDIR}"/${PN}.8
118 -}
119
120 diff --git a/sys-devel/binutils-config/binutils-config-5.ebuild b/sys-devel/binutils-config/binutils-config-5.ebuild
121 index f3a4c32..2ae6f8f 100644
122 --- a/sys-devel/binutils-config/binutils-config-5.ebuild
123 +++ b/sys-devel/binutils-config/binutils-config-5.ebuild
124 @@ -4,6 +4,7 @@
125
126 EAPI="4"
127
128 +inherit prefix
129 DESCRIPTION="Utility to change the binutils version being used"
130 HOMEPAGE="https://www.gentoo.org/"
131 SRC_URI=""
132 @@ -20,7 +21,9 @@ RDEPEND="sys-apps/gentoo-functions
133 S=${WORKDIR}
134
135 src_install() {
136 - newbin "${FILESDIR}"/${PN}-${PV} ${PN}
137 + cp "${FILESDIR}"/${PN}-${PV} "${T}"/ || die "cp failed"
138 + eprefixify "${T}"/${PN}-${PV}
139 + newbin "${T}"/${PN}-${PV} ${PN}
140 doman "${FILESDIR}"/${PN}.8
141
142 insinto /usr/share/eselect/modules
143
144 diff --git a/sys-devel/binutils-config/files/binutils-config-1.9 b/sys-devel/binutils-config/files/binutils-config-1.9
145 deleted file mode 100755
146 index f7e03a7..0000000
147 --- a/sys-devel/binutils-config/files/binutils-config-1.9
148 +++ /dev/null
149 @@ -1,410 +0,0 @@
150 -#!/bin/bash
151 -# Copyright 1999-2007 Gentoo Foundation
152 -# Distributed under the terms of the GNU General Public License v2
153 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-1.9,v 1.10 2007/05/06 09:04:01 vapier Exp $
154 -
155 -# Format of /etc/env.d/binutils/:
156 -# config-TARGET: CURRENT=version for TARGET
157 -# TARGET-VER: has a TARGET and VER variable
158 -
159 -[[ -z ${ROOT} ]] && ROOT="/"
160 -[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
161 -[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
162 -
163 -cd /
164 -
165 -trap ":" INT QUIT TSTP
166 -
167 -argv0=${0##*/}
168 -source /etc/init.d/functions.sh || {
169 - echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
170 - exit 1
171 -}
172 -esyslog() { :; }
173 -umask 022
174 -
175 -usage() {
176 -cat << USAGE_END
177 -
178 -Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
179 -
180 -${HILITE}General Options:${NORMAL}
181 - ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
182 - ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
183 - ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
184 - ${GOOD}-d, --debug${NORMAL} Execute with debug output
185 -
186 -${HILITE}Arch Specific Cruft:${NORMAL}
187 - ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64)
188 - ${GOOD}--arm${NORMAL} Install extra arm links (arm/armeb)
189 - ${GOOD}--mips${NORMAL} Install extra mips links (mips/mipsel)
190 - ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86)
191 -
192 -Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
193 -For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
194 -
195 -For more info, please see ${HILITE}binutils-config${NORMAL}(8).
196 -USAGE_END
197 -}
198 -
199 -switch_profile() {
200 - unset TARGET VER LIBPATH FAKE_TARGETS
201 - source "${ENV_D}/${PROFILE}"
202 - if [[ -z ${TARGET} ]] ; then
203 - eerror "${PROFILE} is invalid (no \$TARGET defined) :("
204 - return 1
205 - fi
206 - if [[ -z ${VER} ]] ; then
207 - eerror "${PROFILE} is invalid (no \$VER defined) :("
208 - return 1
209 - fi
210 -
211 - #
212 - # Older installs don't have 'FAKE_TARGETS' defined, so lets
213 - # update these env.d entries so that we don't force the poor
214 - # user to re-emerge their binutils just for 1 envvar :/
215 - #
216 - if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
217 - local targ=${TARGET/-*}
218 - local FAKE_TARGETS=${TARGET}
219 - case ${targ} in
220 - mips|powerpc|sparc)
221 - FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
222 - mips64|powerpc64|sparc64)
223 - FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
224 - esac
225 - echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
226 - fi
227 - local fake_targ_append="${TARGET#*-}"
228 - FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
229 -
230 - ebegin "Switching to ${PROFILE}"
231 -
232 - #
233 - # Generate binary symlinks
234 - # On systems that do 32bit/64bit, we need to fake an
235 - # extra set of binary names (${FAKE_TARGETS})
236 - #
237 - BINPATH=""
238 - BINPATH_LINKS=""
239 - if [[ ${TARGET} != ${HOST} ]] ; then
240 - #
241 - # Newer paths: /usr/${HOST}/${TARGET}/...
242 - # Older paths: /usr/${TARGET}/...
243 - #
244 - if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
245 - BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
246 - BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
247 - fi
248 - fi
249 - if [[ -z ${BINPATH} ]] ; then
250 - BINPATH=/usr/${TARGET}/binutils-bin/${VER}
251 - BINPATH_LINKS=/usr/${TARGET}/bin
252 - fi
253 - cd "${ROOT}/${BINPATH}" || exit 1
254 - mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
255 - for x in * ; do
256 - ln -sf "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}/${x}"
257 - ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${TARGET}-${x}
258 - for fake in ${FAKE_TARGETS} ; do
259 - [[ -f ${ENV_D}/config-${fake} ]] && continue
260 - ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${fake}-${x}
261 - done
262 - if [[ ${TARGET} == ${HOST} ]] ; then
263 - ln -sf ${TARGET}-${x} "${ROOT}"/usr/bin/${x}
264 - fi
265 - done
266 -
267 - #
268 - # Generate library / ldscripts symlinks
269 - #
270 - LIBPATH=${LIBPATH:-/usr/lib/binutils/${TARGET}/${VER}}
271 - cd "${ROOT}/${LIBPATH}" || exit 1
272 - if [[ ${TARGET} == ${HOST} ]] ; then
273 - dstlib=${ROOT}/usr/${HOST}/lib
274 - else
275 - dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
276 - # Clean out old path
277 - rm -rf "${ROOT}"/usr/${TARGET}/lib/ldscripts
278 - rmdir "${ROOT}"/usr/${TARGET}/lib >& /dev/null
279 - fi
280 - # When upgrading, we need to clean up ldscripts and libs
281 - rm -rf "${dstlib}/ldscripts" "${ROOT}/${BINPATH_LINKS}"/ldscripts
282 - mkdir -p "${dstlib}"
283 - ln -sf "${LIBPATH}/ldscripts" "${dstlib}"/ldscripts
284 - find -L "${dstlib}" -type l -exec rm {} \;
285 - for x in lib* ; do
286 - ln -sf "${LIBPATH}/${x}" "${dstlib}/${x}"
287 - done
288 -
289 - #
290 - # Generate include symlinks
291 - #
292 - INCPATH=${LIBPATH}/include
293 - if [[ -d ${ROOT}/${INCPATH} ]] ; then
294 - cd "${ROOT}/${INCPATH}" || exit 1
295 - if [[ ${HOST} == ${TARGET} ]] ; then
296 - mkdir -p "${ROOT}/usr/include"
297 - for x in * ; do
298 - ln -sf "${INCPATH}/${x}" "${ROOT}/usr/include/${x}"
299 - done
300 - else
301 - # Clean out old path
302 - find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
303 - rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
304 - rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
305 - rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
306 - fi
307 - fi
308 -
309 - #
310 - # Make sure proper paths get updated
311 - #
312 - if [[ ${TARGET} == ${HOST} ]] ; then
313 - DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
314 - [[ -d ${DATAPATH}/man ]] && \
315 - echo "MANPATH=${DATAPATH}/man" > "${ROOT}"/etc/env.d/05binutils
316 - [[ -d ${DATAPATH}/info ]] && \
317 - echo "INFOPATH=${DATAPATH}/info" >> "${ROOT}"/etc/env.d/05binutils
318 - # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
319 - echo "LDPATH=/usr/${TARGET}/lib" >> "${ROOT}"/etc/env.d/05binutils
320 - fi
321 -
322 - eend 0
323 -
324 - echo "CURRENT=${VER}" > "${ENV_D}/config-${TARGET}"
325 -
326 - #
327 - # Regen env.d if need/can be
328 - #
329 - if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
330 - env-update
331 - echo
332 - ewarn "Please remember to run:"
333 - echo
334 - ewarn " # source /etc/profile"
335 - echo
336 - fi
337 -
338 - return 0
339 -}
340 -
341 -uninstall_target() {
342 - if [[ ${TARGET} == ${HOST} ]] ; then
343 - eerror "${argv0}: Refusing to uninstall native binutils"
344 - exit 1
345 - fi
346 -
347 - shopt -s nullglob
348 - PROFILE=""
349 -
350 - for PROFILE in "${ENV_D}"/${TARGET}-* ; do
351 - ewarn "Removing all signs of ${PROFILE##*/}"
352 - rm -f "${ENV_D}"/${PROFILE}
353 - done
354 - if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
355 - eerror "${argv0}: No profiles exist for '${TARGET}'"
356 - exit 1
357 - fi
358 -
359 - rm -f "${ENV_D}"/config-${TARGET}
360 -
361 - # XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
362 - for x in addr2line ar as c++filt elf2flt flthdr gprof ld ld.real \
363 - nm objcopy objdump ranlib readelf size strings strip ; do
364 - rm -f "${ROOT}"/usr/bin/${TARGET}-${x}
365 - rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
366 - rm -f "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
367 - done
368 - for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
369 - rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
370 - done
371 - for x in bfd iberty opcodes ; do
372 - rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
373 - done
374 - # Delete broken symlinks
375 - local destdir="${ROOT}/usr/${HOST}/${TARGET}"
376 - rm -f "${destdir}"/lib/ldscripts
377 - find -L "${destdir}"/lib -type l -exec rm {} \;
378 - rmdir "${destdir}"/lib "${destdir}" 2>/dev/null
379 - rmdir "${destdir}"/{bin,include,lib,usr} "${destdir}" 2>/dev/null
380 - rmdir "${ROOT}"/var/db/pkg/cross-${TARGET} 2>/dev/null
381 -
382 - rm -f "${ENV_D}"/${TARGET}-*
383 -}
384 -
385 -get_current_profile() {
386 - if [[ ! -f ${ENV_D}/config-${PROFILE} ]] ; then
387 - eerror "${argv0}: No binutils profile is active!"
388 - return 1
389 - fi
390 -
391 - source "${ENV_D}/config-${PROFILE}"
392 -
393 - if [[ -z ${CURRENT} ]] ; then
394 - eerror "${argv0}: No binutils profile is active!"
395 - return 1
396 - fi
397 -
398 - echo "${PROFILE}-${CURRENT}"
399 -
400 - return 0
401 -}
402 -
403 -list_profiles() {
404 - local i=1
405 -
406 - set_HOST
407 -
408 - if [[ ${ROOT} != / ]] ; then
409 - echo "Using binutils-config info in ${ROOT}"
410 - fi
411 - target=
412 - for x in "${ENV_D}"/* ; do
413 - if [[ -f ${x} ]] && [[ ${x/\/config-} == ${x} ]] ; then
414 - source "${x}"
415 - if [[ ${target} != ${TARGET} ]] ; then
416 - [[ -n ${target} ]] && echo
417 - target=${TARGET}
418 - fi
419 -
420 - x=${x##*/}
421 - if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
422 - source "${ENV_D}/config-${TARGET}"
423 - if [[ ${VER} == ${CURRENT} ]] ; then
424 - [[ ${TARGET} == ${HOST} ]] \
425 - && x="${x} ${GOOD}*${NORMAL}" \
426 - || x="${x} ${HILITE}*${NORMAL}"
427 - fi
428 - fi
429 - echo " [${i}] ${x}"
430 - ((++i))
431 - fi
432 - done
433 -}
434 -
435 -set_HOST() {
436 - [[ -n ${HOST} ]] && return 0
437 -
438 - if [[ -z ${CHOST} ]] ; then
439 - HOST=$(portageq envvar CHOST)
440 - else
441 - HOST=${CHOST}
442 - fi
443 -}
444 -
445 -ENV_D="${ROOT}etc/env.d/binutils"
446 -
447 -DEBUG="no"
448 -NEED_ACTION="yes"
449 -DOIT="switch_profile"
450 -PROFILE=""
451 -FAKE_TARGETS_USER=""
452 -HOST=""
453 -
454 -while [[ $# -gt 0 ]] ; do
455 - x=$1
456 - shift
457 - case ${x} in
458 - -c|--get-current-profile)
459 - if [[ ${NEED_ACTION} == "yes" ]] ; then
460 - NEED_ACTION="no"
461 - DOIT="get_current_profile"
462 - fi
463 - ;;
464 - -d|--debug)
465 - DEBUG="yes"
466 - ;;
467 - -l|--list-profiles)
468 - if [[ ${NEED_ACTION} == "yes" ]] ; then
469 - NEED_ACTION="no"
470 - DOIT="list_profiles"
471 - fi
472 - ;;
473 - -u|--uninstall)
474 - if [[ ${NEED_ACTION} == "yes" ]] ; then
475 - NEED_ACTION="no"
476 - DOIT="uninstall_target"
477 - TARGET=$1
478 - shift
479 - fi
480 - ;;
481 - -h|--help)
482 - usage
483 - exit 0
484 - ;;
485 - -V|--version)
486 - cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-1.9,v 1.10 2007/05/06 09:04:01 vapier Exp $"
487 - cvsver=${cvsver##*binutils-config-}
488 - bver=${cvsver%%,v *}
489 - cvsver=${cvsver#* }
490 - echo "binutils-config-${bver} (r${cvsver%% *})"
491 - exit 0
492 - ;;
493 - --amd64|--arm|--mips|--x86)
494 - if [[ ${NEED_ACTION} == "yes" ]] ; then
495 - # Make sure we have a space after each target
496 - NEED_ACTION="no"
497 - [[ -z ${PROFILE} ]] && PROFILE="current"
498 - case ${x} in
499 - --amd64) FAKE_TARGETS_USER="x86_64 ";;
500 - --arm) FAKE_TARGETS_USER="arm armeb ";;
501 - --x86) FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
502 - --mips) FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
503 - esac
504 - fi
505 - ;;
506 - -*)
507 - eerror "${0##*/}: Invalid switch! Try '--help'."
508 - exit 1
509 - ;;
510 - *)
511 - if [[ -n ${PROFILE} ]] && [[ ${PROFILE} != "current" ]] ; then
512 - eerror "${argv0}: Too many arguments! Run ${argv0} without parameters for help."
513 - exit 1
514 - fi
515 -
516 - if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
517 - # User gave us a # representing the profile
518 - i=1
519 - for y in "${ENV_D}"/* ; do
520 - [[ ${y/config-} != ${y} ]] && continue
521 -
522 - if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
523 - PROFILE=${y##*/}
524 - NEED_ACTION="no"
525 - break
526 - fi
527 - ((++i))
528 - done
529 - fi
530 -
531 - if [[ -z ${PROFILE} ]] ; then
532 - # User gave us a full HOST-ver
533 - x=${x##*/}
534 - if [[ ! -f ${ENV_D}/${x} ]] && [[ ! -f ${ENV_D}/config-${x} ]] ; then
535 - # Maybe they just gave us a ver ...
536 - set_HOST
537 - if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
538 - x=${HOST}-${x}
539 - else
540 - eerror "${argv0}: Could not locate '$x' in '${ENV_D}/'!"
541 - exit 1
542 - fi
543 - fi
544 - PROFILE=${x}
545 - NEED_ACTION="no"
546 - fi
547 - ;;
548 - esac
549 -done
550 -
551 -[[ ${NEED_ACTION} == "yes" ]] && usage && exit 1
552 -[[ ${DEBUG} == "yes" ]] && set -x
553 -
554 -[[ ${DOIT} != "list_profiles" ]] && set_HOST
555 -[[ -z ${PROFILE} ]] && PROFILE=${HOST}
556 -[[ ${PROFILE} == "current" ]] && PROFILE=$(PROFILE=${HOST} get_current_profile)
557 -eval ${DOIT}
558 -
559 -# vim:ts=4
560
561 diff --git a/sys-devel/binutils-config/files/binutils-config-2 b/sys-devel/binutils-config/files/binutils-config-2
562 deleted file mode 100755
563 index bbb8f8d..0000000
564 --- a/sys-devel/binutils-config/files/binutils-config-2
565 +++ /dev/null
566 @@ -1,434 +0,0 @@
567 -#!/bin/bash
568 -# Copyright 1999-2009 Gentoo Foundation
569 -# Distributed under the terms of the GNU General Public License v2
570 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-2,v 1.3 2011/04/03 21:44:42 vapier Exp $
571 -
572 -# Format of /etc/env.d/binutils/:
573 -# config-TARGET: CURRENT=version for TARGET
574 -# TARGET-VER: has a TARGET and VER variable
575 -
576 -: ${ROOT:=/}
577 -[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
578 -[[ ${ROOT} != /* ]] && ROOT="${PWD}${ROOT}"
579 -
580 -cd /
581 -
582 -trap ":" INT QUIT TSTP
583 -
584 -argv0=${0##*/}
585 -source /etc/init.d/functions.sh || {
586 - echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
587 - exit 1
588 -}
589 -esyslog() { :; }
590 -umask 022
591 -
592 -usage() {
593 -cat << USAGE_END
594 -
595 -Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
596 -
597 -${HILITE}General Options:${NORMAL}
598 - ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
599 - ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
600 - ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
601 - ${GOOD}-d, --debug${NORMAL} Execute with debug output
602 -
603 -${HILITE}Arch Specific Cruft:${NORMAL}
604 - ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64)
605 - ${GOOD}--arm${NORMAL} Install extra arm links (arm/armeb)
606 - ${GOOD}--mips${NORMAL} Install extra mips links (mips/mipsel)
607 - ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86)
608 -
609 -Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
610 -For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
611 -
612 -For more info, please see ${HILITE}binutils-config${NORMAL}(8).
613 -USAGE_END
614 -
615 - exit ${1:-1}
616 -}
617 -
618 -mv_if_diff() {
619 - if cmp -s "$1" "$2" ; then
620 - rm -f "$1"
621 - else
622 - mv -f "$1" "$2"
623 - fi
624 -}
625 -
626 -switch_profile() {
627 - unset TARGET VER LIBPATH FAKE_TARGETS
628 - source "${ENV_D}/${PROFILE}"
629 - if [[ -z ${TARGET} ]] ; then
630 - eerror "${PROFILE} is invalid (no \$TARGET defined) :("
631 - return 1
632 - fi
633 - if [[ -z ${VER} ]] ; then
634 - eerror "${PROFILE} is invalid (no \$VER defined) :("
635 - return 1
636 - fi
637 -
638 - #
639 - # Older installs don't have 'FAKE_TARGETS' defined, so lets
640 - # update these env.d entries so that we don't force the poor
641 - # user to re-emerge their binutils just for 1 envvar :/
642 - #
643 - if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
644 - local targ=${TARGET/-*}
645 - local FAKE_TARGETS=${TARGET}
646 - case ${targ} in
647 - mips|powerpc|sparc)
648 - FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
649 - mips64|powerpc64|sparc64)
650 - FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
651 - esac
652 - echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
653 - fi
654 - local fake_targ_append="${TARGET#*-}"
655 - FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
656 -
657 - ebegin "Switching to ${PROFILE}"
658 -
659 - #
660 - # Generate binary symlinks
661 - # On systems that do 32bit/64bit, we need to fake an
662 - # extra set of binary names (${FAKE_TARGETS})
663 - #
664 - BINPATH=""
665 - BINPATH_LINKS=""
666 - if [[ ${TARGET} != ${HOST} ]] ; then
667 - #
668 - # Newer paths: /usr/${HOST}/${TARGET}/...
669 - # Older paths: /usr/${TARGET}/...
670 - #
671 - if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
672 - BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
673 - BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
674 - fi
675 - fi
676 - if [[ -z ${BINPATH} ]] ; then
677 - BINPATH=/usr/${TARGET}/binutils-bin/${VER}
678 - BINPATH_LINKS=/usr/${TARGET}/bin
679 - fi
680 - cd "${ROOT}/${BINPATH}" || exit 1
681 - mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
682 - for x in * ; do
683 - ln -sf "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}/${x}"
684 - ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${TARGET}-${x}
685 - for fake in ${FAKE_TARGETS} ; do
686 - [[ -f ${ENV_D}/config-${fake} ]] && continue
687 - ln -sf "${BINPATH_LINKS}/${x}" "${ROOT}"/usr/bin/${fake}-${x}
688 - done
689 - if [[ ${TARGET} == ${HOST} ]] ; then
690 - ln -sf ${TARGET}-${x} "${ROOT}"/usr/bin/${x}
691 - fi
692 - done
693 -
694 - #
695 - # Generate library / ldscripts symlinks
696 - #
697 - : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
698 - cd "${ROOT}/${LIBPATH}" || exit 1
699 - if [[ ${TARGET} == ${HOST} ]] ; then
700 - dstlib=${ROOT}/usr/${HOST}/lib
701 - else
702 - dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
703 - # Clean out old path
704 - rm -rf "${ROOT}"/usr/${TARGET}/lib/ldscripts
705 - rmdir "${ROOT}"/usr/${TARGET}/lib >& /dev/null
706 - fi
707 - # When upgrading, we need to clean up ldscripts and libs
708 - rm -rf "${dstlib}/ldscripts" "${ROOT}/${BINPATH_LINKS}"/ldscripts
709 - mkdir -p "${dstlib}"
710 - ln -sf "${LIBPATH}/ldscripts" "${dstlib}"/ldscripts
711 - find -L "${dstlib}" -type l -exec rm {} +
712 - for x in lib* ; do
713 - ln -sf "${LIBPATH}/${x}" "${dstlib}/${x}"
714 - done
715 -
716 - #
717 - # Generate include symlinks
718 - #
719 - INCPATH=${LIBPATH}/include
720 - if [[ -d ${ROOT}/${INCPATH} ]] ; then
721 - cd "${ROOT}/${INCPATH}" || exit 1
722 - if [[ ${HOST} == ${TARGET} ]] ; then
723 - mkdir -p "${ROOT}/usr/include"
724 - for x in * ; do
725 - ln -sf "${INCPATH}/${x}" "${ROOT}/usr/include/${x}"
726 - done
727 - else
728 - # Clean out old path -- cannot use '-exec {} +' syntax here
729 - find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
730 - rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
731 - rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
732 - rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
733 - fi
734 - fi
735 -
736 - #
737 - # Make sure proper paths get updated
738 - #
739 - if [[ ${TARGET} == ${HOST} ]] ; then
740 - DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
741 - local e="${ROOT}"/etc/env.d/05binutils
742 - local ee="${e}.tmp"
743 - rm -f "${ee}"
744 - [[ -d ${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
745 - [[ -d ${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
746 - # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
747 - if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
748 - local l="${ROOT}"/etc/ld.so.conf.d/05binutils.conf
749 - local ll="${l}.tmp"
750 - echo "/usr/${TARGET}/lib" > "${ll}"
751 - mv_if_diff "${ll}" "${l}"
752 - else
753 - echo "LDPATH=/usr/${TARGET}/lib" >> "${ee}"
754 - fi
755 - mv_if_diff "${ee}" "${e}"
756 - fi
757 -
758 - local c="${ENV_D}/config-${TARGET}"
759 - local cc="${c}.tmp"
760 - echo "CURRENT=${VER}" > "${cc}"
761 - mv_if_diff "${cc}" "${c}"
762 -
763 - eend 0
764 -
765 - #
766 - # Regen env.d if need/can be
767 - #
768 - if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
769 - env-update
770 - echo
771 - ewarn "Please remember to run:"
772 - echo
773 - ewarn " # . /etc/profile"
774 - echo
775 - fi
776 -
777 - return 0
778 -}
779 -
780 -uninstall_target() {
781 - if [[ ${TARGET} == ${HOST} ]] ; then
782 - eerror "${argv0}: Refusing to uninstall native binutils"
783 - exit 1
784 - fi
785 -
786 - shopt -s nullglob
787 - PROFILE=""
788 -
789 - for PROFILE in "${ENV_D}"/${TARGET}-* ; do
790 - ewarn "Removing all signs of ${PROFILE##*/}"
791 - rm -f "${ENV_D}"/${PROFILE}
792 - done
793 - if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
794 - eerror "${argv0}: No profiles exist for '${TARGET}'"
795 - exit 1
796 - fi
797 -
798 - rm -f "${ENV_D}"/config-${TARGET} "${ROOT}"/etc/ld.so.conf.d/05binutils.conf
799 -
800 - # XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
801 - for x in addr2line ar as c++filt elf2flt flthdr gprof ld ld.real \
802 - nm objcopy objdump ranlib readelf size strings strip ; do
803 - rm -f "${ROOT}"/usr/bin/${TARGET}-${x}
804 - rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
805 - rm -f "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
806 - done
807 - for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
808 - rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
809 - done
810 - for x in bfd iberty opcodes ; do
811 - rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
812 - done
813 - # Delete broken symlinks
814 - local destdir="${ROOT}/usr/${HOST}/${TARGET}"
815 - rm -f "${destdir}"/lib/ldscripts
816 - find -L "${destdir}"/lib -type l -exec rm {} +
817 - rmdir \
818 - "${destdir}"/{bin,include,lib,usr} \
819 - "${destdir}" \
820 - "${ROOT}"/var/db/pkg/cross-${TARGET} \
821 - 2>/dev/null
822 -
823 - rm -f "${ENV_D}"/${TARGET}-*
824 -}
825 -
826 -get_current_profile() {
827 - if [[ ! -f ${ENV_D}/config-${PROFILE} ]] ; then
828 - eerror "${argv0}: No binutils profile is active!"
829 - return 1
830 - fi
831 -
832 - source "${ENV_D}/config-${PROFILE}"
833 -
834 - if [[ -z ${CURRENT} ]] ; then
835 - eerror "${argv0}: No binutils profile is active!"
836 - return 1
837 - fi
838 -
839 - echo "${PROFILE}-${CURRENT}"
840 -
841 - return 0
842 -}
843 -
844 -list_profiles() {
845 - local i=1
846 -
847 - set_HOST
848 -
849 - if [[ ${ROOT} != / ]] ; then
850 - echo "Using binutils-config info in ${ROOT}"
851 - fi
852 - target=
853 - for x in "${ENV_D}"/* ; do
854 - if [[ -f ${x} ]] && [[ ${x/\/config-} == ${x} ]] ; then
855 - source "${x}"
856 - if [[ ${target} != ${TARGET} ]] ; then
857 - [[ -n ${target} ]] && echo
858 - target=${TARGET}
859 - fi
860 -
861 - x=${x##*/}
862 - if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
863 - source "${ENV_D}/config-${TARGET}"
864 - if [[ ${VER} == ${CURRENT} ]] ; then
865 - [[ ${TARGET} == ${HOST} ]] \
866 - && x="${x} ${GOOD}*${NORMAL}" \
867 - || x="${x} ${HILITE}*${NORMAL}"
868 - fi
869 - fi
870 - echo " [${i}] ${x}"
871 - ((++i))
872 - fi
873 - done
874 -}
875 -
876 -set_HOST() {
877 - [[ -n ${HOST} ]] && return 0
878 -
879 - if [[ -z ${CHOST} ]] ; then
880 - HOST=$(portageq envvar CHOST)
881 - else
882 - HOST=${CHOST}
883 - fi
884 -}
885 -
886 -ENV_D="${ROOT}etc/env.d/binutils"
887 -
888 -DEBUG="no"
889 -NEED_ACTION="yes"
890 -DOIT="switch_profile"
891 -PROFILE=""
892 -FAKE_TARGETS_USER=""
893 -HOST=""
894 -
895 -while [[ $# -gt 0 ]] ; do
896 - x=$1
897 - shift
898 - case ${x} in
899 - -c|--get-current-profile)
900 - if [[ ${NEED_ACTION} == "yes" ]] ; then
901 - NEED_ACTION="no"
902 - DOIT="get_current_profile"
903 - fi
904 - ;;
905 - -d|--debug)
906 - DEBUG="yes"
907 - ;;
908 - -l|--list-profiles)
909 - if [[ ${NEED_ACTION} == "yes" ]] ; then
910 - NEED_ACTION="no"
911 - DOIT="list_profiles"
912 - fi
913 - ;;
914 - -u|--uninstall)
915 - if [[ ${NEED_ACTION} == "yes" ]] ; then
916 - NEED_ACTION="no"
917 - DOIT="uninstall_target"
918 - TARGET=$1
919 - shift
920 - fi
921 - ;;
922 - -h|--help)
923 - usage 0
924 - ;;
925 - -V|--version)
926 - unset Header
927 - cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-2,v 1.3 2011/04/03 21:44:42 vapier Exp $"
928 - cvsver=${cvsver##*binutils-config-}
929 - bver=${cvsver%%,v *}
930 - cvsver=${cvsver#* }
931 - echo "binutils-config-${bver} (r${cvsver%% *})"
932 - exit 0
933 - ;;
934 - --amd64|--arm|--mips|--x86)
935 - if [[ ${NEED_ACTION} == "yes" ]] ; then
936 - # Make sure we have a space after each target
937 - NEED_ACTION="no"
938 - [[ -z ${PROFILE} ]] && PROFILE="current"
939 - case ${x} in
940 - --amd64) FAKE_TARGETS_USER="x86_64 ";;
941 - --arm) FAKE_TARGETS_USER="arm armeb ";;
942 - --x86) FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
943 - --mips) FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
944 - esac
945 - fi
946 - ;;
947 - -*)
948 - eerror "${0##*/}: Invalid switch! Try '--help'."
949 - exit 1
950 - ;;
951 - *)
952 - if [[ -n ${PROFILE} ]] && [[ ${PROFILE} != "current" ]] ; then
953 - eerror "${argv0}: Too many arguments! Run ${argv0} without parameters for help."
954 - exit 1
955 - fi
956 -
957 - if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
958 - # User gave us a # representing the profile
959 - i=1
960 - for y in "${ENV_D}"/* ; do
961 - [[ ${y/config-} != ${y} ]] && continue
962 -
963 - if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
964 - PROFILE=${y##*/}
965 - NEED_ACTION="no"
966 - break
967 - fi
968 - ((++i))
969 - done
970 - fi
971 -
972 - if [[ -z ${PROFILE} ]] ; then
973 - # User gave us a full HOST-ver
974 - x=${x##*/}
975 - if [[ ! -f ${ENV_D}/${x} ]] && [[ ! -f ${ENV_D}/config-${x} ]] ; then
976 - # Maybe they just gave us a ver ...
977 - set_HOST
978 - if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
979 - x=${HOST}-${x}
980 - else
981 - eerror "${argv0}: Could not locate '$x' in '${ENV_D}/'!"
982 - exit 1
983 - fi
984 - fi
985 - PROFILE=${x}
986 - NEED_ACTION="no"
987 - fi
988 - ;;
989 - esac
990 -done
991 -
992 -[[ ${NEED_ACTION} == "yes" ]] && usage 1
993 -[[ ${DEBUG} == "yes" ]] && set -x
994 -
995 -[[ ${DOIT} != "list_profiles" ]] && set_HOST
996 -[[ -z ${PROFILE} ]] && PROFILE=${HOST}
997 -[[ ${PROFILE} == "current" ]] && PROFILE=$(PROFILE=${HOST} get_current_profile)
998 -eval ${DOIT}
999 -
1000 -# vim:ts=4
1001
1002 diff --git a/sys-devel/binutils-config/files/binutils-config-3 b/sys-devel/binutils-config/files/binutils-config-3
1003 deleted file mode 100644
1004 index 0b4c5ae..0000000
1005 --- a/sys-devel/binutils-config/files/binutils-config-3
1006 +++ /dev/null
1007 @@ -1,515 +0,0 @@
1008 -#!/bin/bash
1009 -# Copyright 1999-2013 Gentoo Foundation
1010 -# Distributed under the terms of the GNU General Public License v2
1011 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.11 2013/05/05 05:20:42 vapier Exp $
1012 -
1013 -# Format of /etc/env.d/binutils/:
1014 -# config-TARGET: CURRENT=version for TARGET
1015 -# TARGET-VER: has a TARGET and VER variable
1016 -
1017 -EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
1018 -if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
1019 - EPREFIX=""
1020 -fi
1021 -
1022 -: ${ROOT:=/}
1023 -[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
1024 -[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
1025 -EROOT="${ROOT%/}${EPREFIX}/"
1026 -
1027 -cd "${EPREFIX}"
1028 -
1029 -trap ":" INT QUIT TSTP
1030 -
1031 -argv0=${0##*/}
1032 -source "${EPREFIX}"/etc/init.d/functions.sh || {
1033 - echo "${argv0}: Could not source ${EPREFIX}/etc/init.d/functions.sh!" 1>&2
1034 - exit 1
1035 -}
1036 -esyslog() { :; }
1037 -die() { eerror "${argv0}: $*"; exit 1; }
1038 -umask 022
1039 -
1040 -usage() {
1041 -cat << USAGE_END
1042 -Usage: ${HILITE}binutils-config${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}[binutils profile]${NORMAL}
1043 -
1044 -${HILITE}General Options:${NORMAL}
1045 - ${GOOD}-c, --get-current-profile${NORMAL} Print current profile
1046 - ${GOOD}-l, --list-profiles${NORMAL} Print a list of available profiles
1047 - ${GOOD}-u, --uninstall${NORMAL} Remove all signs of specified target
1048 - ${GOOD}-d, --debug${NORMAL} Execute with debug output
1049 -
1050 -${HILITE}General Cruft:${NORMAL}
1051 - ${GOOD}--linker${NORMAL} <linker> Switch to specified linker (if supported)
1052 -
1053 -${HILITE}Arch Specific Cruft:${NORMAL}
1054 - ${GOOD}--amd64${NORMAL} Install extra amd64 links (x86_64)
1055 - ${GOOD}--arm${NORMAL} Install extra arm links (arm/armeb)
1056 - ${GOOD}--mips${NORMAL} Install extra mips links (mips/mipsel)
1057 - ${GOOD}--x86${NORMAL} Install extra x86 links (i[3-6]86)
1058 -
1059 -Profile names are of the form: ${BRACKET}<CTARGET>-<binutils version>${NORMAL}
1060 -For example: ${BRACKET}i686-pc-linux-gnu-2.15.92.0.2${NORMAL}
1061 -
1062 -For more info, please see ${HILITE}binutils-config${NORMAL}(8).
1063 -USAGE_END
1064 -
1065 - exit ${1:-1}
1066 -}
1067 -
1068 -mv_if_diff() {
1069 - if cmp -s "$1" "$2" ; then
1070 - rm -f "$1"
1071 - else
1072 - mv -f "$1" "$2"
1073 - fi
1074 -}
1075 -atomic_ln() {
1076 - local target=$1 linkdir=$2 linkname=$3 linktmp linkfull
1077 - linktmp="${linkdir}/.binutils-config.tmp.${linkname}"
1078 - linkfull="${linkdir}/${linkname}"
1079 - if [[ -d ${linkfull} ]] ; then
1080 - # if linking to a dir, we need a little magic to
1081 - # make it atomic since `mv -T` is not portable
1082 - rm -rf "${linktmp}"
1083 - mkdir -p "${linktmp}"
1084 - ln -sf "${target}" "${linktmp}/${linkname}"
1085 - mv "${linktmp}/${linkname}" "${linktmp}/../"
1086 - rmdir "${linktmp}"
1087 - else
1088 - # `ln` will expand into unlink();symlink(); which
1089 - # is not atomic for a small amount of time, but
1090 - # `mv` is a single rename() call
1091 - ln -sf "${target}" "${linktmp}"
1092 - mv "${linktmp}" "${linkfull}"
1093 - fi
1094 -}
1095 -
1096 -setup_env() {
1097 - unset TARGET VER LIBPATH FAKE_TARGETS
1098 - source "${ENV_D}/${PROFILE}"
1099 - if [[ -z ${TARGET} ]] ; then
1100 - eerror "${PROFILE} is invalid (no \$TARGET defined) :("
1101 - return 1
1102 - fi
1103 - if [[ -z ${VER} ]] ; then
1104 - eerror "${PROFILE} is invalid (no \$VER defined) :("
1105 - return 1
1106 - fi
1107 -
1108 - #
1109 - # Older installs don't have 'FAKE_TARGETS' defined, so lets
1110 - # update these env.d entries so that we don't force the poor
1111 - # user to re-emerge their binutils just for 1 envvar :/
1112 - #
1113 - if [[ ${FAKE_TARGETS-poor user} == "poor user" ]] ; then
1114 - local targ=${TARGET/-*}
1115 - local FAKE_TARGETS=${TARGET}
1116 - case ${targ} in
1117 - mips|powerpc|sparc)
1118 - FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/-/64-}";;
1119 - mips64|powerpc64|sparc64)
1120 - FAKE_TARGETS="${FAKE_TARGETS} ${TARGET/64-/-}";;
1121 - esac
1122 - echo "FAKE_TARGETS=\"${FAKE_TARGETS}\"" >> "${ENV_D}/${PROFILE}"
1123 - fi
1124 - local fake_targ_append="${TARGET#*-}"
1125 - FAKE_TARGETS="${FAKE_TARGETS} ${FAKE_TARGETS_USER// /-${fake_targ_append} }"
1126 -
1127 - #
1128 - # Generate binary symlinks
1129 - # On systems that do 32bit/64bit, we need to fake an
1130 - # extra set of binary names (${FAKE_TARGETS})
1131 - #
1132 - BINPATH=""
1133 - BINPATH_LINKS=""
1134 - if [[ ${TARGET} != ${HOST} ]] ; then
1135 - #
1136 - # Newer paths: /usr/${HOST}/${TARGET}/...
1137 - # Older paths: /usr/${TARGET}/...
1138 - #
1139 - if [[ -d ${EROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
1140 - BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER}
1141 - BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET}
1142 - fi
1143 - fi
1144 - if [[ -z ${BINPATH} ]] ; then
1145 - BINPATH="${EPREFIX}"/usr/${TARGET}/binutils-bin/${VER}
1146 - BINPATH_LINKS="${EPREFIX}"/usr/${TARGET}/bin
1147 - fi
1148 -}
1149 -
1150 -switch_profile() {
1151 - ebegin "Switching to ${PROFILE}"
1152 -
1153 - setup_env || return 1
1154 -
1155 - cd "${ROOT}/${BINPATH}" || exit 1
1156 - mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
1157 - for x in * ; do
1158 - atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
1159 - atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin/" "${TARGET}-${x}"
1160 - for fake in ${FAKE_TARGETS} ; do
1161 - [[ -f ${ENV_D}/config-${fake} ]] && continue
1162 - atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${fake}-${x}"
1163 - done
1164 - if [[ ${TARGET} == ${HOST} ]] ; then
1165 - atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"
1166 - fi
1167 - done
1168 -
1169 - #
1170 - # Generate library / ldscripts symlinks
1171 - #
1172 - : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
1173 - cd "${ROOT}/${LIBPATH}" || exit 1
1174 - if [[ ${TARGET} == ${HOST} ]] ; then
1175 - dstlib=${EROOT}/usr/${HOST}/lib
1176 - else
1177 - dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib
1178 - fi
1179 - # When upgrading, we need to clean up ldscripts and libs
1180 - mkdir -p "${dstlib}"
1181 - rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
1182 - atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
1183 - find -L "${dstlib}" -type l -exec rm -v {} +
1184 - for x in lib* ; do
1185 - atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}"
1186 - done
1187 -
1188 - #
1189 - # Generate include symlinks
1190 - #
1191 - INCPATH=${LIBPATH}/include
1192 - if [[ -d ${ROOT}/${INCPATH} ]] ; then
1193 - cd "${ROOT}/${INCPATH}" || exit 1
1194 - if [[ ${HOST} == ${TARGET} ]] ; then
1195 - mkdir -p "${EROOT}/usr/include"
1196 - for x in * ; do
1197 - atomic_ln "${INCPATH}/${x}" "${EROOT}/usr/include" "${x}"
1198 - done
1199 - else
1200 - # Clean out old path -- cannot use '-exec {} +' syntax here
1201 - find . -type f -exec rm -f "${EROOT}/usr/${TARGET}/usr/include/{}" \;
1202 - rmdir "${EROOT}/usr/${TARGET}/usr/include" >& /dev/null
1203 - rmdir "${EROOT}/usr/${TARGET}/usr" >& /dev/null
1204 - rmdir "${EROOT}/usr/${TARGET}" >& /dev/null
1205 - fi
1206 - fi
1207 -
1208 - #
1209 - # Make sure proper paths get updated
1210 - #
1211 - if [[ ${TARGET} == ${HOST} ]] ; then
1212 - DATAPATH="${EPREFIX}"/usr/share/binutils-data/${TARGET}/${VER}
1213 - local e="${EROOT}"/etc/env.d/05binutils
1214 - local ee="${e}.tmp"
1215 - rm -f "${ee}"
1216 - [[ -d ${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
1217 - [[ -d ${DATAPATH}/info ]] && echo "INFOPATH=${DATAPATH}/info" >> "${ee}"
1218 - # hmm, `ld` has this in SEARCH_DIR(), but ld.so does not ...
1219 - if [[ -d ${EROOT}/etc/ld.so.conf.d ]] ; then
1220 - local l="${EROOT}"/etc/ld.so.conf.d/05binutils.conf
1221 - local ll="${l}.tmp"
1222 - echo "/usr/${TARGET}/lib" > "${ll}"
1223 - mv_if_diff "${ll}" "${l}"
1224 - else
1225 - echo "LDPATH=${EPREFIX}/usr/${TARGET}/lib" >> "${ee}"
1226 - fi
1227 - mv_if_diff "${ee}" "${e}"
1228 - fi
1229 -
1230 - local c="${ENV_D}/config-${TARGET}"
1231 - local cc="${c}.tmp"
1232 - echo "CURRENT=${VER}" > "${cc}"
1233 - mv_if_diff "${cc}" "${c}"
1234 -
1235 - eend 0
1236 -
1237 - #
1238 - # Regen env.d if need/can be
1239 - #
1240 - if [[ ${ROOT} == "/" ]] && [[ ${TARGET} == ${HOST} ]] ; then
1241 - env-update
1242 - echo
1243 - ewarn "Please remember to run:"
1244 - echo
1245 - ewarn " # . /etc/profile"
1246 - echo
1247 - fi
1248 -
1249 - return 0
1250 -}
1251 -
1252 -uninstall_target() {
1253 - : ${TARGET:=${UARG}}
1254 -
1255 - if [[ ${TARGET} == ${HOST} ]] ; then
1256 - die "refusing to uninstall native binutils"
1257 - fi
1258 -
1259 - shopt -s nullglob
1260 - PROFILE=""
1261 -
1262 - for PROFILE in "${ENV_D}"/${TARGET}-* ; do
1263 - ewarn "Removing all signs of ${PROFILE##*/}"
1264 - rm -f "${ENV_D}"/${PROFILE}
1265 - done
1266 - if [[ -z ${PROFILE} ]] && [[ ! -e ${ENV_D}/config-${TARGET} ]] ; then
1267 - die "no profiles exist for '${TARGET}'"
1268 - fi
1269 -
1270 - rm -f "${ENV_D}"/config-${TARGET} "${EROOT}"/etc/ld.so.conf.d/05binutils.conf
1271 -
1272 - # XXX: we still leave behind FAKE_TARGETS in /usr/bin ...
1273 - local x
1274 - for x in \
1275 - addr2line ar as c++filt elf2flt elfedit flthdr gprof \
1276 - ld ld.{bfd,gold,real} \
1277 - nm objcopy objdump ranlib readelf size strings strip
1278 - do
1279 - x=(
1280 - "${EROOT}"/usr/bin/${TARGET}-${x}
1281 - "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
1282 - "${EROOT}"/usr/libexec/gcc/${TARGET}/${x}
1283 - )
1284 - rm -f "${x[@]}"
1285 - done
1286 - for x in ansidecl.h bfd.h bfdlink.h dis-asm.h symcat.h ; do
1287 - rm -f "${EROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
1288 - done
1289 - for x in bfd iberty opcodes ; do
1290 - rm -f "${EROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
1291 - done
1292 - # Delete broken symlinks
1293 - local destdir="${EROOT}/usr/${HOST}/${TARGET}"
1294 - rm -f "${destdir}"/lib/ldscripts
1295 - find -L "${destdir}"/lib -type l -exec rm {} +
1296 - rmdir \
1297 - "${destdir}"/{bin,include,lib,usr} \
1298 - "${destdir}" \
1299 - "${EROOT}"/var/db/pkg/cross-${TARGET} \
1300 - "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin \
1301 - "${EROOT}"/usr/libexec/gcc/${TARGET} \
1302 - 2>/dev/null
1303 -
1304 - rm -f "${ENV_D}"/${TARGET}-*
1305 -}
1306 -
1307 -set_current_profile() {
1308 - if [[ ! -f ${ENV_D}/config-${TARGET} ]] ; then
1309 - eerror "${argv0}: unable to locate a profile for target: ${TARGET}"
1310 - return 1
1311 - fi
1312 -
1313 - source "${ENV_D}/config-${TARGET}"
1314 -
1315 - if [[ -z ${CURRENT} ]] ; then
1316 - eerror "${argv0}: no binutils profile is active!"
1317 - return 1
1318 - fi
1319 -
1320 - echo "${TARGET}-${CURRENT}"
1321 -
1322 - return 0
1323 -}
1324 -get_current_profile() { echo "${PROFILE}" ; }
1325 -
1326 -list_profiles() {
1327 - local x i target
1328 -
1329 - if [[ ${ROOT} != / ]] ; then
1330 - echo "Using binutils-config info in ${ROOT}"
1331 - fi
1332 -
1333 - set -- "${ENV_D}"/*
1334 - target=
1335 - i=1
1336 -
1337 - for x ; do
1338 - # skip broken links and config files
1339 - [[ -f ${x} ]] || continue
1340 - [[ ${x} == */config-* ]] && continue
1341 -
1342 - source "${x}"
1343 - if [[ ${target} != ${TARGET} ]] ; then
1344 - [[ -n ${target} ]] && echo
1345 - target=${TARGET}
1346 - fi
1347 -
1348 - x=${x##*/}
1349 - if [[ -e ${ENV_D}/config-${TARGET} ]] ; then
1350 - source "${ENV_D}/config-${TARGET}"
1351 - if [[ ${VER} == ${CURRENT} ]] ; then
1352 - [[ ${TARGET} == ${HOST} ]] \
1353 - && x="${x} ${GOOD}*${NORMAL}" \
1354 - || x="${x} ${HILITE}*${NORMAL}"
1355 - fi
1356 - fi
1357 -
1358 - # We would align the [...] field like so:
1359 - #printf ' [%*ss] %s\n' ${##} "${i}" "${x}"
1360 - # but this breaks simple scripting: `binutils -l | awk '{print $2}'`
1361 -
1362 - # Or we could align the target col like so:
1363 - #printf ' [%s]%*s %s\n' "${i}" $(( ${##} - ${#i} )) "" "${x}"
1364 - # but i'm not sold that it looks better
1365 -
1366 - # So keep it simple ... only makes a diff anyways for crazy people
1367 - # like me which have 100+ binutils packages installed ...
1368 - echo " [$i] ${x}"
1369 - ((++i))
1370 - done
1371 -}
1372 -
1373 -switch_linker() {
1374 - local bpath ld=$1
1375 -
1376 - case ${ld} in
1377 - ld.*) ;;
1378 - *) die "not supported: linker must start with 'ld.'" ;;
1379 - esac
1380 -
1381 - setup_env || return 1
1382 - bpath="${ROOT}/${BINPATH}"
1383 -
1384 - # does this binutils even support the requested linker ?
1385 - if [[ ! -e ${bpath}/${ld} ]] ; then
1386 - die "sorry, but ${PROFILE} doesn't support the ${ld} linker"
1387 - fi
1388 -
1389 - # switch it up
1390 - ebegin "Setting default linker to ${ld} for ${PROFILE}"
1391 - atomic_ln ${ld} "${bpath}" ld
1392 - eend $?
1393 -}
1394 -
1395 -set_HOST() {
1396 - # Set HOST to CHOST if it isn't already set
1397 - : ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
1398 -}
1399 -
1400 -ENV_D="${EROOT}etc/env.d/binutils"
1401 -
1402 -DEBUG="no"
1403 -NEED_ACTION="yes"
1404 -DOIT="switch_profile"
1405 -PROFILE="current"
1406 -FAKE_TARGETS_USER=""
1407 -HOST=""
1408 -TARGET=""
1409 -unset UARG
1410 -
1411 -select_action() {
1412 - if [[ ${NEED_ACTION} != "no" ]] ; then
1413 - NEED_ACTION="no"
1414 - DOIT=$1
1415 - else
1416 - die "one action at a time!"
1417 - fi
1418 -}
1419 -
1420 -while [[ $# -gt 0 ]] ; do
1421 - x=$1
1422 - shift
1423 - case ${x} in
1424 - -c|--get-current-profile) select_action get_current_profile ;;
1425 - -l|--list|--list-profiles) select_action list_profiles ;;
1426 - -u|--uninstall) select_action uninstall_target ;;
1427 - --linker) select_action "switch_linker $1"; shift ;;
1428 - -d|--debug) DEBUG="yes" ;;
1429 - -h|--help) usage 0 ;;
1430 - -V|--version)
1431 - unset Header
1432 - cvsver="$Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-config/files/binutils-config-3,v 1.11 2013/05/05 05:20:42 vapier Exp $"
1433 - cvsver=${cvsver##*binutils-config-}
1434 - bver=${cvsver%%,v *}
1435 - cvsver=${cvsver#* }
1436 - echo "binutils-config-${bver} (r${cvsver%% *})"
1437 - exit 0
1438 - ;;
1439 - --amd64|--arm|--mips|--x86)
1440 - if [[ ${NEED_ACTION} == "yes" ]] ; then
1441 - # Make sure we have a space after each target
1442 - NEED_ACTION="no"
1443 - case ${x} in
1444 - --amd64) FAKE_TARGETS_USER="x86_64 ";;
1445 - --arm) FAKE_TARGETS_USER="arm armeb ";;
1446 - --x86) FAKE_TARGETS_USER="i386 i486 i586 i686 ";;
1447 - --mips) FAKE_TARGETS_USER="mips mips64 mipsel mipsel64 ";;
1448 - esac
1449 - fi
1450 - ;;
1451 - -*)
1452 - die "invalid switch! Try '--help'."
1453 - ;;
1454 - *)
1455 - if [[ ${UARG+set} == "set" ]] ; then
1456 - die "only one profile/target at a time please"
1457 - fi
1458 - NEED_ACTION="maybe"
1459 - UARG=${x}
1460 - ;;
1461 - esac
1462 -done
1463 -
1464 -[[ ${NEED_ACTION} == "yes" ]] && usage 1
1465 -[[ ${DEBUG} == "yes" ]] && set -x
1466 -
1467 -# All operations need to know the current HOST to figure out
1468 -# what is a native target and what is a cross target
1469 -set_HOST
1470 -
1471 -# All operations need to know the profile the user wants
1472 -case ${DOIT} in
1473 -switch_profile|switch_linker_*)
1474 - # decode user's profile choice
1475 - x=${UARG:-$(TARGET=${HOST} set_current_profile)}
1476 - PROFILE=""
1477 - if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
1478 - # User gave us a # representing the profile
1479 - i=1
1480 - for y in "${ENV_D}"/* ; do
1481 - [[ ${y/config-} != ${y} ]] && continue
1482 -
1483 - if [[ -f ${y} ]] && [[ ${x} -eq ${i} ]] ; then
1484 - PROFILE=${y##*/}
1485 - break
1486 - fi
1487 - ((++i))
1488 - done
1489 - fi
1490 -
1491 - if [[ -z ${PROFILE} ]] ; then
1492 - # User gave us a full HOST-ver
1493 - x=${x##*/}
1494 - if [[ -f ${ENV_D}/${x} ]] ; then
1495 - # Valid HOST-ver yeah!
1496 - PROFILE=${x}
1497 - else
1498 - # Not a valid HOST-ver ...
1499 - if [[ ! -f ${ENV_D}/config-${x} ]] ; then
1500 - # Maybe they just gave us a ver ...
1501 - if [[ -f ${ENV_D}/${HOST}-${x} ]] ; then
1502 - x=${HOST}-${x}
1503 - else
1504 - die "could not locate '$x' in '${ENV_D}/'!"
1505 - fi
1506 - PROFILE=${x}
1507 - else
1508 - # Maybe they just gave us a target ... pick active profile
1509 - PROFILE=$(TARGET=${x} set_current_profile)
1510 - fi
1511 - fi
1512 - fi
1513 - ;;
1514 -*)
1515 - # lookup current profile as the user gave us a target
1516 - PROFILE=$(TARGET=${UARG:-${HOST}} set_current_profile) || exit 1
1517 - ;;
1518 -esac
1519 -
1520 -eval ${DOIT}
1521 -
1522 -# vim:ts=4
1523
1524 diff --git a/sys-devel/binutils-config/files/binutils-config-5 b/sys-devel/binutils-config/files/binutils-config-5
1525 index 3afc963..b0d8760 100755
1526 --- a/sys-devel/binutils-config/files/binutils-config-5
1527 +++ b/sys-devel/binutils-config/files/binutils-config-5
1528 @@ -7,16 +7,23 @@
1529 # config-TARGET: CURRENT=version for TARGET
1530 # TARGET-VER: has a TARGET and VER variable
1531
1532 +EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
1533 +if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
1534 + EPREFIX=""
1535 +fi
1536 +
1537 : ${ROOT:=/}
1538 [[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
1539 [[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
1540
1541 -cd /
1542 +EROOT="${ROOT%/}${EPREFIX}/"
1543 +
1544 +cd "${EPREFIX}/"
1545
1546 trap ":" INT QUIT TSTP
1547
1548 argv0=${0##*/}
1549 -FUNCTIONS_SH="/lib/gentoo/functions.sh"
1550 +FUNCTIONS_SH="${EPREFIX}/lib/gentoo/functions.sh"
1551 source ${FUNCTIONS_SH} || {
1552 echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
1553 exit 1
1554 @@ -97,14 +104,14 @@ setup_env() {
1555 # Newer paths: /usr/${HOST}/${TARGET}/...
1556 # Older paths: /usr/${TARGET}/...
1557 #
1558 - if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
1559 - BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER}
1560 - BINPATH_LINKS=/usr/libexec/gcc/${TARGET}
1561 + if [[ -d "${EROOT}"/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then
1562 + BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER}
1563 + BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET}
1564 fi
1565 fi
1566 if [[ -z ${BINPATH} ]] ; then
1567 - BINPATH=/usr/${TARGET}/binutils-bin/${VER}
1568 - BINPATH_LINKS=/usr/${TARGET}/bin
1569 + BINPATH="${EPREFIX}"/usr/${TARGET}/binutils-bin/${VER}
1570 + BINPATH_LINKS="${EPREFIX}"/usr/${TARGET}/bin
1571 fi
1572 }
1573
1574 @@ -123,24 +130,24 @@ switch_profile() {
1575 setup_env || return 1
1576
1577 cd "${ROOT}/${BINPATH}" || exit 1
1578 - mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin"
1579 + mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin"
1580 for x in * ; do
1581 atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}"
1582 - atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin" "${TARGET}-${x}"
1583 + atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}"
1584 if [[ ${TARGET} == ${HOST} ]] ; then
1585 - atomic_ln "${TARGET}-${x}" "${ROOT}/usr/bin" "${x}"
1586 + atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}"
1587 fi
1588 done
1589
1590 #
1591 # Generate library / ldscripts symlinks
1592 #
1593 - : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}}
1594 + : ${LIBPATH:=${EPREFIX}/usr/lib/binutils/${TARGET}/${VER}}
1595 cd "${ROOT}/${LIBPATH}" || exit 1
1596 if [[ ${TARGET} == ${HOST} ]] ; then
1597 - dstlib=${ROOT}/usr/${HOST}/lib
1598 + dstlib=${EROOT}/usr/${HOST}/lib
1599 else
1600 - dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib
1601 + dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib
1602 fi
1603 # When upgrading, we need to clean up ldscripts and libs.
1604 # Don't symlink back in the libs -- the binutils-lib package handles
1605 @@ -160,17 +167,17 @@ switch_profile() {
1606 if [[ ${HOST} == ${TARGET} ]] ; then
1607 # The binutils-lib package handles these files now.
1608 for x in libiberty "${HEADERS[@]}" ; do
1609 - x="${ROOT}/usr/include/${x}"
1610 + x="${EROOT}/usr/include/${x}"
1611 if [[ -L ${x} ]] ; then
1612 rm "${x}"
1613 fi
1614 done
1615 else
1616 # Clean out old path -- cannot use '-exec {} +' syntax here
1617 - find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \;
1618 - rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null
1619 - rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null
1620 - rmdir "${ROOT}/usr/${TARGET}" >& /dev/null
1621 + find . -type f -exec rm -f "${EROOT}/usr/${TARGET}/usr/include/{}" \;
1622 + rmdir "${EROOT}/usr/${TARGET}/usr/include" >& /dev/null
1623 + rmdir "${EROOT}/usr/${TARGET}/usr" >& /dev/null
1624 + rmdir "${EROOT}/usr/${TARGET}" >& /dev/null
1625 fi
1626 fi
1627
1628 @@ -183,14 +190,14 @@ switch_profile() {
1629 # Note: This skips ldconfig update if env.d had LDPATH, but meh.
1630 # Most people have upgraded to ld.so.conf.d, and someone else will
1631 # eventually re-run ldconfig for us.
1632 - x="${ROOT}"/etc/ld.so.conf.d/05binutils.conf
1633 + x="${EROOT}"/etc/ld.so.conf.d/05binutils.conf
1634 if [[ -e ${x} ]]; then
1635 rm -f "${x}"
1636 env_update_flag=""
1637 fi
1638
1639 - DATAPATH=/usr/share/binutils-data/${TARGET}/${VER}
1640 - local e="${ROOT}"/etc/env.d/05binutils
1641 + DATAPATH="${EPREFIX}"/usr/share/binutils-data/${TARGET}/${VER}
1642 + local e="${EROOT}"/etc/env.d/05binutils
1643 local ee="${e}.tmp"
1644 rm -f "${ee}"
1645 [[ -d ${ROOT}/${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}"
1646 @@ -213,7 +220,7 @@ switch_profile() {
1647 echo
1648 ewarn "Please remember to run:"
1649 echo
1650 - ewarn " # . /etc/profile"
1651 + ewarn " # . ${EPREFIX}/etc/profile"
1652 echo
1653 fi
1654
1655 @@ -247,28 +254,28 @@ uninstall_target() {
1656 nm objcopy objdump ranlib readelf size strings strip
1657 do
1658 x=(
1659 - "${ROOT}"/usr/bin/${TARGET}-${x}
1660 - "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
1661 - "${ROOT}"/usr/libexec/gcc/${TARGET}/${x}
1662 + "${EROOT}"/usr/bin/${TARGET}-${x}
1663 + "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x}
1664 + "${EROOT}"/usr/libexec/gcc/${TARGET}/${x}
1665 )
1666 rm -f "${x[@]}"
1667 done
1668 for x in "${HEADERS[@]}" ; do
1669 - rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
1670 + rm -f "${EROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x}
1671 done
1672 for x in bfd iberty opcodes ; do
1673 - rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
1674 + rm -f "${EROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la}
1675 done
1676 # Delete broken symlinks
1677 - local destdir="${ROOT}/usr/${HOST}/${TARGET}"
1678 + local destdir="${EROOT}/usr/${HOST}/${TARGET}"
1679 rm -f "${destdir}"/lib/ldscripts
1680 find -L "${destdir}"/lib -type l -exec rm {} +
1681 rmdir \
1682 "${destdir}"/{bin,include,lib,usr} \
1683 "${destdir}" \
1684 - "${ROOT}"/var/db/pkg/cross-${TARGET} \
1685 - "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin \
1686 - "${ROOT}"/usr/libexec/gcc/${TARGET} \
1687 + "${EROOT}"/var/db/pkg/cross-${TARGET} \
1688 + "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin \
1689 + "${EROOT}"/usr/libexec/gcc/${TARGET} \
1690 2>/dev/null
1691
1692 rm -f "${ENV_D}"/${TARGET}-*
1693 @@ -367,7 +374,7 @@ set_HOST() {
1694 : ${HOST:=${CHOST:-$(portageq envvar CHOST)}}
1695 }
1696
1697 -ENV_D="${ROOT}etc/env.d/binutils"
1698 +ENV_D="${EROOT}etc/env.d/binutils"
1699
1700 DEBUG="no"
1701 NEED_ACTION="yes"
1702
1703 diff --git a/sys-devel/binutils-config/files/binutils-config-5 b/sys-devel/binutils-config/files/binutils-config-5.orig
1704 similarity index 100%
1705 copy from sys-devel/binutils-config/files/binutils-config-5
1706 copy to sys-devel/binutils-config/files/binutils-config-5.orig