1 |
commit: 06a60cd676554f19aac444144f4375d998b1fb50 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jan 4 12:23:24 2020 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 4 12:31:05 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=06a60cd6 |
7 |
|
8 |
sys-devel/binutils: backport ia64 binary section merge, bug #699180 |
9 |
|
10 |
Single new patch: |
11 |
- Fix ld/PR25316 for the ia64 target by refusing to support binary merging. |
12 |
|
13 |
Should help =dev-libs/glib-2.60.6 test suite to embed .xml files into data |
14 |
section. |
15 |
|
16 |
Reported-by: Émeric Maschino |
17 |
Bug: https://bugs.gentoo.org/699180 |
18 |
Bug: https://sourceware.org/PR25316 |
19 |
Package-Manager: Portage-2.3.84, Repoman-2.3.20 |
20 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
21 |
|
22 |
sys-devel/binutils/Manifest | 2 + |
23 |
sys-devel/binutils/binutils-2.32-r2.ebuild | 439 +++++++++++++++++++++++++++ |
24 |
sys-devel/binutils/binutils-2.33.1-r1.ebuild | 433 ++++++++++++++++++++++++++ |
25 |
3 files changed, 874 insertions(+) |
26 |
|
27 |
diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest |
28 |
index bc0695ae77e..b74d48318f5 100644 |
29 |
--- a/sys-devel/binutils/Manifest |
30 |
+++ b/sys-devel/binutils/Manifest |
31 |
@@ -11,7 +11,9 @@ DIST binutils-2.30.tar.xz 20286700 BLAKE2B 2dd5436a15a601011a1950e6082ec00082f59 |
32 |
DIST binutils-2.31.1-patches-7.tar.xz 76828 BLAKE2B 354e7c3aa76c0cfe8fc6bb419a5b19294c0be09ebdff2fc4533dd16116fcd4f4a1b4c8db02233dabe33ca68347e0a30e542456988a4ead407edb47ed031e018c SHA512 c84ff9cd9f5b1e313e93d0f25bb4244950a73e0d97ec4dacb8763382219a08a01b16a8e93173032232ea4239098b29448331ed461f792e663e1117eb0811f85b |
33 |
DIST binutils-2.31.1.tar.xz 20467996 BLAKE2B 6b914df1fbb7cf54f2159f71b2c2b09f3f6a569b7a3cb4cf9790d0a3733a7548bc0ea32334a178ed3b56e8b97656ae99c7abaf212601beeaeae9a0884c0f6051 SHA512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30 |
34 |
DIST binutils-2.32-patches-2.tar.xz 145672 BLAKE2B 8218e621f99cb4bcd1638c3011449b94480d207eaeb79cf75c0072e0f1a86bfd1603fc4515bc40d3ac1921a18b9a211b20568f59b11b13eb44e6cff1329c5af9 SHA512 55c25a603f6175af3ade6848e5c1faba06a147d72e9a4f53d44502d97db76499485a67b278a654d18884714a7bf7b360c77c9e42dba3cdc188f805bfe461f09f |
35 |
+DIST binutils-2.32-patches-3.tar.xz 151372 BLAKE2B 70d5f78d9f3e3bf9ff096b6f24babcc35c63395a5e1155a981a5ceb4b7a5706ad2ee0c77c74e910fc0eefeaed19763113186deb9665eed538dc3b8e227bef12d SHA512 5e91eff63332c2aca86a82a287ca4959a6098065ed88078265a3d79a2c851abd113e9736b75d8102a208996ed1191b0e23569921217ece975f1d9005a55afd0d |
36 |
DIST binutils-2.32.tar.xz 20774880 BLAKE2B d1bdbd9c8487c091665c197974ce4bdf520b7a67ed6997a81b87e6a0af9514a091458244f583acec5ae580ac2ee5e908f67f483b8e5263cd18ced794cb235da6 SHA512 d326408f12a03d9a61a9de56584c2af12f81c2e50d2d7e835d51565df8314df01575724afa1e43bd0db45cfc9916b41519b67dfce03232aa4978704492a6994a |
37 |
DIST binutils-2.33.1-patches-1.tar.xz 17944 BLAKE2B 811ad416fe9c059f645856a3123ed32303afe1d0f166a15cb6de0673b5494fdcc4c165da4a68eb7ab73f007618e3a97a5578c4b47de21e57fe501d6a21b6d595 SHA512 63b439637206d21e46d2b79383b38da2b28365a0fdea1f5ac3b665cd05e0b55cd1d7763c05567a5f7ae2c645d2ae639a27e465d535b928d9f8f0e6b94f31e1f7 |
38 |
+DIST binutils-2.33.1-patches-2.tar.xz 18636 BLAKE2B 0e0757329b6a83aeff4f4c450c95e73fd48fcc89f83e63f294568632bee0972552cf2f57494352c5d9a7c16a51cdbc4108b38fa6028d4388c8e76046b3da9212 SHA512 d982f68d1f5fdb384309a2a1b7426bf840a90e7a85b37229b4223b62c36cab9dd9ec0c08382c85c68adf996dec21133df3180a2fc649363adae8645f8282f71d |
39 |
DIST binutils-2.33.1.tar.xz 21490848 BLAKE2B c336a8412938dc8c224f40a763a8bea9937cca0462a8fb80e62f14aabe590107fc061a3f4b9327e1f4652cb026384d36a91b4766d4d469d2d0680932874b638c SHA512 b7a6767c6c7ca6b5cafa7080e6820b7bb3a53b7148348c438d99905defbdf0d30c9744a484ee01c9441a8153901808513366b15ba9533e20c9673c262ade36ac |
40 |
DIST binutils-9999-patches-5.tar.xz 17492 BLAKE2B 4d5072d26d714dbc2a65899102c35791887b3c1298eb40a72088f5f964f500fa82581ac27a47f075812610e1757ba1ca5ac7d055dccc0d819ec06a86ca98f395 SHA512 c8a843cf04b72f010eef405cc2d029e49fb1f4582686f1e0409579d544b02d249c31f7cb9cd59747bc94727e29ddaba89951043b392017c6963ca14f3a0202b1 |
41 |
|
42 |
diff --git a/sys-devel/binutils/binutils-2.32-r2.ebuild b/sys-devel/binutils/binutils-2.32-r2.ebuild |
43 |
new file mode 100644 |
44 |
index 00000000000..e24bc140daf |
45 |
--- /dev/null |
46 |
+++ b/sys-devel/binutils/binutils-2.32-r2.ebuild |
47 |
@@ -0,0 +1,439 @@ |
48 |
+# Copyright 1999-2020 Gentoo Authors |
49 |
+# Distributed under the terms of the GNU General Public License v2 |
50 |
+ |
51 |
+EAPI=7 |
52 |
+ |
53 |
+inherit eutils libtool flag-o-matic gnuconfig multilib |
54 |
+ |
55 |
+DESCRIPTION="Tools necessary to build programs" |
56 |
+HOMEPAGE="https://sourceware.org/binutils/" |
57 |
+LICENSE="GPL-3+" |
58 |
+IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test" |
59 |
+REQUIRED_USE="default-gold? ( gold )" |
60 |
+ |
61 |
+# Variables that can be set here: |
62 |
+# PATCH_VER - the patchset version |
63 |
+# Default: empty, no patching |
64 |
+# PATCH_BINUTILS_VER - the binutils version in the patchset name |
65 |
+# - Default: PV |
66 |
+# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... |
67 |
+# for the patchsets |
68 |
+ |
69 |
+PATCH_VER=3 |
70 |
+PATCH_DEV=slyfox |
71 |
+ |
72 |
+case ${PV} in |
73 |
+ 9999) |
74 |
+ EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" |
75 |
+ inherit git-r3 |
76 |
+ S=${WORKDIR}/binutils |
77 |
+ EGIT_CHECKOUT_DIR=${S} |
78 |
+ SLOT=${PV} |
79 |
+ ;; |
80 |
+ *.9999) |
81 |
+ EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" |
82 |
+ inherit git-r3 |
83 |
+ S=${WORKDIR}/binutils |
84 |
+ EGIT_CHECKOUT_DIR=${S} |
85 |
+ EGIT_BRANCH=$(ver_cut 1-2) |
86 |
+ EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch" |
87 |
+ SLOT=$(ver_cut 1-2) |
88 |
+ ;; |
89 |
+ *) |
90 |
+ SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz" |
91 |
+ SLOT=$(ver_cut 1-2) |
92 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86" |
93 |
+ ;; |
94 |
+esac |
95 |
+ |
96 |
+# |
97 |
+# The Gentoo patchset |
98 |
+# |
99 |
+PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} |
100 |
+PATCH_DEV=${PATCH_DEV:-slyfox} |
101 |
+ |
102 |
+[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} |
103 |
+ https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" |
104 |
+ |
105 |
+# Disable gold testsuite since it always fails. |
106 |
+PATCHES=( "${FILESDIR}/${PN}-2.29.1-nogoldtest.patch" ) |
107 |
+ |
108 |
+# |
109 |
+# The cross-compile logic |
110 |
+# |
111 |
+export CTARGET=${CTARGET:-${CHOST}} |
112 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
113 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
114 |
+ export CTARGET=${CATEGORY#cross-} |
115 |
+ fi |
116 |
+fi |
117 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
118 |
+ |
119 |
+# |
120 |
+# The dependencies |
121 |
+# |
122 |
+RDEPEND=" |
123 |
+ >=sys-devel/binutils-config-3 |
124 |
+ sys-libs/zlib |
125 |
+" |
126 |
+DEPEND="${RDEPEND} |
127 |
+ doc? ( sys-apps/texinfo ) |
128 |
+ test? ( dev-util/dejagnu ) |
129 |
+ nls? ( sys-devel/gettext ) |
130 |
+ sys-devel/flex |
131 |
+ virtual/yacc |
132 |
+" |
133 |
+ |
134 |
+RESTRICT="!test? ( test )" |
135 |
+ |
136 |
+MY_BUILDDIR=${WORKDIR}/build |
137 |
+ |
138 |
+src_unpack() { |
139 |
+ case ${PV} in |
140 |
+ *9999) |
141 |
+ git-r3_src_unpack |
142 |
+ ;; |
143 |
+ *) |
144 |
+ ;; |
145 |
+ esac |
146 |
+ default |
147 |
+ mkdir -p "${MY_BUILDDIR}" |
148 |
+} |
149 |
+ |
150 |
+src_prepare() { |
151 |
+ if [[ ! -z ${PATCH_VER} ]] ; then |
152 |
+ # Use upstream patch to enable development mode |
153 |
+ rm -v "${WORKDIR}/patch"/0000-Gentoo-Git-is-development.patch || die |
154 |
+ |
155 |
+ einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" |
156 |
+ eapply "${WORKDIR}/patch"/*.patch |
157 |
+ fi |
158 |
+ |
159 |
+ # This check should probably go somewhere else, like pkg_pretend. |
160 |
+ if [[ ${CTARGET} == *-uclibc* ]] ; then |
161 |
+ if grep -qs 'linux-gnu' "${S}"/ltconfig ; then |
162 |
+ die "sorry, but this binutils doesn't yet support uClibc :(" |
163 |
+ fi |
164 |
+ fi |
165 |
+ |
166 |
+ # Make sure our explicit libdir paths don't get clobbered. #562460 |
167 |
+ sed -i \ |
168 |
+ -e 's:@bfdlibdir@:@libdir@:g' \ |
169 |
+ -e 's:@bfdincludedir@:@includedir@:g' \ |
170 |
+ {bfd,opcodes}/Makefile.in || die |
171 |
+ |
172 |
+ # Fix locale issues if possible #122216 |
173 |
+ if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then |
174 |
+ einfo "Fixing misc issues in configure files" |
175 |
+ for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do |
176 |
+ ebegin " Updating ${f/${S}\/}" |
177 |
+ patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \ |
178 |
+ || eerror "Please file a bug about this" |
179 |
+ eend $? |
180 |
+ done |
181 |
+ fi |
182 |
+ |
183 |
+ # Fix conflicts with newer glibc #272594 |
184 |
+ if [[ -e libiberty/testsuite/test-demangle.c ]] ; then |
185 |
+ sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c |
186 |
+ fi |
187 |
+ |
188 |
+ # Apply things from PATCHES and user dirs |
189 |
+ default |
190 |
+ |
191 |
+ # Run misc portage update scripts |
192 |
+ gnuconfig_update |
193 |
+ elibtoolize --portage --no-uclibc |
194 |
+} |
195 |
+ |
196 |
+toolchain-binutils_bugurl() { |
197 |
+ printf "https://bugs.gentoo.org/" |
198 |
+} |
199 |
+toolchain-binutils_pkgversion() { |
200 |
+ printf "Gentoo ${PV}" |
201 |
+ [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}" |
202 |
+} |
203 |
+ |
204 |
+src_configure() { |
205 |
+ # Setup some paths |
206 |
+ LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
207 |
+ INCPATH=${LIBPATH}/include |
208 |
+ DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
209 |
+ if is_cross ; then |
210 |
+ TOOLPATH=/usr/${CHOST}/${CTARGET} |
211 |
+ else |
212 |
+ TOOLPATH=/usr/${CTARGET} |
213 |
+ fi |
214 |
+ BINPATH=${TOOLPATH}/binutils-bin/${PV} |
215 |
+ |
216 |
+ # Make sure we filter $LINGUAS so that only ones that |
217 |
+ # actually work make it through #42033 |
218 |
+ strip-linguas -u */po |
219 |
+ |
220 |
+ # Keep things sane |
221 |
+ strip-flags |
222 |
+ |
223 |
+ local x |
224 |
+ echo |
225 |
+ for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do |
226 |
+ einfo "$(printf '%10s' ${x}:) ${!x}" |
227 |
+ done |
228 |
+ echo |
229 |
+ |
230 |
+ cd "${MY_BUILDDIR}" |
231 |
+ local myconf=() |
232 |
+ |
233 |
+ if use plugins ; then |
234 |
+ myconf+=( --enable-plugins ) |
235 |
+ fi |
236 |
+ # enable gold (installed as ld.gold) and ld's plugin architecture |
237 |
+ if use gold ; then |
238 |
+ myconf+=( --enable-gold ) |
239 |
+ if use default-gold; then |
240 |
+ myconf+=( --enable-gold=default ) |
241 |
+ fi |
242 |
+ fi |
243 |
+ |
244 |
+ if use nls ; then |
245 |
+ myconf+=( --without-included-gettext ) |
246 |
+ else |
247 |
+ myconf+=( --disable-nls ) |
248 |
+ fi |
249 |
+ |
250 |
+ myconf+=( --with-system-zlib ) |
251 |
+ |
252 |
+ # For bi-arch systems, enable a 64bit bfd. This matches |
253 |
+ # the bi-arch logic in toolchain.eclass. #446946 |
254 |
+ # We used to do it for everyone, but it's slow on 32bit arches. #438522 |
255 |
+ case $(tc-arch) in |
256 |
+ ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;; |
257 |
+ esac |
258 |
+ |
259 |
+ use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) |
260 |
+ |
261 |
+ [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} ) |
262 |
+ |
263 |
+ is_cross && myconf+=( |
264 |
+ --with-sysroot="${EPREFIX}"/usr/${CTARGET} |
265 |
+ --enable-poison-system-directories |
266 |
+ ) |
267 |
+ |
268 |
+ # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+ |
269 |
+ # on everyone in alpha (for now), we'll just enable it when possible |
270 |
+ has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt ) |
271 |
+ has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt ) |
272 |
+ |
273 |
+ # mips can't do hash-style=gnu ... |
274 |
+ if [[ $(tc-arch) != mips ]] ; then |
275 |
+ myconf+=( --enable-default-hash-style=gnu ) |
276 |
+ fi |
277 |
+ |
278 |
+ myconf+=( |
279 |
+ --prefix="${EPREFIX}"/usr |
280 |
+ --host=${CHOST} |
281 |
+ --target=${CTARGET} |
282 |
+ --datadir="${EPREFIX}"${DATAPATH} |
283 |
+ --datarootdir="${EPREFIX}"${DATAPATH} |
284 |
+ --infodir="${EPREFIX}"${DATAPATH}/info |
285 |
+ --mandir="${EPREFIX}"${DATAPATH}/man |
286 |
+ --bindir="${EPREFIX}"${BINPATH} |
287 |
+ --libdir="${EPREFIX}"${LIBPATH} |
288 |
+ --libexecdir="${EPREFIX}"${LIBPATH} |
289 |
+ --includedir="${EPREFIX}"${INCPATH} |
290 |
+ --enable-obsolete |
291 |
+ --enable-shared |
292 |
+ --enable-threads |
293 |
+ # Newer versions (>=2.27) offer a configure flag now. |
294 |
+ --enable-relro |
295 |
+ # Newer versions (>=2.24) make this an explicit option. #497268 |
296 |
+ --enable-install-libiberty |
297 |
+ --disable-werror |
298 |
+ --with-bugurl="$(toolchain-binutils_bugurl)" |
299 |
+ --with-pkgversion="$(toolchain-binutils_pkgversion)" |
300 |
+ $(use_enable static-libs static) |
301 |
+ ${EXTRA_ECONF} |
302 |
+ # Disable modules that are in a combined binutils/gdb tree. #490566 |
303 |
+ --disable-{gdb,libdecnumber,readline,sim} |
304 |
+ # Strip out broken static link flags. |
305 |
+ # https://gcc.gnu.org/PR56750 |
306 |
+ --without-stage1-ldflags |
307 |
+ # Change SONAME to avoid conflict across |
308 |
+ # {native,cross}/binutils, binutils-libs. #666100 |
309 |
+ --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) |
310 |
+ ) |
311 |
+ echo ./configure "${myconf[@]}" |
312 |
+ "${S}"/configure "${myconf[@]}" || die |
313 |
+ |
314 |
+ # Prevent makeinfo from running if doc is unset. |
315 |
+ if ! use doc ; then |
316 |
+ sed -i \ |
317 |
+ -e '/^MAKEINFO/s:=.*:= true:' \ |
318 |
+ Makefile || die |
319 |
+ fi |
320 |
+} |
321 |
+ |
322 |
+src_compile() { |
323 |
+ cd "${MY_BUILDDIR}" |
324 |
+ # see Note [tooldir hack for ldscripts] |
325 |
+ emake tooldir="${EPREFIX}${TOOLPATH}" all |
326 |
+ |
327 |
+ # only build info pages if the user wants them |
328 |
+ if use doc ; then |
329 |
+ emake info |
330 |
+ fi |
331 |
+ |
332 |
+ # we nuke the manpages when we're left with junk |
333 |
+ # (like when we bootstrap, no perl -> no manpages) |
334 |
+ find . -name '*.1' -a -size 0 -delete |
335 |
+} |
336 |
+ |
337 |
+src_test() { |
338 |
+ cd "${MY_BUILDDIR}" |
339 |
+ |
340 |
+ # bug 637066 |
341 |
+ filter-flags -Wall -Wreturn-type |
342 |
+ |
343 |
+ emake -k check |
344 |
+} |
345 |
+ |
346 |
+src_install() { |
347 |
+ local x d |
348 |
+ |
349 |
+ cd "${MY_BUILDDIR}" |
350 |
+ # see Note [tooldir hack for ldscripts] |
351 |
+ emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install |
352 |
+ rm -rf "${ED}"/${LIBPATH}/bin |
353 |
+ use static-libs || find "${ED}" -name '*.la' -delete |
354 |
+ |
355 |
+ # Newer versions of binutils get fancy with ${LIBPATH} #171905 |
356 |
+ cd "${ED}"/${LIBPATH} |
357 |
+ for d in ../* ; do |
358 |
+ [[ ${d} == ../${PV} ]] && continue |
359 |
+ mv ${d}/* . || die |
360 |
+ rmdir ${d} || die |
361 |
+ done |
362 |
+ |
363 |
+ # Now we collect everything intp the proper SLOT-ed dirs |
364 |
+ # When something is built to cross-compile, it installs into |
365 |
+ # /usr/$CHOST/ by default ... we have to 'fix' that :) |
366 |
+ if is_cross ; then |
367 |
+ cd "${ED}"/${BINPATH} |
368 |
+ for x in * ; do |
369 |
+ mv ${x} ${x/${CTARGET}-} |
370 |
+ done |
371 |
+ |
372 |
+ if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then |
373 |
+ mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH} |
374 |
+ mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/ |
375 |
+ rm -r "${ED}"/usr/${CHOST}/{include,lib} |
376 |
+ fi |
377 |
+ fi |
378 |
+ insinto ${INCPATH} |
379 |
+ local libiberty_headers=( |
380 |
+ # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir. |
381 |
+ demangle.h |
382 |
+ dyn-string.h |
383 |
+ fibheap.h |
384 |
+ hashtab.h |
385 |
+ libiberty.h |
386 |
+ objalloc.h |
387 |
+ splay-tree.h |
388 |
+ ) |
389 |
+ doins "${libiberty_headers[@]/#/${S}/include/}" |
390 |
+ if [[ -d ${ED}/${LIBPATH}/lib ]] ; then |
391 |
+ mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ |
392 |
+ rm -r "${ED}"/${LIBPATH}/lib |
393 |
+ fi |
394 |
+ |
395 |
+ # Generate an env.d entry for this binutils |
396 |
+ insinto /etc/env.d/binutils |
397 |
+ cat <<-EOF > "${T}"/env.d |
398 |
+ TARGET="${CTARGET}" |
399 |
+ VER="${PV}" |
400 |
+ LIBPATH="${EPREFIX}${LIBPATH}" |
401 |
+ EOF |
402 |
+ newins "${T}"/env.d ${CTARGET}-${PV} |
403 |
+ |
404 |
+ # Handle documentation |
405 |
+ if ! is_cross ; then |
406 |
+ cd "${S}" |
407 |
+ dodoc README |
408 |
+ docinto bfd |
409 |
+ dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO |
410 |
+ docinto binutils |
411 |
+ dodoc binutils/ChangeLog binutils/NEWS binutils/README |
412 |
+ docinto gas |
413 |
+ dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* |
414 |
+ docinto gprof |
415 |
+ dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl |
416 |
+ docinto ld |
417 |
+ dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO |
418 |
+ docinto libiberty |
419 |
+ dodoc libiberty/ChangeLog* libiberty/README |
420 |
+ docinto opcodes |
421 |
+ dodoc opcodes/ChangeLog* |
422 |
+ fi |
423 |
+ |
424 |
+ # Remove shared info pages |
425 |
+ rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} |
426 |
+ |
427 |
+ # Trim all empty dirs |
428 |
+ find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null |
429 |
+} |
430 |
+ |
431 |
+pkg_postinst() { |
432 |
+ # Make sure this ${CTARGET} has a binutils version selected |
433 |
+ [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 |
434 |
+ binutils-config ${CTARGET}-${PV} |
435 |
+} |
436 |
+ |
437 |
+pkg_postrm() { |
438 |
+ local current_profile=$(binutils-config -c ${CTARGET}) |
439 |
+ |
440 |
+ # If no other versions exist, then uninstall for this |
441 |
+ # target ... otherwise, switch to the newest version |
442 |
+ # Note: only do this if this version is unmerged. We |
443 |
+ # rerun binutils-config if this is a remerge, as |
444 |
+ # we want the mtimes on the symlinks updated (if |
445 |
+ # it is the same as the current selected profile) |
446 |
+ if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then |
447 |
+ local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') |
448 |
+ choice=${choice//$'\n'/ } |
449 |
+ choice=${choice/* } |
450 |
+ if [[ -z ${choice} ]] ; then |
451 |
+ binutils-config -u ${CTARGET} |
452 |
+ else |
453 |
+ binutils-config ${choice} |
454 |
+ fi |
455 |
+ elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then |
456 |
+ binutils-config ${CTARGET}-${PV} |
457 |
+ fi |
458 |
+} |
459 |
+ |
460 |
+# Note [slotting support] |
461 |
+# ----------------------- |
462 |
+# Gentoo's layout for binutils files is non-standard as Gentoo |
463 |
+# supports slotted installation for binutils. Many tools |
464 |
+# still expect binutils to reside in known locations. |
465 |
+# binutils-config package restores symlinks into known locations, |
466 |
+# like: |
467 |
+# /usr/bin/${CTARGET}-<tool> |
468 |
+# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips |
469 |
+# /usr/include/ |
470 |
+# |
471 |
+# Note [tooldir hack for ldscripts] |
472 |
+# --------------------------------- |
473 |
+# Build system does not allow ./configure to tweak every location |
474 |
+# we need for slotting binutils hence all the shuffling in |
475 |
+# src_install(). This note is about SCRIPTDIR define handling. |
476 |
+# |
477 |
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value |
478 |
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' |
479 |
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. |
480 |
+# Thus we can't just move files around after compilation finished. |
481 |
+# |
482 |
+# Our goal is the following: |
483 |
+# - at build-time set scriptdir to point to symlinked location: |
484 |
+# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) |
485 |
+# - at install-time set scriptdir to point to slotted location: |
486 |
+# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
487 |
|
488 |
diff --git a/sys-devel/binutils/binutils-2.33.1-r1.ebuild b/sys-devel/binutils/binutils-2.33.1-r1.ebuild |
489 |
new file mode 100644 |
490 |
index 00000000000..b961ec55af1 |
491 |
--- /dev/null |
492 |
+++ b/sys-devel/binutils/binutils-2.33.1-r1.ebuild |
493 |
@@ -0,0 +1,433 @@ |
494 |
+# Copyright 1999-2020 Gentoo Authors |
495 |
+# Distributed under the terms of the GNU General Public License v2 |
496 |
+ |
497 |
+EAPI=7 |
498 |
+ |
499 |
+inherit eutils libtool flag-o-matic gnuconfig multilib |
500 |
+ |
501 |
+DESCRIPTION="Tools necessary to build programs" |
502 |
+HOMEPAGE="https://sourceware.org/binutils/" |
503 |
+LICENSE="GPL-3+" |
504 |
+IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test" |
505 |
+REQUIRED_USE="default-gold? ( gold )" |
506 |
+ |
507 |
+# Variables that can be set here: |
508 |
+# PATCH_VER - the patchset version |
509 |
+# Default: empty, no patching |
510 |
+# PATCH_BINUTILS_VER - the binutils version in the patchset name |
511 |
+# - Default: PV |
512 |
+# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... |
513 |
+# for the patchsets |
514 |
+ |
515 |
+PATCH_VER=2 |
516 |
+PATCH_DEV=slyfox |
517 |
+ |
518 |
+case ${PV} in |
519 |
+ 9999) |
520 |
+ EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" |
521 |
+ inherit git-r3 |
522 |
+ S=${WORKDIR}/binutils |
523 |
+ EGIT_CHECKOUT_DIR=${S} |
524 |
+ SLOT=${PV} |
525 |
+ ;; |
526 |
+ *.9999) |
527 |
+ EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" |
528 |
+ inherit git-r3 |
529 |
+ S=${WORKDIR}/binutils |
530 |
+ EGIT_CHECKOUT_DIR=${S} |
531 |
+ EGIT_BRANCH=$(ver_cut 1-2) |
532 |
+ EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch" |
533 |
+ SLOT=$(ver_cut 1-2) |
534 |
+ ;; |
535 |
+ *) |
536 |
+ SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz" |
537 |
+ SLOT=$(ver_cut 1-2) |
538 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86" |
539 |
+ ;; |
540 |
+esac |
541 |
+ |
542 |
+# |
543 |
+# The Gentoo patchset |
544 |
+# |
545 |
+PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} |
546 |
+PATCH_DEV=${PATCH_DEV:-slyfox} |
547 |
+ |
548 |
+[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} |
549 |
+ https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" |
550 |
+ |
551 |
+# |
552 |
+# The cross-compile logic |
553 |
+# |
554 |
+export CTARGET=${CTARGET:-${CHOST}} |
555 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
556 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
557 |
+ export CTARGET=${CATEGORY#cross-} |
558 |
+ fi |
559 |
+fi |
560 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
561 |
+ |
562 |
+# |
563 |
+# The dependencies |
564 |
+# |
565 |
+RDEPEND=" |
566 |
+ >=sys-devel/binutils-config-3 |
567 |
+ sys-libs/zlib |
568 |
+" |
569 |
+DEPEND="${RDEPEND} |
570 |
+ doc? ( sys-apps/texinfo ) |
571 |
+ test? ( dev-util/dejagnu ) |
572 |
+ nls? ( sys-devel/gettext ) |
573 |
+ sys-devel/flex |
574 |
+ virtual/yacc |
575 |
+" |
576 |
+ |
577 |
+RESTRICT="!test? ( test )" |
578 |
+ |
579 |
+MY_BUILDDIR=${WORKDIR}/build |
580 |
+ |
581 |
+src_unpack() { |
582 |
+ case ${PV} in |
583 |
+ *9999) |
584 |
+ git-r3_src_unpack |
585 |
+ ;; |
586 |
+ *) |
587 |
+ ;; |
588 |
+ esac |
589 |
+ default |
590 |
+ mkdir -p "${MY_BUILDDIR}" |
591 |
+} |
592 |
+ |
593 |
+src_prepare() { |
594 |
+ if [[ ! -z ${PATCH_VER} ]] ; then |
595 |
+ einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" |
596 |
+ eapply "${WORKDIR}/patch"/*.patch |
597 |
+ fi |
598 |
+ |
599 |
+ # This check should probably go somewhere else, like pkg_pretend. |
600 |
+ if [[ ${CTARGET} == *-uclibc* ]] ; then |
601 |
+ if grep -qs 'linux-gnu' "${S}"/ltconfig ; then |
602 |
+ die "sorry, but this binutils doesn't yet support uClibc :(" |
603 |
+ fi |
604 |
+ fi |
605 |
+ |
606 |
+ # Make sure our explicit libdir paths don't get clobbered. #562460 |
607 |
+ sed -i \ |
608 |
+ -e 's:@bfdlibdir@:@libdir@:g' \ |
609 |
+ -e 's:@bfdincludedir@:@includedir@:g' \ |
610 |
+ {bfd,opcodes}/Makefile.in || die |
611 |
+ |
612 |
+ # Fix locale issues if possible #122216 |
613 |
+ if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then |
614 |
+ einfo "Fixing misc issues in configure files" |
615 |
+ for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do |
616 |
+ ebegin " Updating ${f/${S}\/}" |
617 |
+ patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \ |
618 |
+ || eerror "Please file a bug about this" |
619 |
+ eend $? |
620 |
+ done |
621 |
+ fi |
622 |
+ |
623 |
+ # Fix conflicts with newer glibc #272594 |
624 |
+ if [[ -e libiberty/testsuite/test-demangle.c ]] ; then |
625 |
+ sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c |
626 |
+ fi |
627 |
+ |
628 |
+ # Apply things from PATCHES and user dirs |
629 |
+ default |
630 |
+ |
631 |
+ # Run misc portage update scripts |
632 |
+ gnuconfig_update |
633 |
+ elibtoolize --portage --no-uclibc |
634 |
+} |
635 |
+ |
636 |
+toolchain-binutils_bugurl() { |
637 |
+ printf "https://bugs.gentoo.org/" |
638 |
+} |
639 |
+toolchain-binutils_pkgversion() { |
640 |
+ printf "Gentoo ${PV}" |
641 |
+ [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}" |
642 |
+} |
643 |
+ |
644 |
+src_configure() { |
645 |
+ # Setup some paths |
646 |
+ LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
647 |
+ INCPATH=${LIBPATH}/include |
648 |
+ DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
649 |
+ if is_cross ; then |
650 |
+ TOOLPATH=/usr/${CHOST}/${CTARGET} |
651 |
+ else |
652 |
+ TOOLPATH=/usr/${CTARGET} |
653 |
+ fi |
654 |
+ BINPATH=${TOOLPATH}/binutils-bin/${PV} |
655 |
+ |
656 |
+ # Make sure we filter $LINGUAS so that only ones that |
657 |
+ # actually work make it through #42033 |
658 |
+ strip-linguas -u */po |
659 |
+ |
660 |
+ # Keep things sane |
661 |
+ strip-flags |
662 |
+ |
663 |
+ local x |
664 |
+ echo |
665 |
+ for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do |
666 |
+ einfo "$(printf '%10s' ${x}:) ${!x}" |
667 |
+ done |
668 |
+ echo |
669 |
+ |
670 |
+ cd "${MY_BUILDDIR}" |
671 |
+ local myconf=() |
672 |
+ |
673 |
+ if use plugins ; then |
674 |
+ myconf+=( --enable-plugins ) |
675 |
+ fi |
676 |
+ # enable gold (installed as ld.gold) and ld's plugin architecture |
677 |
+ if use gold ; then |
678 |
+ myconf+=( --enable-gold ) |
679 |
+ if use default-gold; then |
680 |
+ myconf+=( --enable-gold=default ) |
681 |
+ fi |
682 |
+ fi |
683 |
+ |
684 |
+ if use nls ; then |
685 |
+ myconf+=( --without-included-gettext ) |
686 |
+ else |
687 |
+ myconf+=( --disable-nls ) |
688 |
+ fi |
689 |
+ |
690 |
+ myconf+=( --with-system-zlib ) |
691 |
+ |
692 |
+ # For bi-arch systems, enable a 64bit bfd. This matches |
693 |
+ # the bi-arch logic in toolchain.eclass. #446946 |
694 |
+ # We used to do it for everyone, but it's slow on 32bit arches. #438522 |
695 |
+ case $(tc-arch) in |
696 |
+ ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;; |
697 |
+ esac |
698 |
+ |
699 |
+ use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) |
700 |
+ |
701 |
+ [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} ) |
702 |
+ |
703 |
+ is_cross && myconf+=( |
704 |
+ --with-sysroot="${EPREFIX}"/usr/${CTARGET} |
705 |
+ --enable-poison-system-directories |
706 |
+ ) |
707 |
+ |
708 |
+ # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+ |
709 |
+ # on everyone in alpha (for now), we'll just enable it when possible |
710 |
+ has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt ) |
711 |
+ has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt ) |
712 |
+ |
713 |
+ # mips can't do hash-style=gnu ... |
714 |
+ if [[ $(tc-arch) != mips ]] ; then |
715 |
+ myconf+=( --enable-default-hash-style=gnu ) |
716 |
+ fi |
717 |
+ |
718 |
+ myconf+=( |
719 |
+ --prefix="${EPREFIX}"/usr |
720 |
+ --host=${CHOST} |
721 |
+ --target=${CTARGET} |
722 |
+ --datadir="${EPREFIX}"${DATAPATH} |
723 |
+ --datarootdir="${EPREFIX}"${DATAPATH} |
724 |
+ --infodir="${EPREFIX}"${DATAPATH}/info |
725 |
+ --mandir="${EPREFIX}"${DATAPATH}/man |
726 |
+ --bindir="${EPREFIX}"${BINPATH} |
727 |
+ --libdir="${EPREFIX}"${LIBPATH} |
728 |
+ --libexecdir="${EPREFIX}"${LIBPATH} |
729 |
+ --includedir="${EPREFIX}"${INCPATH} |
730 |
+ --enable-obsolete |
731 |
+ --enable-shared |
732 |
+ --enable-threads |
733 |
+ # Newer versions (>=2.27) offer a configure flag now. |
734 |
+ --enable-relro |
735 |
+ # Newer versions (>=2.24) make this an explicit option. #497268 |
736 |
+ --enable-install-libiberty |
737 |
+ --disable-werror |
738 |
+ --with-bugurl="$(toolchain-binutils_bugurl)" |
739 |
+ --with-pkgversion="$(toolchain-binutils_pkgversion)" |
740 |
+ $(use_enable static-libs static) |
741 |
+ ${EXTRA_ECONF} |
742 |
+ # Disable modules that are in a combined binutils/gdb tree. #490566 |
743 |
+ --disable-{gdb,libdecnumber,readline,sim} |
744 |
+ # Strip out broken static link flags. |
745 |
+ # https://gcc.gnu.org/PR56750 |
746 |
+ --without-stage1-ldflags |
747 |
+ # Change SONAME to avoid conflict across |
748 |
+ # {native,cross}/binutils, binutils-libs. #666100 |
749 |
+ --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) |
750 |
+ ) |
751 |
+ echo ./configure "${myconf[@]}" |
752 |
+ "${S}"/configure "${myconf[@]}" || die |
753 |
+ |
754 |
+ # Prevent makeinfo from running if doc is unset. |
755 |
+ if ! use doc ; then |
756 |
+ sed -i \ |
757 |
+ -e '/^MAKEINFO/s:=.*:= true:' \ |
758 |
+ Makefile || die |
759 |
+ fi |
760 |
+} |
761 |
+ |
762 |
+src_compile() { |
763 |
+ cd "${MY_BUILDDIR}" |
764 |
+ # see Note [tooldir hack for ldscripts] |
765 |
+ emake tooldir="${EPREFIX}${TOOLPATH}" all |
766 |
+ |
767 |
+ # only build info pages if the user wants them |
768 |
+ if use doc ; then |
769 |
+ emake info |
770 |
+ fi |
771 |
+ |
772 |
+ # we nuke the manpages when we're left with junk |
773 |
+ # (like when we bootstrap, no perl -> no manpages) |
774 |
+ find . -name '*.1' -a -size 0 -delete |
775 |
+} |
776 |
+ |
777 |
+src_test() { |
778 |
+ cd "${MY_BUILDDIR}" |
779 |
+ |
780 |
+ # bug 637066 |
781 |
+ filter-flags -Wall -Wreturn-type |
782 |
+ |
783 |
+ emake -k check |
784 |
+} |
785 |
+ |
786 |
+src_install() { |
787 |
+ local x d |
788 |
+ |
789 |
+ cd "${MY_BUILDDIR}" |
790 |
+ # see Note [tooldir hack for ldscripts] |
791 |
+ emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install |
792 |
+ rm -rf "${ED}"/${LIBPATH}/bin |
793 |
+ use static-libs || find "${ED}" -name '*.la' -delete |
794 |
+ |
795 |
+ # Newer versions of binutils get fancy with ${LIBPATH} #171905 |
796 |
+ cd "${ED}"/${LIBPATH} |
797 |
+ for d in ../* ; do |
798 |
+ [[ ${d} == ../${PV} ]] && continue |
799 |
+ mv ${d}/* . || die |
800 |
+ rmdir ${d} || die |
801 |
+ done |
802 |
+ |
803 |
+ # Now we collect everything intp the proper SLOT-ed dirs |
804 |
+ # When something is built to cross-compile, it installs into |
805 |
+ # /usr/$CHOST/ by default ... we have to 'fix' that :) |
806 |
+ if is_cross ; then |
807 |
+ cd "${ED}"/${BINPATH} |
808 |
+ for x in * ; do |
809 |
+ mv ${x} ${x/${CTARGET}-} |
810 |
+ done |
811 |
+ |
812 |
+ if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then |
813 |
+ mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH} |
814 |
+ mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/ |
815 |
+ rm -r "${ED}"/usr/${CHOST}/{include,lib} |
816 |
+ fi |
817 |
+ fi |
818 |
+ insinto ${INCPATH} |
819 |
+ local libiberty_headers=( |
820 |
+ # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir. |
821 |
+ demangle.h |
822 |
+ dyn-string.h |
823 |
+ fibheap.h |
824 |
+ hashtab.h |
825 |
+ libiberty.h |
826 |
+ objalloc.h |
827 |
+ splay-tree.h |
828 |
+ ) |
829 |
+ doins "${libiberty_headers[@]/#/${S}/include/}" |
830 |
+ if [[ -d ${ED}/${LIBPATH}/lib ]] ; then |
831 |
+ mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ |
832 |
+ rm -r "${ED}"/${LIBPATH}/lib |
833 |
+ fi |
834 |
+ |
835 |
+ # Generate an env.d entry for this binutils |
836 |
+ insinto /etc/env.d/binutils |
837 |
+ cat <<-EOF > "${T}"/env.d |
838 |
+ TARGET="${CTARGET}" |
839 |
+ VER="${PV}" |
840 |
+ LIBPATH="${EPREFIX}${LIBPATH}" |
841 |
+ EOF |
842 |
+ newins "${T}"/env.d ${CTARGET}-${PV} |
843 |
+ |
844 |
+ # Handle documentation |
845 |
+ if ! is_cross ; then |
846 |
+ cd "${S}" |
847 |
+ dodoc README |
848 |
+ docinto bfd |
849 |
+ dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO |
850 |
+ docinto binutils |
851 |
+ dodoc binutils/ChangeLog binutils/NEWS binutils/README |
852 |
+ docinto gas |
853 |
+ dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README* |
854 |
+ docinto gprof |
855 |
+ dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl |
856 |
+ docinto ld |
857 |
+ dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO |
858 |
+ docinto libiberty |
859 |
+ dodoc libiberty/ChangeLog* libiberty/README |
860 |
+ docinto opcodes |
861 |
+ dodoc opcodes/ChangeLog* |
862 |
+ fi |
863 |
+ |
864 |
+ # Remove shared info pages |
865 |
+ rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} |
866 |
+ |
867 |
+ # Trim all empty dirs |
868 |
+ find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null |
869 |
+} |
870 |
+ |
871 |
+pkg_postinst() { |
872 |
+ # Make sure this ${CTARGET} has a binutils version selected |
873 |
+ [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0 |
874 |
+ binutils-config ${CTARGET}-${PV} |
875 |
+} |
876 |
+ |
877 |
+pkg_postrm() { |
878 |
+ local current_profile=$(binutils-config -c ${CTARGET}) |
879 |
+ |
880 |
+ # If no other versions exist, then uninstall for this |
881 |
+ # target ... otherwise, switch to the newest version |
882 |
+ # Note: only do this if this version is unmerged. We |
883 |
+ # rerun binutils-config if this is a remerge, as |
884 |
+ # we want the mtimes on the symlinks updated (if |
885 |
+ # it is the same as the current selected profile) |
886 |
+ if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then |
887 |
+ local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}') |
888 |
+ choice=${choice//$'\n'/ } |
889 |
+ choice=${choice/* } |
890 |
+ if [[ -z ${choice} ]] ; then |
891 |
+ binutils-config -u ${CTARGET} |
892 |
+ else |
893 |
+ binutils-config ${choice} |
894 |
+ fi |
895 |
+ elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then |
896 |
+ binutils-config ${CTARGET}-${PV} |
897 |
+ fi |
898 |
+} |
899 |
+ |
900 |
+# Note [slotting support] |
901 |
+# ----------------------- |
902 |
+# Gentoo's layout for binutils files is non-standard as Gentoo |
903 |
+# supports slotted installation for binutils. Many tools |
904 |
+# still expect binutils to reside in known locations. |
905 |
+# binutils-config package restores symlinks into known locations, |
906 |
+# like: |
907 |
+# /usr/bin/${CTARGET}-<tool> |
908 |
+# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips |
909 |
+# /usr/include/ |
910 |
+# |
911 |
+# Note [tooldir hack for ldscripts] |
912 |
+# --------------------------------- |
913 |
+# Build system does not allow ./configure to tweak every location |
914 |
+# we need for slotting binutils hence all the shuffling in |
915 |
+# src_install(). This note is about SCRIPTDIR define handling. |
916 |
+# |
917 |
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value |
918 |
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib' |
919 |
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time. |
920 |
+# Thus we can't just move files around after compilation finished. |
921 |
+# |
922 |
+# Our goal is the following: |
923 |
+# - at build-time set scriptdir to point to symlinked location: |
924 |
+# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) |
925 |
+# - at install-time set scriptdir to point to slotted location: |
926 |
+# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} |