1 |
commit: a8ca7dce93d983fe846aab9968f780d7ea17f822 |
2 |
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 15 21:33:14 2022 +0000 |
4 |
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 15 21:33:35 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8ca7dce |
7 |
|
8 |
sys-devel/binutils: 2.37 patchset bump |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
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.37_p1-r2.ebuild | 451 ++++++++++++++++++++++++++ |
15 |
2 files changed, 452 insertions(+) |
16 |
|
17 |
diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest |
18 |
index f257b112d8d0..6e23e4923e4e 100644 |
19 |
--- a/sys-devel/binutils/Manifest |
20 |
+++ b/sys-devel/binutils/Manifest |
21 |
@@ -10,4 +10,5 @@ DIST binutils-2.36.1-patches-5.tar.xz 44388 BLAKE2B 1dadb012fe35ec5fb0c5a15d348a |
22 |
DIST binutils-2.36.1.tar.xz 22772248 BLAKE2B 03fbfbedd6dba2beaa836b1ed254eddd7a54a163d3061fd93edd2b9591cae24ba049b26658c524b5ccecc2f22d431dfa168218d2531aa356945c994fbbe896fa SHA512 cc24590bcead10b90763386b6f96bb027d7594c659c2d95174a6352e8b98465a50ec3e4088d0da038428abe059bbc4ae5f37b269f31a40fc048072c8a234f4e9 |
23 |
DIST binutils-2.37_p1-patches-0.tar.xz 1392 BLAKE2B 128930a381022fea5d1fcb0695953e8dada2513b088b8540fe08d4e0da93ec18b6bf9c78acad6ec5a8982ae2c115d143462ef0bb7bfd63cfeb06c10ad472c2f8 SHA512 44666821f96349e96685ffcfd53a80a94659e38fc63eeeb980d0eed13aab03ae3e2d5059b4932cd9018f2f7698cdb5e15b443d60c01b2bd1385eeb0c698e0e24 |
24 |
DIST binutils-2.37_p1-patches-1.tar.xz 28956 BLAKE2B 3bc14fcc52a6d11992ad9ed88fa3347ca3d5facd59de094a178a5f720d0eed6297dadf9a8fea7189076eb81274612c0b71c01f15a8f58deeaed8c8f6135ef50d SHA512 f6b2a09bfc692cf90f6cd56be81f424a68831db48054dc150eb6ec28bfa18d35933203c2d3b502f0c80e38771353c373446aec2488469fe2df20d8066033f59e |
25 |
+DIST binutils-2.37_p1-patches-2.tar.xz 31956 BLAKE2B 39c48628d0e2d7f3a8cf11be391b51dc64c7a534a3e64950fd992907c34fa36bebdf95cc5a184dd5b35e134e0c20376b5883abbf96ae57403c55377e615a6790 SHA512 c927aafa8c87e3b68ad28da5a17edf5647591ec26feeb56c743bc6637ffb10832b50ec6fd8442e80e40628b624e31b2f0f0b5f1193e77dc7e5442df0cb8cc8f1 |
26 |
DIST binutils-2.37_p1.tar.xz 22992196 BLAKE2B a8aa0f386d03a5b1466166ac7c40989c228351ccf0949a9b462b4d4615d70ab7e1a45351299140a42baf39c317b8007733c253eb547ee1dfadb612addde11621 SHA512 46c297ec2a7a5b81d1c6e3f16486a6dc2860a07520fe2dd8871d1eb5160065bbe2cc6b0415d5352bf12284133e5817a4e429e6077182d615e969bd1a8f52ed28 |
27 |
|
28 |
diff --git a/sys-devel/binutils/binutils-2.37_p1-r2.ebuild b/sys-devel/binutils/binutils-2.37_p1-r2.ebuild |
29 |
new file mode 100644 |
30 |
index 000000000000..cfdd2538eefe |
31 |
--- /dev/null |
32 |
+++ b/sys-devel/binutils/binutils-2.37_p1-r2.ebuild |
33 |
@@ -0,0 +1,451 @@ |
34 |
+# Copyright 1999-2022 Gentoo Authors |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+EAPI=7 |
38 |
+ |
39 |
+inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs |
40 |
+ |
41 |
+DESCRIPTION="Tools necessary to build programs" |
42 |
+HOMEPAGE="https://sourceware.org/binutils/" |
43 |
+LICENSE="GPL-3+" |
44 |
+IUSE="cet default-gold doc +gold multitarget +nls +plugins static-libs test vanilla" |
45 |
+REQUIRED_USE="default-gold? ( gold )" |
46 |
+ |
47 |
+# Variables that can be set here (ignored for live ebuilds) |
48 |
+# PATCH_VER - the patchset version |
49 |
+# Default: empty, no patching |
50 |
+# PATCH_BINUTILS_VER - the binutils version in the patchset name |
51 |
+# - Default: PV |
52 |
+# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... |
53 |
+# for the patchsets |
54 |
+ |
55 |
+PATCH_VER=2 |
56 |
+PATCH_DEV=dilfridge |
57 |
+ |
58 |
+if [[ ${PV} == 9999* ]]; then |
59 |
+ inherit git-r3 |
60 |
+ SLOT=${PV} |
61 |
+else |
62 |
+ PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} |
63 |
+ PATCH_DEV=${PATCH_DEV:-dilfridge} |
64 |
+ SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" |
65 |
+ [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} |
66 |
+ https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" |
67 |
+ SLOT=$(ver_cut 1-2) |
68 |
+ #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
69 |
+fi |
70 |
+ |
71 |
+# |
72 |
+# The cross-compile logic |
73 |
+# |
74 |
+export CTARGET=${CTARGET:-${CHOST}} |
75 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
76 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
77 |
+ export CTARGET=${CATEGORY#cross-} |
78 |
+ fi |
79 |
+fi |
80 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
81 |
+ |
82 |
+# |
83 |
+# The dependencies |
84 |
+# |
85 |
+RDEPEND=" |
86 |
+ >=sys-devel/binutils-config-3 |
87 |
+ sys-libs/zlib |
88 |
+" |
89 |
+DEPEND="${RDEPEND}" |
90 |
+BDEPEND=" |
91 |
+ doc? ( sys-apps/texinfo ) |
92 |
+ test? ( |
93 |
+ dev-util/dejagnu |
94 |
+ sys-devel/bc |
95 |
+ ) |
96 |
+ nls? ( sys-devel/gettext ) |
97 |
+ sys-devel/flex |
98 |
+ virtual/yacc |
99 |
+" |
100 |
+ |
101 |
+RESTRICT="!test? ( test )" |
102 |
+ |
103 |
+MY_BUILDDIR=${WORKDIR}/build |
104 |
+ |
105 |
+src_unpack() { |
106 |
+ if [[ ${PV} == 9999* ]] ; then |
107 |
+ EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git" |
108 |
+ EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git |
109 |
+ git-r3_src_unpack |
110 |
+ mv patches-git/9999 patch || die |
111 |
+ |
112 |
+ EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" |
113 |
+ S=${WORKDIR}/binutils |
114 |
+ EGIT_CHECKOUT_DIR=${S} |
115 |
+ git-r3_src_unpack |
116 |
+ else |
117 |
+ unpack ${P/-hppa64/}.tar.xz |
118 |
+ |
119 |
+ cd "${WORKDIR}" || die |
120 |
+ unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz |
121 |
+ |
122 |
+ # _p patch versions are Gentoo specific tarballs ... |
123 |
+ local dir=${P%_p?} |
124 |
+ dir=${dir/-hppa64/} |
125 |
+ |
126 |
+ S=${WORKDIR}/${dir} |
127 |
+ fi |
128 |
+ |
129 |
+ cd "${WORKDIR}" || die |
130 |
+ mkdir -p "${MY_BUILDDIR}" || die |
131 |
+} |
132 |
+ |
133 |
+src_prepare() { |
134 |
+ local patchsetname |
135 |
+ if [[ ${PV} == 9999* ]] ; then |
136 |
+ patchsetname="from git master" |
137 |
+ else |
138 |
+ patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}" |
139 |
+ fi |
140 |
+ |
141 |
+ if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then |
142 |
+ if ! use vanilla; then |
143 |
+ einfo "Applying binutils patchset ${patchsetname}" |
144 |
+ eapply "${WORKDIR}/patch" |
145 |
+ einfo "Done." |
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 |
+ use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 |
207 |
+ |
208 |
+ local x |
209 |
+ echo |
210 |
+ for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do |
211 |
+ einfo "$(printf '%10s' ${x}:) ${!x}" |
212 |
+ done |
213 |
+ echo |
214 |
+ |
215 |
+ cd "${MY_BUILDDIR}" |
216 |
+ local myconf=() |
217 |
+ |
218 |
+ if use plugins ; then |
219 |
+ myconf+=( --enable-plugins ) |
220 |
+ fi |
221 |
+ # enable gold (installed as ld.gold) and ld's plugin architecture |
222 |
+ if use gold ; then |
223 |
+ myconf+=( --enable-gold ) |
224 |
+ if use default-gold; then |
225 |
+ myconf+=( --enable-gold=default ) |
226 |
+ fi |
227 |
+ fi |
228 |
+ |
229 |
+ if use nls ; then |
230 |
+ myconf+=( --without-included-gettext ) |
231 |
+ else |
232 |
+ myconf+=( --disable-nls ) |
233 |
+ fi |
234 |
+ |
235 |
+ myconf+=( --with-system-zlib ) |
236 |
+ |
237 |
+ # For bi-arch systems, enable a 64bit bfd. This matches |
238 |
+ # the bi-arch logic in toolchain.eclass. #446946 |
239 |
+ # We used to do it for everyone, but it's slow on 32bit arches. #438522 |
240 |
+ case $(tc-arch) in |
241 |
+ ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;; |
242 |
+ esac |
243 |
+ |
244 |
+ use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) |
245 |
+ |
246 |
+ [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} ) |
247 |
+ |
248 |
+ is_cross && myconf+=( |
249 |
+ --with-sysroot="${EPREFIX}"/usr/${CTARGET} |
250 |
+ --enable-poison-system-directories |
251 |
+ ) |
252 |
+ |
253 |
+ # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+ |
254 |
+ # on everyone in alpha (for now), we'll just enable it when possible |
255 |
+ has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt ) |
256 |
+ has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt ) |
257 |
+ |
258 |
+ # mips can't do hash-style=gnu ... |
259 |
+ if [[ $(tc-arch) != mips ]] ; then |
260 |
+ myconf+=( --enable-default-hash-style=gnu ) |
261 |
+ fi |
262 |
+ |
263 |
+ myconf+=( |
264 |
+ --prefix="${EPREFIX}"/usr |
265 |
+ --host=${CHOST} |
266 |
+ --target=${CTARGET} |
267 |
+ --datadir="${EPREFIX}"${DATAPATH} |
268 |
+ --datarootdir="${EPREFIX}"${DATAPATH} |
269 |
+ --infodir="${EPREFIX}"${DATAPATH}/info |
270 |
+ --mandir="${EPREFIX}"${DATAPATH}/man |
271 |
+ --bindir="${EPREFIX}"${BINPATH} |
272 |
+ --libdir="${EPREFIX}"${LIBPATH} |
273 |
+ --libexecdir="${EPREFIX}"${LIBPATH} |
274 |
+ --includedir="${EPREFIX}"${INCPATH} |
275 |
+ --enable-obsolete |
276 |
+ --enable-shared |
277 |
+ --enable-threads |
278 |
+ # Newer versions (>=2.27) offer a configure flag now. |
279 |
+ --enable-relro |
280 |
+ # Newer versions (>=2.24) make this an explicit option. #497268 |
281 |
+ --enable-install-libiberty |
282 |
+ # Available from 2.35 on |
283 |
+ --enable-textrel-check=warning |
284 |
+ # Works better than vapier's patch... #808787 |
285 |
+ --enable-new-dtags |
286 |
+ --disable-werror |
287 |
+ --with-bugurl="$(toolchain-binutils_bugurl)" |
288 |
+ --with-pkgversion="$(toolchain-binutils_pkgversion)" |
289 |
+ $(use_enable static-libs static) |
290 |
+ ${EXTRA_ECONF} |
291 |
+ # Disable modules that are in a combined binutils/gdb tree. #490566 |
292 |
+ --disable-{gdb,libdecnumber,readline,sim} |
293 |
+ # Strip out broken static link flags. |
294 |
+ # https://gcc.gnu.org/PR56750 |
295 |
+ --without-stage1-ldflags |
296 |
+ # Change SONAME to avoid conflict across |
297 |
+ # {native,cross}/binutils, binutils-libs. #666100 |
298 |
+ --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) |
299 |
+ |
300 |
+ # avoid automagic dependency on (currently prefix) systems |
301 |
+ # systems with debuginfod library, bug #754753 |
302 |
+ --without-debuginfod |
303 |
+ |
304 |
+ # Allow user to opt into CET for host libraries. |
305 |
+ # Ideally we would like automagic-or-disabled here. |
306 |
+ # But the check does not quite work on i686: bug #760926. |
307 |
+ $(use_enable cet) |
308 |
+ ) |
309 |
+ echo ./configure "${myconf[@]}" |
310 |
+ "${S}"/configure "${myconf[@]}" || die |
311 |
+ |
312 |
+ # Prevent makeinfo from running if doc is unset. |
313 |
+ if ! use doc ; then |
314 |
+ sed -i \ |
315 |
+ -e '/^MAKEINFO/s:=.*:= true:' \ |
316 |
+ Makefile || die |
317 |
+ fi |
318 |
+} |
319 |
+ |
320 |
+src_compile() { |
321 |
+ cd "${MY_BUILDDIR}" |
322 |
+ # see Note [tooldir hack for ldscripts] |
323 |
+ emake tooldir="${EPREFIX}${TOOLPATH}" all |
324 |
+ |
325 |
+ # only build info pages if the user wants them |
326 |
+ if use doc ; then |
327 |
+ emake info |
328 |
+ fi |
329 |
+ |
330 |
+ # we nuke the manpages when we're left with junk |
331 |
+ # (like when we bootstrap, no perl -> no manpages) |
332 |
+ find . -name '*.1' -a -size 0 -delete |
333 |
+} |
334 |
+ |
335 |
+src_test() { |
336 |
+ cd "${MY_BUILDDIR}" |
337 |
+ |
338 |
+ # bug 637066 |
339 |
+ filter-flags -Wall -Wreturn-type |
340 |
+ |
341 |
+ emake -k check |
342 |
+} |
343 |
+ |
344 |
+src_install() { |
345 |
+ local x d |
346 |
+ |
347 |
+ cd "${MY_BUILDDIR}" |
348 |
+ # see Note [tooldir hack for ldscripts] |
349 |
+ emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install |
350 |
+ rm -rf "${ED}"/${LIBPATH}/bin |
351 |
+ use static-libs || find "${ED}" -name '*.la' -delete |
352 |
+ |
353 |
+ # Newer versions of binutils get fancy with ${LIBPATH} #171905 |
354 |
+ cd "${ED}"/${LIBPATH} |
355 |
+ for d in ../* ; do |
356 |
+ [[ ${d} == ../${PV} ]] && continue |
357 |
+ mv ${d}/* . || die |
358 |
+ rmdir ${d} || die |
359 |
+ done |
360 |
+ |
361 |
+ # Now we collect everything intp the proper SLOT-ed dirs |
362 |
+ # When something is built to cross-compile, it installs into |
363 |
+ # /usr/$CHOST/ by default ... we have to 'fix' that :) |
364 |
+ if is_cross ; then |
365 |
+ cd "${ED}"/${BINPATH} |
366 |
+ for x in * ; do |
367 |
+ mv ${x} ${x/${CTARGET}-} |
368 |
+ done |
369 |
+ |
370 |
+ if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then |
371 |
+ mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH} |
372 |
+ mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/ |
373 |
+ rm -r "${ED}"/usr/${CHOST}/{include,lib} |
374 |
+ fi |
375 |
+ fi |
376 |
+ insinto ${INCPATH} |
377 |
+ local libiberty_headers=( |
378 |
+ # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir. |
379 |
+ demangle.h |
380 |
+ dyn-string.h |
381 |
+ fibheap.h |
382 |
+ hashtab.h |
383 |
+ libiberty.h |
384 |
+ objalloc.h |
385 |
+ splay-tree.h |
386 |
+ ) |
387 |
+ doins "${libiberty_headers[@]/#/${S}/include/}" |
388 |
+ if [[ -d ${ED}/${LIBPATH}/lib ]] ; then |
389 |
+ mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ |
390 |
+ rm -r "${ED}"/${LIBPATH}/lib |
391 |
+ fi |
392 |
+ |
393 |
+ # Generate an env.d entry for this binutils |
394 |
+ insinto /etc/env.d/binutils |
395 |
+ cat <<-EOF > "${T}"/env.d |
396 |
+ TARGET="${CTARGET}" |
397 |
+ VER="${PV}" |
398 |
+ LIBPATH="${EPREFIX}${LIBPATH}" |
399 |
+ EOF |
400 |
+ newins "${T}"/env.d ${CTARGET}-${PV} |
401 |
+ |
402 |
+ # Handle documentation |
403 |
+ if ! is_cross ; then |
404 |
+ cd "${S}" |
405 |
+ dodoc README |
406 |
+ docinto bfd |
407 |
+ dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO |
408 |
+ docinto binutils |
409 |
+ dodoc binutils/ChangeLog binutils/NEWS binutils/README |
410 |
+ docinto gas |
411 |
+ dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* |
412 |
+ docinto gprof |
413 |
+ dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl |
414 |
+ docinto ld |
415 |
+ dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO |
416 |
+ docinto libiberty |
417 |
+ dodoc libiberty/ChangeLog* libiberty/README |
418 |
+ docinto opcodes |
419 |
+ dodoc opcodes/ChangeLog* |
420 |
+ fi |
421 |
+ |
422 |
+ # Remove shared info pages |
423 |
+ rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} |
424 |
+ |
425 |
+ # Trim all empty dirs |
426 |
+ find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null |
427 |
+} |
428 |
+ |
429 |
+pkg_postinst() { |
430 |
+ # Make sure this ${CTARGET} has a binutils version selected |
431 |
+ [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 |
432 |
+ binutils-config ${CTARGET}-${PV} |
433 |
+} |
434 |
+ |
435 |
+pkg_postrm() { |
436 |
+ local current_profile=$(binutils-config -c ${CTARGET}) |
437 |
+ |
438 |
+ # If no other versions exist, then uninstall for this |
439 |
+ # target ... otherwise, switch to the newest version |
440 |
+ # Note: only do this if this version is unmerged. We |
441 |
+ # rerun binutils-config if this is a remerge, as |
442 |
+ # we want the mtimes on the symlinks updated (if |
443 |
+ # it is the same as the current selected profile) |
444 |
+ if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then |
445 |
+ local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') |
446 |
+ choice=${choice//$'\n'/ } |
447 |
+ choice=${choice/* } |
448 |
+ if [[ -z ${choice} ]] ; then |
449 |
+ binutils-config -u ${CTARGET} |
450 |
+ else |
451 |
+ binutils-config ${choice} |
452 |
+ fi |
453 |
+ elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then |
454 |
+ binutils-config ${CTARGET}-${PV} |
455 |
+ fi |
456 |
+} |
457 |
+ |
458 |
+# Note [slotting support] |
459 |
+# ----------------------- |
460 |
+# Gentoo's layout for binutils files is non-standard as Gentoo |
461 |
+# supports slotted installation for binutils. Many tools |
462 |
+# still expect binutils to reside in known locations. |
463 |
+# binutils-config package restores symlinks into known locations, |
464 |
+# like: |
465 |
+# /usr/bin/${CTARGET}-<tool> |
466 |
+# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips |
467 |
+# /usr/include/ |
468 |
+# |
469 |
+# Note [tooldir hack for ldscripts] |
470 |
+# --------------------------------- |
471 |
+# Build system does not allow ./configure to tweak every location |
472 |
+# we need for slotting binutils hence all the shuffling in |
473 |
+# src_install(). This note is about SCRIPTDIR define handling. |
474 |
+# |
475 |
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value |
476 |
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' |
477 |
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. |
478 |
+# Thus we can't just move files around after compilation finished. |
479 |
+# |
480 |
+# Our goal is the following: |
481 |
+# - at build-time set scriptdir to point to symlinked location: |
482 |
+# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) |
483 |
+# - at install-time set scriptdir to point to slotted location: |
484 |
+# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} |