9 |
9 |
|
10 |
10 |
DESCRIPTION="Tools necessary to build programs"
|
11 |
11 |
HOMEPAGE="https://sourceware.org/binutils/"
|
|
12 |
|
12 |
13 |
LICENSE="GPL-3+"
|
13 |
14 |
IUSE="cet default-gold doc +gold multitarget +nls pgo +plugins static-libs test vanilla"
|
14 |
15 |
REQUIRED_USE="default-gold? ( gold )"
|
... | ... | |
21 |
22 |
# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
|
22 |
23 |
# for the patchsets
|
23 |
24 |
|
24 |
|
PATCH_VER=2
|
|
25 |
PATCH_VER=4
|
25 |
26 |
PATCH_DEV=dilfridge
|
26 |
27 |
|
27 |
28 |
if [[ ${PV} == 9999* ]]; then
|
... | ... | |
69 |
70 |
|
70 |
71 |
RESTRICT="!test? ( test )"
|
71 |
72 |
|
72 |
|
MY_BUILDDIR=${WORKDIR}/build
|
73 |
|
S=${WORKDIR}/${P/-hppa64/}
|
|
73 |
MY_BUILDDIR="${WORKDIR}"/build
|
|
74 |
S="${WORKDIR}"/${P/-hppa64/}
|
74 |
75 |
|
75 |
76 |
src_unpack() {
|
76 |
77 |
if [[ ${PV} == 9999* ]] ; then
|
77 |
78 |
EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git"
|
78 |
|
EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git
|
|
79 |
EGIT_CHECKOUT_DIR="${WORKDIR}"/patches-git
|
79 |
80 |
git-r3_src_unpack
|
80 |
81 |
mv patches-git/9999 patch || die
|
81 |
82 |
|
|
83 |
S="${WORKDIR}"/binutils
|
82 |
84 |
EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
|
83 |
|
S=${WORKDIR}/binutils
|
84 |
|
EGIT_CHECKOUT_DIR=${S}
|
|
85 |
EGIT_CHECKOUT_DIR="${S}"
|
85 |
86 |
git-r3_src_unpack
|
86 |
87 |
else
|
87 |
88 |
unpack ${P/-hppa64/}.tar.xz
|
... | ... | |
93 |
94 |
local dir=${P%_p?}
|
94 |
95 |
dir=${dir/-hppa64/}
|
95 |
96 |
|
96 |
|
S=${WORKDIR}/${dir}
|
|
97 |
S="${WORKDIR}"/${dir}
|
97 |
98 |
fi
|
98 |
99 |
|
99 |
100 |
cd "${WORKDIR}" || die
|
... | ... | |
116 |
117 |
fi
|
117 |
118 |
fi
|
118 |
119 |
|
119 |
|
# Make sure our explicit libdir paths don't get clobbered. #562460
|
|
120 |
# Make sure our explicit libdir paths don't get clobbered, bug #562460
|
120 |
121 |
sed -i \
|
121 |
122 |
-e 's:@bfdlibdir@:@libdir@:g' \
|
122 |
123 |
-e 's:@bfdincludedir@:@includedir@:g' \
|
123 |
124 |
{bfd,opcodes}/Makefile.in || die
|
124 |
125 |
|
125 |
|
# Fix locale issues if possible #122216
|
|
126 |
# Fix locale issues if possible, bug #122216
|
126 |
127 |
if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
|
127 |
128 |
einfo "Fixing misc issues in configure files"
|
128 |
129 |
for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
|
... | ... | |
133 |
134 |
done
|
134 |
135 |
fi
|
135 |
136 |
|
136 |
|
# Fix conflicts with newer glibc #272594
|
137 |
|
if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
|
138 |
|
sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
|
139 |
|
fi
|
140 |
|
|
141 |
137 |
# Apply things from PATCHES and user dirs
|
142 |
138 |
default
|
143 |
139 |
|
... | ... | |
155 |
151 |
}
|
156 |
152 |
|
157 |
153 |
src_configure() {
|
|
154 |
# See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
|
|
155 |
# Avoid really confusing logs from subconfigure spam, makes logs far
|
|
156 |
# more legible.
|
|
157 |
MAKEOPTS="--output-sync=line ${MAKEOPTS}"
|
|
158 |
|
158 |
159 |
# Setup some paths
|
159 |
160 |
LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
|
160 |
161 |
INCPATH=${LIBPATH}/include
|
... | ... | |
167 |
168 |
BINPATH=${TOOLPATH}/binutils-bin/${PV}
|
168 |
169 |
|
169 |
170 |
# Make sure we filter $LINGUAS so that only ones that
|
170 |
|
# actually work make it through #42033
|
|
171 |
# actually work make it through, bug #42033
|
171 |
172 |
strip-linguas -u */po
|
172 |
173 |
|
173 |
174 |
# Keep things sane
|
... | ... | |
182 |
183 |
done
|
183 |
184 |
echo
|
184 |
185 |
|
185 |
|
cd "${MY_BUILDDIR}"
|
|
186 |
cd "${MY_BUILDDIR}" || die
|
186 |
187 |
local myconf=()
|
187 |
188 |
|
188 |
189 |
if use plugins ; then
|
... | ... | |
204 |
205 |
|
205 |
206 |
myconf+=( --with-system-zlib )
|
206 |
207 |
|
207 |
|
# For bi-arch systems, enable a 64bit bfd. This matches
|
208 |
|
# the bi-arch logic in toolchain.eclass. #446946
|
209 |
|
# We used to do it for everyone, but it's slow on 32bit arches. #438522
|
|
208 |
# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
|
|
209 |
# logic in toolchain.eclass. bug #446946
|
|
210 |
#
|
|
211 |
# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
|
210 |
212 |
case $(tc-arch) in
|
211 |
213 |
ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
|
212 |
214 |
esac
|
... | ... | |
220 |
222 |
--enable-poison-system-directories
|
221 |
223 |
)
|
222 |
224 |
|
223 |
|
# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
|
224 |
|
# on everyone in alpha (for now), we'll just enable it when possible
|
225 |
|
has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
|
226 |
|
has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
|
|
225 |
myconf+=( --enable-secureplt )
|
227 |
226 |
|
228 |
227 |
# mips can't do hash-style=gnu ...
|
229 |
228 |
if [[ $(tc-arch) != mips ]] ; then
|
... | ... | |
247 |
246 |
--enable-threads
|
248 |
247 |
# Newer versions (>=2.27) offer a configure flag now.
|
249 |
248 |
--enable-relro
|
250 |
|
# Newer versions (>=2.24) make this an explicit option. #497268
|
|
249 |
# Newer versions (>=2.24) make this an explicit option, bug #497268
|
251 |
250 |
--enable-install-libiberty
|
252 |
251 |
# Available from 2.35 on
|
253 |
252 |
--enable-textrel-check=warning
|
254 |
|
# Works better than vapier's patch... #808787
|
|
253 |
# Works better than vapier's patch., bug #808787
|
255 |
254 |
--enable-new-dtags
|
256 |
255 |
--disable-werror
|
257 |
256 |
--with-bugurl="$(toolchain-binutils_bugurl)"
|
258 |
257 |
--with-pkgversion="$(toolchain-binutils_pkgversion)"
|
259 |
258 |
$(use_enable static-libs static)
|
260 |
|
${EXTRA_ECONF}
|
261 |
|
# Disable modules that are in a combined binutils/gdb tree. #490566
|
|
259 |
# Disable modules that are in a combined binutils/gdb tree. bug #490566
|
262 |
260 |
--disable-{gdb,libdecnumber,readline,sim}
|
263 |
261 |
# Strip out broken static link flags.
|
264 |
262 |
# https://gcc.gnu.org/PR56750
|
265 |
263 |
--without-stage1-ldflags
|
266 |
264 |
# Change SONAME to avoid conflict across
|
267 |
|
# {native,cross}/binutils, binutils-libs. #666100
|
|
265 |
# {native,cross}/binutils, binutils-libs. bug #666100
|
268 |
266 |
--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
|
269 |
267 |
|
270 |
268 |
# avoid automagic dependency on (currently prefix) systems
|
... | ... | |
276 |
274 |
# But the check does not quite work on i686: bug #760926.
|
277 |
275 |
$(use_enable cet)
|
278 |
276 |
|
279 |
|
# No LTO for HPPA64 right now as we don't build kgcc64 with LTO support.
|
280 |
|
$(use_enable pgo pgo-build)
|
281 |
277 |
)
|
282 |
278 |
|
283 |
|
if use pgo ; then
|
284 |
|
export BUILD_CFLAGS="${CFLAGS}"
|
|
279 |
if ! is_cross ; then
|
|
280 |
# No LTO for HPPA64 right now as we don't build kgcc64 with LTO support.
|
|
281 |
myconf+=( $(use_enable pgo pgo-build) )
|
|
282 |
|
|
283 |
if use pgo ; then
|
|
284 |
export BUILD_CFLAGS="${CFLAGS}"
|
|
285 |
fi
|
285 |
286 |
fi
|
286 |
287 |
|
287 |
|
echo ./configure "${myconf[@]}"
|
288 |
|
"${S}"/configure "${myconf[@]}" || die
|
|
288 |
ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
|
289 |
289 |
|
290 |
290 |
# Prevent makeinfo from running if doc is unset.
|
291 |
291 |
if ! use doc ; then
|
... | ... | |
296 |
296 |
}
|
297 |
297 |
|
298 |
298 |
src_compile() {
|
299 |
|
cd "${MY_BUILDDIR}"
|
|
299 |
cd "${MY_BUILDDIR}" || die
|
|
300 |
|
300 |
301 |
# see Note [tooldir hack for ldscripts]
|
301 |
|
emake tooldir="${EPREFIX}${TOOLPATH}" all
|
|
302 |
emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
|
302 |
303 |
|
303 |
304 |
# only build info pages if the user wants them
|
304 |
305 |
if use doc ; then
|
305 |
|
emake info
|
|
306 |
emake V=1 info
|
306 |
307 |
fi
|
307 |
308 |
|
308 |
309 |
# we nuke the manpages when we're left with junk
|
... | ... | |
311 |
312 |
}
|
312 |
313 |
|
313 |
314 |
src_test() {
|
314 |
|
cd "${MY_BUILDDIR}"
|
|
315 |
cd "${MY_BUILDDIR}" || die
|
315 |
316 |
|
316 |
|
# bug 637066
|
|
317 |
# bug #637066
|
317 |
318 |
filter-flags -Wall -Wreturn-type
|
318 |
319 |
|
319 |
|
emake -k check
|
|
320 |
emake -k V=1 check
|
320 |
321 |
}
|
321 |
322 |
|
322 |
323 |
src_install() {
|
323 |
324 |
local x d
|
324 |
325 |
|
325 |
|
cd "${MY_BUILDDIR}"
|
|
326 |
cd "${MY_BUILDDIR}" || die
|
|
327 |
|
326 |
328 |
# see Note [tooldir hack for ldscripts]
|
327 |
|
emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
|
328 |
|
rm -rf "${ED}"/${LIBPATH}/bin
|
|
329 |
emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
|
|
330 |
rm -rf "${ED}"/${LIBPATH}/bin || die
|
329 |
331 |
use static-libs || find "${ED}" -name '*.la' -delete
|
330 |
332 |
|
331 |
|
# Newer versions of binutils get fancy with ${LIBPATH} #171905
|
332 |
|
cd "${ED}"/${LIBPATH}
|
|
333 |
# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
|
|
334 |
cd "${ED}"/${LIBPATH} || die
|
333 |
335 |
for d in ../* ; do
|
334 |
336 |
[[ ${d} == ../${PV} ]] && continue
|
335 |
337 |
mv ${d}/* . || die
|
... | ... | |
340 |
342 |
# When something is built to cross-compile, it installs into
|
341 |
343 |
# /usr/$CHOST/ by default ... we have to 'fix' that :)
|
342 |
344 |
if is_cross ; then
|
343 |
|
cd "${ED}"/${BINPATH}
|
|
345 |
cd "${ED}"/${BINPATH} || die
|
344 |
346 |
for x in * ; do
|
345 |
|
mv ${x} ${x/${CTARGET}-}
|
|
347 |
mv ${x} ${x/${CTARGET}-} || die
|
346 |
348 |
done
|
347 |
349 |
|
348 |
350 |
if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
|
|
351 |
# No die for now, dies on hppa?
|
349 |
352 |
mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
|
350 |
353 |
mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
|
351 |
354 |
rm -r "${ED}"/usr/${CHOST}/{include,lib}
|
352 |
355 |
fi
|
353 |
356 |
fi
|
|
357 |
|
354 |
358 |
insinto ${INCPATH}
|
355 |
359 |
local libiberty_headers=(
|
356 |
360 |
# Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
|
... | ... | |
364 |
368 |
)
|
365 |
369 |
doins "${libiberty_headers[@]/#/${S}/include/}"
|
366 |
370 |
if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
|
|
371 |
# TODO: add || die here, fails on hppa?
|
367 |
372 |
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
|
368 |
373 |
rm -r "${ED}"/${LIBPATH}/lib
|
369 |
374 |
fi
|
... | ... | |
379 |
384 |
|
380 |
385 |
# Handle documentation
|
381 |
386 |
if ! is_cross ; then
|
382 |
|
cd "${S}"
|
|
387 |
cd "${S}" || die
|
383 |
388 |
dodoc README
|
|
389 |
|
384 |
390 |
docinto bfd
|
385 |
391 |
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
|
|
392 |
|
386 |
393 |
docinto binutils
|
387 |
394 |
dodoc binutils/ChangeLog binutils/NEWS binutils/README
|
|
395 |
|
388 |
396 |
docinto gas
|
389 |
397 |
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
|
|
398 |
|
390 |
399 |
docinto gprof
|
391 |
400 |
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
|
|
401 |
|
392 |
402 |
docinto ld
|
393 |
403 |
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
|
|
404 |
|
394 |
405 |
docinto libiberty
|
395 |
406 |
dodoc libiberty/ChangeLog* libiberty/README
|
|
407 |
|
396 |
408 |
docinto opcodes
|
397 |
409 |
dodoc opcodes/ChangeLog*
|
398 |
410 |
fi
|
399 |
411 |
|
400 |
412 |
# Remove shared info pages
|
401 |
|
rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
|
|
413 |
rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} || die
|
402 |
414 |
|
403 |
415 |
# Trim all empty dirs
|
404 |
416 |
find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
|