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 conflicts with newer glibc #272594
|
126 |
|
if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
|
127 |
|
sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
|
128 |
|
fi
|
129 |
|
|
130 |
126 |
# Apply things from PATCHES and user dirs
|
131 |
127 |
default
|
132 |
128 |
|
... | ... | |
144 |
140 |
}
|
145 |
141 |
|
146 |
142 |
src_configure() {
|
|
143 |
# See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
|
|
144 |
# Avoid really confusing logs from subconfigure spam, makes logs far
|
|
145 |
# more legible.
|
|
146 |
MAKEOPTS="--output-sync=line ${MAKEOPTS}"
|
|
147 |
|
147 |
148 |
# Setup some paths
|
148 |
149 |
LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
|
149 |
150 |
INCPATH=${LIBPATH}/include
|
... | ... | |
156 |
157 |
BINPATH=${TOOLPATH}/binutils-bin/${PV}
|
157 |
158 |
|
158 |
159 |
# Make sure we filter $LINGUAS so that only ones that
|
159 |
|
# actually work make it through #42033
|
|
160 |
# actually work make it through, bug #42033
|
160 |
161 |
strip-linguas -u */po
|
161 |
162 |
|
162 |
163 |
# Keep things sane
|
... | ... | |
171 |
172 |
done
|
172 |
173 |
echo
|
173 |
174 |
|
174 |
|
cd "${MY_BUILDDIR}"
|
|
175 |
cd "${MY_BUILDDIR}" || die
|
175 |
176 |
local myconf=()
|
176 |
177 |
|
177 |
178 |
if use plugins ; then
|
... | ... | |
193 |
194 |
|
194 |
195 |
myconf+=( --with-system-zlib )
|
195 |
196 |
|
196 |
|
# For bi-arch systems, enable a 64bit bfd. This matches
|
197 |
|
# the bi-arch logic in toolchain.eclass. #446946
|
198 |
|
# We used to do it for everyone, but it's slow on 32bit arches. #438522
|
|
197 |
# For bi-arch systems, enable a 64bit bfd. This matches the bi-arch
|
|
198 |
# logic in toolchain.eclass. bug #446946
|
|
199 |
#
|
|
200 |
# We used to do it for everyone, but it's slow on 32bit arches. bug #438522
|
199 |
201 |
case $(tc-arch) in
|
200 |
202 |
ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
|
201 |
203 |
esac
|
... | ... | |
209 |
211 |
--enable-poison-system-directories
|
210 |
212 |
)
|
211 |
213 |
|
212 |
|
# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
|
213 |
|
# on everyone in alpha (for now), we'll just enable it when possible
|
214 |
|
has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
|
215 |
|
has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
|
|
214 |
myconf+=( --enable-secureplt )
|
216 |
215 |
|
217 |
216 |
# mips can't do hash-style=gnu ...
|
218 |
217 |
if [[ $(tc-arch) != mips ]] ; then
|
... | ... | |
236 |
235 |
--enable-threads
|
237 |
236 |
# Newer versions (>=2.27) offer a configure flag now.
|
238 |
237 |
--enable-relro
|
239 |
|
# Newer versions (>=2.24) make this an explicit option. #497268
|
|
238 |
# Newer versions (>=2.24) make this an explicit option, bug #497268
|
240 |
239 |
--enable-install-libiberty
|
241 |
240 |
# Available from 2.35 on
|
242 |
241 |
--enable-textrel-check=warning
|
243 |
|
# Works better than vapier's patch... #808787
|
|
242 |
# Works better than vapier's patch., bug #808787
|
244 |
243 |
--enable-new-dtags
|
245 |
244 |
--disable-werror
|
246 |
245 |
--with-bugurl="$(toolchain-binutils_bugurl)"
|
247 |
246 |
--with-pkgversion="$(toolchain-binutils_pkgversion)"
|
248 |
247 |
$(use_enable static-libs static)
|
249 |
|
${EXTRA_ECONF}
|
250 |
|
# Disable modules that are in a combined binutils/gdb tree. #490566
|
|
248 |
# Disable modules that are in a combined binutils/gdb tree. bug #490566
|
251 |
249 |
--disable-{gdb,libdecnumber,readline,sim}
|
252 |
250 |
# Strip out broken static link flags.
|
253 |
251 |
# https://gcc.gnu.org/PR56750
|
254 |
252 |
--without-stage1-ldflags
|
255 |
253 |
# Change SONAME to avoid conflict across
|
256 |
|
# {native,cross}/binutils, binutils-libs. #666100
|
|
254 |
# {native,cross}/binutils, binutils-libs. bug #666100
|
257 |
255 |
--with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
|
258 |
256 |
|
259 |
257 |
# avoid automagic dependency on (currently prefix) systems
|
... | ... | |
265 |
263 |
# But the check does not quite work on i686: bug #760926.
|
266 |
264 |
$(use_enable cet)
|
267 |
265 |
|
268 |
|
# No LTO for HPPA64 right now as we don't build kgcc64 with LTO support.
|
269 |
|
$(use_enable pgo pgo-build)
|
270 |
266 |
)
|
271 |
267 |
|
272 |
|
if use pgo ; then
|
273 |
|
export BUILD_CFLAGS="${CFLAGS}"
|
|
268 |
if ! is_cross ; then
|
|
269 |
# No LTO for HPPA64 right now as we don't build kgcc64 with LTO support.
|
|
270 |
myconf+=( $(use_enable pgo pgo-build) )
|
|
271 |
|
|
272 |
if use pgo ; then
|
|
273 |
export BUILD_CFLAGS="${CFLAGS}"
|
|
274 |
fi
|
274 |
275 |
fi
|
275 |
276 |
|
276 |
|
echo ./configure "${myconf[@]}"
|
277 |
|
"${S}"/configure "${myconf[@]}" || die
|
|
277 |
ECONF_SOURCE="${S}" econf "${myconf[@]}" || die
|
278 |
278 |
|
279 |
279 |
# Prevent makeinfo from running if doc is unset.
|
280 |
280 |
if ! use doc ; then
|
... | ... | |
285 |
285 |
}
|
286 |
286 |
|
287 |
287 |
src_compile() {
|
288 |
|
cd "${MY_BUILDDIR}"
|
|
288 |
cd "${MY_BUILDDIR}" || die
|
|
289 |
|
289 |
290 |
# see Note [tooldir hack for ldscripts]
|
290 |
|
emake tooldir="${EPREFIX}${TOOLPATH}" all
|
|
291 |
emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all
|
291 |
292 |
|
292 |
293 |
# only build info pages if the user wants them
|
293 |
294 |
if use doc ; then
|
294 |
|
emake info
|
|
295 |
emake V=1 info
|
295 |
296 |
fi
|
296 |
297 |
|
297 |
298 |
# we nuke the manpages when we're left with junk
|
... | ... | |
300 |
301 |
}
|
301 |
302 |
|
302 |
303 |
src_test() {
|
303 |
|
cd "${MY_BUILDDIR}"
|
|
304 |
cd "${MY_BUILDDIR}" || die
|
304 |
305 |
|
305 |
|
# bug 637066
|
|
306 |
# bug #637066
|
306 |
307 |
filter-flags -Wall -Wreturn-type
|
307 |
308 |
|
308 |
|
emake -k check
|
|
309 |
emake -k V=1 check
|
309 |
310 |
}
|
310 |
311 |
|
311 |
312 |
src_install() {
|
312 |
313 |
local x d
|
313 |
314 |
|
314 |
|
cd "${MY_BUILDDIR}"
|
|
315 |
cd "${MY_BUILDDIR}" || die
|
|
316 |
|
315 |
317 |
# see Note [tooldir hack for ldscripts]
|
316 |
|
emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
|
317 |
|
rm -rf "${ED}"/${LIBPATH}/bin
|
|
318 |
emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
|
|
319 |
rm -rf "${ED}"/${LIBPATH}/bin || die
|
318 |
320 |
use static-libs || find "${ED}" -name '*.la' -delete
|
319 |
321 |
|
320 |
|
# Newer versions of binutils get fancy with ${LIBPATH} #171905
|
321 |
|
cd "${ED}"/${LIBPATH}
|
|
322 |
# Newer versions of binutils get fancy with ${LIBPATH}, bug #171905
|
|
323 |
cd "${ED}"/${LIBPATH} || die
|
322 |
324 |
for d in ../* ; do
|
323 |
325 |
[[ ${d} == ../${PV} ]] && continue
|
324 |
326 |
mv ${d}/* . || die
|
... | ... | |
329 |
331 |
# When something is built to cross-compile, it installs into
|
330 |
332 |
# /usr/$CHOST/ by default ... we have to 'fix' that :)
|
331 |
333 |
if is_cross ; then
|
332 |
|
cd "${ED}"/${BINPATH}
|
|
334 |
cd "${ED}"/${BINPATH} || die
|
333 |
335 |
for x in * ; do
|
334 |
|
mv ${x} ${x/${CTARGET}-}
|
|
336 |
mv ${x} ${x/${CTARGET}-} || die
|
335 |
337 |
done
|
336 |
338 |
|
337 |
339 |
if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
|
|
340 |
# No die for now, dies on hppa?
|
338 |
341 |
mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
|
339 |
342 |
mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
|
340 |
343 |
rm -r "${ED}"/usr/${CHOST}/{include,lib}
|
341 |
344 |
fi
|
342 |
345 |
fi
|
|
346 |
|
343 |
347 |
insinto ${INCPATH}
|
344 |
348 |
local libiberty_headers=(
|
345 |
349 |
# Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
|
... | ... | |
353 |
357 |
)
|
354 |
358 |
doins "${libiberty_headers[@]/#/${S}/include/}"
|
355 |
359 |
if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
|
|
360 |
# TODO: add || die here, fails on hppa?
|
356 |
361 |
mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
|
357 |
362 |
rm -r "${ED}"/${LIBPATH}/lib
|
358 |
363 |
fi
|
... | ... | |
368 |
373 |
|
369 |
374 |
# Handle documentation
|
370 |
375 |
if ! is_cross ; then
|
371 |
|
cd "${S}"
|
|
376 |
cd "${S}" || die
|
372 |
377 |
dodoc README
|
|
378 |
|
373 |
379 |
docinto bfd
|
374 |
380 |
dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
|
|
381 |
|
375 |
382 |
docinto binutils
|
376 |
383 |
dodoc binutils/ChangeLog binutils/NEWS binutils/README
|
|
384 |
|
377 |
385 |
docinto gas
|
378 |
386 |
dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
|
|
387 |
|
379 |
388 |
docinto gprof
|
380 |
389 |
dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
|
|
390 |
|
381 |
391 |
docinto ld
|
382 |
392 |
dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
|
|
393 |
|
383 |
394 |
docinto libiberty
|
384 |
395 |
dodoc libiberty/ChangeLog* libiberty/README
|
|
396 |
|
385 |
397 |
docinto opcodes
|
386 |
398 |
dodoc opcodes/ChangeLog*
|
387 |
399 |
fi
|
388 |
400 |
|
389 |
401 |
# Remove shared info pages
|
390 |
|
rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
|
|
402 |
rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} || die
|
391 |
403 |
|
392 |
404 |
# Trim all empty dirs
|
393 |
405 |
find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
|