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 conflicts with newer glibc #272594
|
123 |
|
if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
|
124 |
|
sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
|
125 |
|
fi
|
126 |
|
|
127 |
123 |
# Apply things from PATCHES and user dirs
|
128 |
124 |
default
|
129 |
125 |
|
... | ... | |
158 |
154 |
BINPATH=${TOOLPATH}/binutils-bin/${PV}
|
159 |
155 |
|
160 |
156 |
# Make sure we filter $LINGUAS so that only ones that
|
161 |
|
# actually work make it through #42033
|
|
157 |
# actually work make it through, bug #42033
|
162 |
158 |
strip-linguas -u */po
|
163 |
159 |
|
164 |
160 |
# Keep things sane
|
... | ... | |
177 |
173 |
done
|
178 |
174 |
echo
|
179 |
175 |
|
180 |
|
cd "${MY_BUILDDIR}"
|
|
176 |
cd "${MY_BUILDDIR}" || die
|
181 |
177 |
local myconf=()
|
182 |
178 |
|
183 |
179 |
if use plugins ; then
|
... | ... | |
199 |
195 |
|
200 |
196 |
myconf+=( --with-system-zlib )
|
201 |
197 |
|
202 |
|
# For bi-arch systems, enable a 64bit bfd. This matches
|
203 |
|
# the bi-arch logic in toolchain.eclass. #446946
|
204 |
|
# We used to do it for everyone, but it's slow on 32bit arches. #438522
|
|
198 |
# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
|
|
199 |
# logic in toolchain.eclass. bug #446946
|
|
200 |
#
|
|
201 |
# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
|
205 |
202 |
case $(tc-arch) in
|
206 |
203 |
ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
|
207 |
204 |
esac
|
... | ... | |
215 |
212 |
--enable-poison-system-directories
|
216 |
213 |
)
|
217 |
214 |
|
218 |
|
# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
|
219 |
|
# on everyone in alpha (for now), we'll just enable it when possible
|
220 |
|
has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
|
221 |
|
has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
|
|
215 |
myconf+=( --enable-secureplt )
|
222 |
216 |
|
223 |
217 |
# mips can't do hash-style=gnu ...
|
224 |
218 |
if [[ $(tc-arch) != mips ]] ; then
|
... | ... | |
226 |
220 |
fi
|
227 |
221 |
|
228 |
222 |
myconf+=(
|
229 |
|
# (--disable-silent-rules should get passed automatically w/ econf which we use
|
230 |
|
# in >= 2.39, so can drop it then.)
|
231 |
|
--disable-silent-rules
|
232 |
223 |
--prefix="${EPREFIX}"/usr
|
233 |
224 |
--host=${CHOST}
|
234 |
225 |
--target=${CTARGET}
|
... | ... | |
245 |
236 |
--enable-threads
|
246 |
237 |
# Newer versions (>=2.27) offer a configure flag now.
|
247 |
238 |
--enable-relro
|
248 |
|
# Newer versions (>=2.24) make this an explicit option. #497268
|
|
239 |
# Newer versions (>=2.24) make this an explicit option, bug #497268
|
249 |
240 |
--enable-install-libiberty
|
250 |
241 |
# Available from 2.35 on
|
251 |
242 |
--enable-textrel-check=warning
|
252 |
|
# Works better than vapier's patch... #808787
|
|
243 |
|
|
244 |
# These hardening options are available from 2.39+ but
|
|
245 |
# they unconditionally enable the behaviour even on arches
|
|
246 |
# where e.g. execstacks can't be avoided.
|
|
247 |
# See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
|
|
248 |
#--enable-warn-execstack
|
|
249 |
#--enable-warn-rwx-segments
|
|
250 |
#--disable-default-execstack (or is it --enable-default-execstack=no? docs are confusing)
|
|
251 |
|
|
252 |
# Things to think about
|
|
253 |
#--enable-deterministic-archives
|
|
254 |
|
|
255 |
# Works better than vapier's patch, bug #808787
|
253 |
256 |
--enable-new-dtags
|
|
257 |
|
|
258 |
--disable-jansson
|
254 |
259 |
--disable-werror
|
255 |
260 |
--with-bugurl="$(toolchain-binutils_bugurl)"
|
256 |
261 |
--with-pkgversion="$(toolchain-binutils_pkgversion)"
|
257 |
262 |
$(use_enable static-libs static)
|
258 |
|
${EXTRA_ECONF}
|
259 |
|
# Disable modules that are in a combined binutils/gdb tree. #490566
|
|
263 |
# Disable modules that are in a combined binutils/gdb tree, bug #490566
|
260 |
264 |
--disable-{gdb,libdecnumber,readline,sim}
|
261 |
265 |
# Strip out broken static link flags.
|
262 |
266 |
# https://gcc.gnu.org/PR56750
|
263 |
267 |
--without-stage1-ldflags
|
264 |
268 |
# Change SONAME to avoid conflict across
|
265 |
|
# {native,cross}/binutils, binutils-libs. #666100
|
|
269 |
# {native,cross}/binutils, binutils-libs. bug #666100
|
266 |
270 |
--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
|
267 |
271 |
|
268 |
|
# avoid automagic dependency on (currently prefix) systems
|
|
272 |
# Avoid automagic dependency on (currently prefix) systems
|
269 |
273 |
# systems with debuginfod library, bug #754753
|
270 |
274 |
--without-debuginfod
|
271 |
275 |
|
|
276 |
# Avoid automagic dev-libs/msgpack dep, bug #865875
|
|
277 |
--without-msgpack
|
|
278 |
|
272 |
279 |
# Allow user to opt into CET for host libraries.
|
273 |
280 |
# Ideally we would like automagic-or-disabled here.
|
274 |
281 |
# But the check does not quite work on i686: bug #760926.
|
275 |
282 |
$(use_enable cet)
|
|
283 |
|
|
284 |
# We can enable this by default in future, but it's brand new
|
|
285 |
# in 2.39 with several bugs:
|
|
286 |
# - Doesn't build on musl (https://sourceware.org/bugzilla/show_bug.cgi?id=29477)
|
|
287 |
# - No man pages (https://sourceware.org/bugzilla/show_bug.cgi?id=29521)
|
|
288 |
# - Broken at runtime without Java (https://sourceware.org/bugzilla/show_bug.cgi?id=29479)
|
|
289 |
# - binutils-config (and this ebuild?) needs adaptation first (https://bugs.gentoo.org/865113)
|
|
290 |
$(use_enable gprofng)
|
276 |
291 |
)
|
277 |
292 |
|
278 |
293 |
if ! is_cross ; then
|
... | ... | |
283 |
298 |
fi
|
284 |
299 |
fi
|
285 |
300 |
|
286 |
|
echo ./configure "${myconf[@]}"
|
287 |
|
"${S}"/configure "${myconf[@]}" || die
|
|
301 |
ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
|
288 |
302 |
|
289 |
303 |
# Prevent makeinfo from running if doc is unset.
|
290 |
304 |
if ! use doc ; then
|
... | ... | |
295 |
309 |
}
|
296 |
310 |
|
297 |
311 |
src_compile() {
|
298 |
|
cd "${MY_BUILDDIR}"
|
|
312 |
cd "${MY_BUILDDIR}" || die
|
|
313 |
|
299 |
314 |
# see Note [tooldir hack for ldscripts]
|
300 |
315 |
emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
|
301 |
316 |
|
... | ... | |
310 |
325 |
}
|
311 |
326 |
|
312 |
327 |
src_test() {
|
313 |
|
cd "${MY_BUILDDIR}"
|
|
328 |
cd "${MY_BUILDDIR}" || die
|
314 |
329 |
|
315 |
330 |
# https://sourceware.org/PR31327
|
316 |
331 |
local -x XZ_OPT="-T1"
|
317 |
332 |
local -x XZ_DEFAULTS="-T1"
|
318 |
333 |
|
319 |
|
# bug 637066
|
|
334 |
# bug #637066
|
320 |
335 |
filter-flags -Wall -Wreturn-type
|
321 |
336 |
|
322 |
337 |
emake -k V=1 check
|
... | ... | |
325 |
340 |
src_install() {
|
326 |
341 |
local x d
|
327 |
342 |
|
328 |
|
cd "${MY_BUILDDIR}"
|
|
343 |
cd "${MY_BUILDDIR}" || die
|
|
344 |
|
329 |
345 |
# see Note [tooldir hack for ldscripts]
|
330 |
346 |
emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
|
331 |
|
rm -rf "${ED}"/${LIBPATH}/bin
|
|
347 |
rm -rf "${ED}"/${LIBPATH}/bin || die
|
332 |
348 |
use static-libs || find "${ED}" -name '*.la' -delete
|
333 |
349 |
|
334 |
|
# Newer versions of binutils get fancy with ${LIBPATH} #171905
|
335 |
|
cd "${ED}"/${LIBPATH}
|
|
350 |
# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
|
|
351 |
cd "${ED}"/${LIBPATH} || die
|
336 |
352 |
for d in ../* ; do
|
337 |
353 |
[[ ${d} == ../${PV} ]] && continue
|
338 |
354 |
mv ${d}/* . || die
|
... | ... | |
343 |
359 |
# When something is built to cross-compile, it installs into
|
344 |
360 |
# /usr/$CHOST/ by default ... we have to 'fix' that :)
|
345 |
361 |
if is_cross ; then
|
346 |
|
cd "${ED}"/${BINPATH}
|
|
362 |
cd "${ED}"/${BINPATH} || die
|
347 |
363 |
for x in * ; do
|
348 |
|
mv ${x} ${x/${CTARGET}-}
|
|
364 |
mv ${x} ${x/${CTARGET}-} || die
|
349 |
365 |
done
|
350 |
366 |
|
351 |
367 |
if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
|
... | ... | |
354 |
370 |
rm -r "${ED}"/usr/${CHOST}/{include,lib}
|
355 |
371 |
fi
|
356 |
372 |
fi
|
|
373 |
|
357 |
374 |
insinto ${INCPATH}
|
358 |
375 |
local libiberty_headers=(
|
359 |
376 |
# Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
|
... | ... | |
367 |
384 |
)
|
368 |
385 |
doins "${libiberty_headers[@]/#/${S}/include/}"
|
369 |
386 |
if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
|
370 |
|
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
|
371 |
|
rm -r "${ED}"/${LIBPATH}/lib
|
|
387 |
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die
|
|
388 |
rm -r "${ED}"/${LIBPATH}/lib || die
|
372 |
389 |
fi
|
373 |
390 |
|
374 |
391 |
# Generate an env.d entry for this binutils
|
... | ... | |
382 |
399 |
|
383 |
400 |
# Handle documentation
|
384 |
401 |
if ! is_cross ; then
|
385 |
|
cd "${S}"
|
|
402 |
cd "${S}" || die
|
386 |
403 |
dodoc README
|
|
404 |
|
387 |
405 |
docinto bfd
|
388 |
406 |
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
|
|
407 |
|
389 |
408 |
docinto binutils
|
390 |
409 |
dodoc binutils/ChangeLog binutils/NEWS binutils/README
|
|
410 |
|
391 |
411 |
docinto gas
|
392 |
412 |
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
|
|
413 |
|
393 |
414 |
docinto gprof
|
394 |
415 |
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
|
|
416 |
|
395 |
417 |
docinto ld
|
396 |
418 |
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
|
|
419 |
|
397 |
420 |
docinto libiberty
|
398 |
421 |
dodoc libiberty/ChangeLog* libiberty/README
|
|
422 |
|
399 |
423 |
docinto opcodes
|
400 |
424 |
dodoc opcodes/ChangeLog*
|
401 |
425 |
fi
|