1 |
commit: 62c75f76eb7047f3f9f53b080a46a4ba4c6d9c48 |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 25 02:28:10 2016 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 25 02:28:43 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=62c75f76 |
7 |
|
8 |
sys-devel/binutils-config: add prefix support. |
9 |
|
10 |
Bug: 531616 |
11 |
|
12 |
Package-Manager: portage-2.2.28 |
13 |
RepoMan-Options: --force |
14 |
|
15 |
.../binutils-config/binutils-config-5-r2.ebuild | 5 +- |
16 |
sys-devel/binutils-config/files/binutils-config-5 | 84 +++++++++++----------- |
17 |
2 files changed, 45 insertions(+), 44 deletions(-) |
18 |
|
19 |
diff --git a/sys-devel/binutils-config/binutils-config-5-r2.ebuild b/sys-devel/binutils-config/binutils-config-5-r2.ebuild |
20 |
index adb97e0..98eb31b 100644 |
21 |
--- a/sys-devel/binutils-config/binutils-config-5-r2.ebuild |
22 |
+++ b/sys-devel/binutils-config/binutils-config-5-r2.ebuild |
23 |
@@ -1,9 +1,11 @@ |
24 |
-# Copyright 1999-2015 Gentoo Foundation |
25 |
+# Copyright 1999-2016 Gentoo Foundation |
26 |
# Distributed under the terms of the GNU General Public License v2 |
27 |
# $Id$ |
28 |
|
29 |
EAPI="4" |
30 |
|
31 |
+inherit prefix |
32 |
+ |
33 |
DESCRIPTION="Utility to change the binutils version being used" |
34 |
HOMEPAGE="https://www.gentoo.org/" |
35 |
SRC_URI="" |
36 |
@@ -21,6 +23,7 @@ S=${WORKDIR} |
37 |
|
38 |
src_install() { |
39 |
newbin "${FILESDIR}"/${PN}-${PV} ${PN} |
40 |
+ use prefix && eprefixify "${ED}"/usr/bin/${PN} |
41 |
doman "${FILESDIR}"/${PN}.8 |
42 |
|
43 |
insinto /usr/share/eselect/modules |
44 |
|
45 |
diff --git a/sys-devel/binutils-config/files/binutils-config-5 b/sys-devel/binutils-config/files/binutils-config-5 |
46 |
index 2bdd07e..b0d8760 100755 |
47 |
--- a/sys-devel/binutils-config/files/binutils-config-5 |
48 |
+++ b/sys-devel/binutils-config/files/binutils-config-5 |
49 |
@@ -7,16 +7,23 @@ |
50 |
# config-TARGET: CURRENT=version for TARGET |
51 |
# TARGET-VER: has a TARGET and VER variable |
52 |
|
53 |
+EPREFIX="@GENTOO_PORTAGE_EPREFIX@" |
54 |
+if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then |
55 |
+ EPREFIX="" |
56 |
+fi |
57 |
+ |
58 |
: ${ROOT:=/} |
59 |
[[ ${ROOT} != */ ]] && ROOT="${ROOT}/" |
60 |
[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}" |
61 |
|
62 |
-cd / |
63 |
+EROOT="${ROOT%/}${EPREFIX}/" |
64 |
+ |
65 |
+cd "${EPREFIX}/" |
66 |
|
67 |
trap ":" INT QUIT TSTP |
68 |
|
69 |
argv0=${0##*/} |
70 |
-FUNCTIONS_SH="/lib/gentoo/functions.sh" |
71 |
+FUNCTIONS_SH="${EPREFIX}/lib/gentoo/functions.sh" |
72 |
source ${FUNCTIONS_SH} || { |
73 |
echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2 |
74 |
exit 1 |
75 |
@@ -97,14 +104,14 @@ setup_env() { |
76 |
# Newer paths: /usr/${HOST}/${TARGET}/... |
77 |
# Older paths: /usr/${TARGET}/... |
78 |
# |
79 |
- if [[ -d ${ROOT}/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then |
80 |
- BINPATH=/usr/${HOST}/${TARGET}/binutils-bin/${VER} |
81 |
- BINPATH_LINKS=/usr/libexec/gcc/${TARGET} |
82 |
+ if [[ -d "${EROOT}"/usr/${HOST}/${TARGET}/binutils-bin/${VER} ]] ; then |
83 |
+ BINPATH="${EPREFIX}"/usr/${HOST}/${TARGET}/binutils-bin/${VER} |
84 |
+ BINPATH_LINKS="${EPREFIX}"/usr/libexec/gcc/${TARGET} |
85 |
fi |
86 |
fi |
87 |
if [[ -z ${BINPATH} ]] ; then |
88 |
- BINPATH=/usr/${TARGET}/binutils-bin/${VER} |
89 |
- BINPATH_LINKS=/usr/${TARGET}/bin |
90 |
+ BINPATH="${EPREFIX}"/usr/${TARGET}/binutils-bin/${VER} |
91 |
+ BINPATH_LINKS="${EPREFIX}"/usr/${TARGET}/bin |
92 |
fi |
93 |
} |
94 |
|
95 |
@@ -123,24 +130,24 @@ switch_profile() { |
96 |
setup_env || return 1 |
97 |
|
98 |
cd "${ROOT}/${BINPATH}" || exit 1 |
99 |
- mkdir -p "${ROOT}/${BINPATH_LINKS}" "${ROOT}/usr/bin" |
100 |
+ mkdir -p "${ROOT}/${BINPATH_LINKS}" "${EROOT}/usr/bin" |
101 |
for x in * ; do |
102 |
atomic_ln "${BINPATH}/${x}" "${ROOT}/${BINPATH_LINKS}" "${x}" |
103 |
- atomic_ln "${BINPATH_LINKS}/${x}" "${ROOT}/usr/bin" "${TARGET}-${x}" |
104 |
+ atomic_ln "${BINPATH_LINKS}/${x}" "${EROOT}/usr/bin" "${TARGET}-${x}" |
105 |
if [[ ${TARGET} == ${HOST} ]] ; then |
106 |
- atomic_ln "${TARGET}-${x}" "${ROOT}/usr/bin" "${x}" |
107 |
+ atomic_ln "${TARGET}-${x}" "${EROOT}/usr/bin" "${x}" |
108 |
fi |
109 |
done |
110 |
|
111 |
# |
112 |
# Generate library / ldscripts symlinks |
113 |
# |
114 |
- : ${LIBPATH:=/usr/lib/binutils/${TARGET}/${VER}} |
115 |
+ : ${LIBPATH:=${EPREFIX}/usr/lib/binutils/${TARGET}/${VER}} |
116 |
cd "${ROOT}/${LIBPATH}" || exit 1 |
117 |
if [[ ${TARGET} == ${HOST} ]] ; then |
118 |
- dstlib=${ROOT}/usr/${HOST}/lib |
119 |
+ dstlib=${EROOT}/usr/${HOST}/lib |
120 |
else |
121 |
- dstlib=${ROOT}/usr/${HOST}/${TARGET}/lib |
122 |
+ dstlib=${EROOT}/usr/${HOST}/${TARGET}/lib |
123 |
fi |
124 |
# When upgrading, we need to clean up ldscripts and libs. |
125 |
# Don't symlink back in the libs -- the binutils-lib package handles |
126 |
@@ -149,16 +156,7 @@ switch_profile() { |
127 |
mkdir -p "${dstlib}" |
128 |
rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts |
129 |
atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts" |
130 |
- find -L "${dstlib}" -xtype l -name 'lib*' -delete |
131 |
- # Detect older binutils w/broken rpaths. #562460 |
132 |
- # We can hardcode the "/lib" part since that's what the binutils |
133 |
- # configure scripts have. They did not include any other path. |
134 |
- if [[ $(scanelf -qF '%r#F' "${ROOT}/${BINPATH}/as") == */lib ]] ; then |
135 |
- ewarn "Old cross-binutils detected; please re-emerge to fix (see bug #562460)." |
136 |
- for x in lib* ; do |
137 |
- atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}" |
138 |
- done |
139 |
- fi |
140 |
+ find -L "${dstlib}" -xtype l -name 'lib*' -exec rm -f {} + |
141 |
|
142 |
# |
143 |
# Clean out old generated include symlinks |
144 |
@@ -169,17 +167,17 @@ switch_profile() { |
145 |
if [[ ${HOST} == ${TARGET} ]] ; then |
146 |
# The binutils-lib package handles these files now. |
147 |
for x in libiberty "${HEADERS[@]}" ; do |
148 |
- x="${ROOT}/usr/include/${x}" |
149 |
+ x="${EROOT}/usr/include/${x}" |
150 |
if [[ -L ${x} ]] ; then |
151 |
rm "${x}" |
152 |
fi |
153 |
done |
154 |
else |
155 |
# Clean out old path -- cannot use '-exec {} +' syntax here |
156 |
- find . -type f -exec rm -f "${ROOT}/usr/${TARGET}/usr/include/{}" \; |
157 |
- rmdir "${ROOT}/usr/${TARGET}/usr/include" >& /dev/null |
158 |
- rmdir "${ROOT}/usr/${TARGET}/usr" >& /dev/null |
159 |
- rmdir "${ROOT}/usr/${TARGET}" >& /dev/null |
160 |
+ find . -type f -exec rm -f "${EROOT}/usr/${TARGET}/usr/include/{}" \; |
161 |
+ rmdir "${EROOT}/usr/${TARGET}/usr/include" >& /dev/null |
162 |
+ rmdir "${EROOT}/usr/${TARGET}/usr" >& /dev/null |
163 |
+ rmdir "${EROOT}/usr/${TARGET}" >& /dev/null |
164 |
fi |
165 |
fi |
166 |
|
167 |
@@ -192,14 +190,14 @@ switch_profile() { |
168 |
# Note: This skips ldconfig update if env.d had LDPATH, but meh. |
169 |
# Most people have upgraded to ld.so.conf.d, and someone else will |
170 |
# eventually re-run ldconfig for us. |
171 |
- x="${ROOT}"/etc/ld.so.conf.d/05binutils.conf |
172 |
+ x="${EROOT}"/etc/ld.so.conf.d/05binutils.conf |
173 |
if [[ -e ${x} ]]; then |
174 |
rm -f "${x}" |
175 |
env_update_flag="" |
176 |
fi |
177 |
|
178 |
- DATAPATH=/usr/share/binutils-data/${TARGET}/${VER} |
179 |
- local e="${ROOT}"/etc/env.d/05binutils |
180 |
+ DATAPATH="${EPREFIX}"/usr/share/binutils-data/${TARGET}/${VER} |
181 |
+ local e="${EROOT}"/etc/env.d/05binutils |
182 |
local ee="${e}.tmp" |
183 |
rm -f "${ee}" |
184 |
[[ -d ${ROOT}/${DATAPATH}/man ]] && echo "MANPATH=${DATAPATH}/man" >> "${ee}" |
185 |
@@ -222,7 +220,7 @@ switch_profile() { |
186 |
echo |
187 |
ewarn "Please remember to run:" |
188 |
echo |
189 |
- ewarn " # . /etc/profile" |
190 |
+ ewarn " # . ${EPREFIX}/etc/profile" |
191 |
echo |
192 |
fi |
193 |
|
194 |
@@ -251,33 +249,33 @@ uninstall_target() { |
195 |
|
196 |
local x |
197 |
for x in \ |
198 |
- addr2line ar as c++filt dwp elf2flt elfedit flthdr gprof \ |
199 |
+ addr2line ar as c++filt elf2flt elfedit flthdr gprof \ |
200 |
ld ld.{bfd,gold,real} \ |
201 |
nm objcopy objdump ranlib readelf size strings strip |
202 |
do |
203 |
x=( |
204 |
- "${ROOT}"/usr/bin/${TARGET}-${x} |
205 |
- "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x} |
206 |
- "${ROOT}"/usr/libexec/gcc/${TARGET}/${x} |
207 |
+ "${EROOT}"/usr/bin/${TARGET}-${x} |
208 |
+ "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin/${x} |
209 |
+ "${EROOT}"/usr/libexec/gcc/${TARGET}/${x} |
210 |
) |
211 |
rm -f "${x[@]}" |
212 |
done |
213 |
for x in "${HEADERS[@]}" ; do |
214 |
- rm -f "${ROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x} |
215 |
+ rm -f "${EROOT}"/usr/{${HOST}/,}${TARGET}/{usr/,}include/${x} |
216 |
done |
217 |
for x in bfd iberty opcodes ; do |
218 |
- rm -f "${ROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la} |
219 |
+ rm -f "${EROOT}"/usr/${HOST}/${TARGET}/lib/lib${x}{{-*,}.so,.a,.la} |
220 |
done |
221 |
# Delete broken symlinks |
222 |
- local destdir="${ROOT}/usr/${HOST}/${TARGET}" |
223 |
+ local destdir="${EROOT}/usr/${HOST}/${TARGET}" |
224 |
rm -f "${destdir}"/lib/ldscripts |
225 |
find -L "${destdir}"/lib -type l -exec rm {} + |
226 |
rmdir \ |
227 |
"${destdir}"/{bin,include,lib,usr} \ |
228 |
"${destdir}" \ |
229 |
- "${ROOT}"/var/db/pkg/cross-${TARGET} \ |
230 |
- "${ROOT}"/usr/{${HOST}/,}${TARGET}/bin \ |
231 |
- "${ROOT}"/usr/libexec/gcc/${TARGET} \ |
232 |
+ "${EROOT}"/var/db/pkg/cross-${TARGET} \ |
233 |
+ "${EROOT}"/usr/{${HOST}/,}${TARGET}/bin \ |
234 |
+ "${EROOT}"/usr/libexec/gcc/${TARGET} \ |
235 |
2>/dev/null |
236 |
|
237 |
rm -f "${ENV_D}"/${TARGET}-* |
238 |
@@ -376,7 +374,7 @@ set_HOST() { |
239 |
: ${HOST:=${CHOST:-$(portageq envvar CHOST)}} |
240 |
} |
241 |
|
242 |
-ENV_D="${ROOT}etc/env.d/binutils" |
243 |
+ENV_D="${EROOT}etc/env.d/binutils" |
244 |
|
245 |
DEBUG="no" |
246 |
NEED_ACTION="yes" |