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