7 |
7 |
|
8 |
8 |
DESCRIPTION="Tools necessary to build programs"
|
9 |
9 |
HOMEPAGE="https://sourceware.org/binutils/"
|
|
10 |
|
10 |
11 |
LICENSE="GPL-3+"
|
11 |
|
IUSE="cet default-gold doc +gold multitarget +nls pgo +plugins static-libs test vanilla"
|
|
12 |
IUSE="cet default-gold doc gold gprofng multitarget +nls pgo +plugins static-libs test vanilla"
|
12 |
13 |
REQUIRED_USE="default-gold? ( gold )"
|
13 |
14 |
|
14 |
15 |
# Variables that can be set here (ignored for live ebuilds)
|
... | ... | |
19 |
20 |
# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
|
20 |
21 |
# for the patchsets
|
21 |
22 |
|
22 |
|
PATCH_VER=4
|
|
23 |
PATCH_VER=6
|
23 |
24 |
PATCH_DEV=dilfridge
|
24 |
25 |
|
25 |
26 |
if [[ ${PV} == 9999* ]]; then
|
... | ... | |
113 |
114 |
fi
|
114 |
115 |
fi
|
115 |
116 |
|
116 |
|
# Make sure our explicit libdir paths don't get clobbered. #562460
|
|
117 |
# Make sure our explicit libdir paths don't get clobbered, bug #562460
|
117 |
118 |
sed -i \
|
118 |
119 |
-e 's:@bfdlibdir@:@libdir@:g' \
|
119 |
120 |
-e 's:@bfdincludedir@:@includedir@:g' \
|
120 |
121 |
{bfd,opcodes}/Makefile.in || die
|
121 |
122 |
|
122 |
|
# Fix locale issues if possible #122216
|
|
123 |
# Fix locale issues if possible, bug #122216
|
123 |
124 |
if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
|
124 |
125 |
einfo "Fixing misc issues in configure files"
|
125 |
126 |
for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
|
... | ... | |
130 |
131 |
done
|
131 |
132 |
fi
|
132 |
133 |
|
133 |
|
# Fix conflicts with newer glibc #272594
|
134 |
|
if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
|
135 |
|
sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
|
136 |
|
fi
|
137 |
|
|
138 |
134 |
# Apply things from PATCHES and user dirs
|
139 |
135 |
default
|
140 |
136 |
|
... | ... | |
169 |
165 |
BINPATH=${TOOLPATH}/binutils-bin/${PV}
|
170 |
166 |
|
171 |
167 |
# Make sure we filter $LINGUAS so that only ones that
|
172 |
|
# actually work make it through #42033
|
|
168 |
# actually work make it through, bug #42033
|
173 |
169 |
strip-linguas -u */po
|
174 |
170 |
|
175 |
171 |
# Keep things sane
|
... | ... | |
191 |
187 |
done
|
192 |
188 |
echo
|
193 |
189 |
|
194 |
|
cd "${MY_BUILDDIR}"
|
|
190 |
cd "${MY_BUILDDIR}" || die
|
195 |
191 |
local myconf=()
|
196 |
192 |
|
197 |
193 |
if use plugins ; then
|
... | ... | |
213 |
209 |
|
214 |
210 |
myconf+=( --with-system-zlib )
|
215 |
211 |
|
216 |
|
# For bi-arch systems, enable a 64bit bfd. This matches
|
217 |
|
# the bi-arch logic in toolchain.eclass. #446946
|
218 |
|
# We used to do it for everyone, but it's slow on 32bit arches. #438522
|
|
212 |
# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
|
|
213 |
# logic in toolchain.eclass. bug #446946
|
|
214 |
#
|
|
215 |
# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
|
219 |
216 |
case $(tc-arch) in
|
220 |
217 |
ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
|
221 |
218 |
esac
|
... | ... | |
229 |
226 |
--enable-poison-system-directories
|
230 |
227 |
)
|
231 |
228 |
|
232 |
|
# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
|
233 |
|
# on everyone in alpha (for now), we'll just enable it when possible
|
234 |
|
has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
|
235 |
|
has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
|
|
229 |
myconf+=( --enable-secureplt )
|
236 |
230 |
|
237 |
231 |
# mips can't do hash-style=gnu ...
|
238 |
232 |
if [[ $(tc-arch) != mips ]] ; then
|
... | ... | |
240 |
234 |
fi
|
241 |
235 |
|
242 |
236 |
myconf+=(
|
243 |
|
# (--disable-silent-rules should get passed automatically w/ econf which we use
|
244 |
|
# in >= 2.39, so can drop it then.)
|
245 |
|
--disable-silent-rules
|
246 |
237 |
--prefix="${EPREFIX}"/usr
|
247 |
238 |
--host=${CHOST}
|
248 |
239 |
--target=${CTARGET}
|
... | ... | |
259 |
250 |
--enable-threads
|
260 |
251 |
# Newer versions (>=2.27) offer a configure flag now.
|
261 |
252 |
--enable-relro
|
262 |
|
# Newer versions (>=2.24) make this an explicit option. #497268
|
|
253 |
# Newer versions (>=2.24) make this an explicit option, bug #497268
|
263 |
254 |
--enable-install-libiberty
|
264 |
255 |
# Available from 2.35 on
|
265 |
256 |
--enable-textrel-check=warning
|
266 |
|
# Works better than vapier's patch... #808787
|
|
257 |
|
|
258 |
# These hardening options are available from 2.39+ but
|
|
259 |
# they unconditionally enable the behaviour even on arches
|
|
260 |
# where e.g. execstacks can't be avoided.
|
|
261 |
# See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
|
|
262 |
#--enable-warn-execstack
|
|
263 |
#--enable-warn-rwx-segments
|
|
264 |
#--disable-default-execstack (or is it --enable-default-execstack=no? docs are confusing)
|
|
265 |
|
|
266 |
# Things to think about
|
|
267 |
#--enable-deterministic-archives
|
|
268 |
|
|
269 |
# Works better than vapier's patch, bug #808787
|
267 |
270 |
--enable-new-dtags
|
|
271 |
|
|
272 |
--disable-jansson
|
268 |
273 |
--disable-werror
|
269 |
274 |
--with-bugurl="$(toolchain-binutils_bugurl)"
|
270 |
275 |
--with-pkgversion="$(toolchain-binutils_pkgversion)"
|
271 |
276 |
$(use_enable static-libs static)
|
272 |
|
${EXTRA_ECONF}
|
273 |
|
# Disable modules that are in a combined binutils/gdb tree. #490566
|
|
277 |
# Disable modules that are in a combined binutils/gdb tree, bug #490566
|
274 |
278 |
--disable-{gdb,libdecnumber,readline,sim}
|
275 |
279 |
# Strip out broken static link flags.
|
276 |
280 |
# https://gcc.gnu.org/PR56750
|
277 |
281 |
--without-stage1-ldflags
|
278 |
282 |
# Change SONAME to avoid conflict across
|
279 |
|
# {native,cross}/binutils, binutils-libs. #666100
|
|
283 |
# {native,cross}/binutils, binutils-libs. bug #666100
|
280 |
284 |
--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
|
281 |
285 |
|
282 |
|
# avoid automagic dependency on (currently prefix) systems
|
|
286 |
# Avoid automagic dependency on (currently prefix) systems
|
283 |
287 |
# systems with debuginfod library, bug #754753
|
284 |
288 |
--without-debuginfod
|
285 |
289 |
|
|
290 |
# Avoid automagic dev-libs/msgpack dep, bug #865875
|
|
291 |
--without-msgpack
|
|
292 |
|
286 |
293 |
# Allow user to opt into CET for host libraries.
|
287 |
294 |
# Ideally we would like automagic-or-disabled here.
|
288 |
295 |
# But the check does not quite work on i686: bug #760926.
|
289 |
296 |
$(use_enable cet)
|
|
297 |
|
|
298 |
# We can enable this by default in future, but it's brand new
|
|
299 |
# in 2.39 with several bugs:
|
|
300 |
# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
|
|
301 |
# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
|
|
302 |
# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
|
|
303 |
# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
|
|
304 |
$(use_enable gprofng)
|
290 |
305 |
)
|
291 |
306 |
|
292 |
307 |
if ! is_cross ; then
|
... | ... | |
297 |
312 |
fi
|
298 |
313 |
fi
|
299 |
314 |
|
300 |
|
echo ./configure "${myconf[@]}"
|
301 |
|
"${S}"/configure "${myconf[@]}" || die
|
|
315 |
ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
|
302 |
316 |
|
303 |
317 |
# Prevent makeinfo from running if doc is unset.
|
304 |
318 |
if ! use doc ; then
|
... | ... | |
309 |
323 |
}
|
310 |
324 |
|
311 |
325 |
src_compile() {
|
312 |
|
cd "${MY_BUILDDIR}"
|
|
326 |
cd "${MY_BUILDDIR}" || die
|
|
327 |
|
313 |
328 |
# see Note [tooldir hack for ldscripts]
|
314 |
329 |
emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
|
315 |
330 |
|
... | ... | |
324 |
339 |
}
|
325 |
340 |
|
326 |
341 |
src_test() {
|
327 |
|
cd "${MY_BUILDDIR}"
|
|
342 |
cd "${MY_BUILDDIR}" || die
|
328 |
343 |
|
329 |
|
# bug 637066
|
|
344 |
# bug #637066
|
330 |
345 |
filter-flags -Wall -Wreturn-type
|
331 |
346 |
|
332 |
347 |
emake -k V=1 check
|
... | ... | |
335 |
350 |
src_install() {
|
336 |
351 |
local x d
|
337 |
352 |
|
338 |
|
cd "${MY_BUILDDIR}"
|
|
353 |
cd "${MY_BUILDDIR}" || die
|
|
354 |
|
339 |
355 |
# see Note [tooldir hack for ldscripts]
|
340 |
356 |
emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
|
341 |
|
rm -rf "${ED}"/${LIBPATH}/bin
|
|
357 |
rm -rf "${ED}"/${LIBPATH}/bin || die
|
342 |
358 |
use static-libs || find "${ED}" -name '*.la' -delete
|
343 |
359 |
|
344 |
|
# Newer versions of binutils get fancy with ${LIBPATH} #171905
|
345 |
|
cd "${ED}"/${LIBPATH}
|
|
360 |
# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
|
|
361 |
cd "${ED}"/${LIBPATH} || die
|
346 |
362 |
for d in ../* ; do
|
347 |
363 |
[[ ${d} == ../${PV} ]] && continue
|
348 |
364 |
mv ${d}/* . || die
|
... | ... | |
353 |
369 |
# When something is built to cross-compile, it installs into
|
354 |
370 |
# /usr/$CHOST/ by default ... we have to 'fix' that :)
|
355 |
371 |
if is_cross ; then
|
356 |
|
cd "${ED}"/${BINPATH}
|
|
372 |
cd "${ED}"/${BINPATH} || die
|
357 |
373 |
for x in * ; do
|
358 |
|
mv ${x} ${x/${CTARGET}-}
|
|
374 |
mv ${x} ${x/${CTARGET}-} || die
|
359 |
375 |
done
|
360 |
376 |
|
361 |
377 |
if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
|
... | ... | |
364 |
380 |
rm -r "${ED}"/usr/${CHOST}/{include,lib}
|
365 |
381 |
fi
|
366 |
382 |
fi
|
|
383 |
|
367 |
384 |
insinto ${INCPATH}
|
368 |
385 |
local libiberty_headers=(
|
369 |
386 |
# Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
|
... | ... | |
377 |
394 |
)
|
378 |
395 |
doins "${libiberty_headers[@]/#/${S}/include/}"
|
379 |
396 |
if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
|
380 |
|
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
|
381 |
|
rm -r "${ED}"/${LIBPATH}/lib
|
|
397 |
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die
|
|
398 |
rm -r "${ED}"/${LIBPATH}/lib || die
|
382 |
399 |
fi
|
383 |
400 |
|
384 |
401 |
# Generate an env.d entry for this binutils
|
... | ... | |
392 |
409 |
|
393 |
410 |
# Handle documentation
|
394 |
411 |
if ! is_cross ; then
|
395 |
|
cd "${S}"
|
|
412 |
cd "${S}" || die
|
396 |
413 |
dodoc README
|
|
414 |
|
397 |
415 |
docinto bfd
|
398 |
416 |
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
|
|
417 |
|
399 |
418 |
docinto binutils
|
400 |
419 |
dodoc binutils/ChangeLog binutils/NEWS binutils/README
|
|
420 |
|
401 |
421 |
docinto gas
|
402 |
422 |
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
|
|
423 |
|
403 |
424 |
docinto gprof
|
404 |
425 |
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
|
|
426 |
|
405 |
427 |
docinto ld
|
406 |
428 |
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
|
|
429 |
|
407 |
430 |
docinto libiberty
|
408 |
431 |
dodoc libiberty/ChangeLog* libiberty/README
|
|
432 |
|
409 |
433 |
docinto opcodes
|
410 |
434 |
dodoc opcodes/ChangeLog*
|
411 |
435 |
fi
|