Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 478434 | Differences between
and this patch

Collapse All | Expand All

(-)a/eclass/toolchain-binutils.eclass (-28 / +31 lines)
Lines 60-65 if [[ ${CTARGET} == ${CHOST} ]] ; then Link Here
60
fi
60
fi
61
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
61
is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
62
62
63
: ${ED:=${D}}
64
: ${EROOT:=${ROOT}}
65
63
DESCRIPTION="Tools necessary to build programs"
66
DESCRIPTION="Tools necessary to build programs"
64
HOMEPAGE="http://sourceware.org/binutils/"
67
HOMEPAGE="http://sourceware.org/binutils/"
65
68
Lines 262-268 toolchain-binutils_src_compile() { Link Here
262
265
263
	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
266
	use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
264
	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
267
	[[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
265
	is_cross && myconf+=( --with-sysroot=/usr/${CTARGET} )
268
	is_cross && myconf+=( --with-sysroot="${EPREFIX}"/usr/${CTARGET} )
266
269
267
	# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
270
	# glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
268
	# on everyone in alpha (for now), we'll just enable it when possible
271
	# on everyone in alpha (for now), we'll just enable it when possible
Lines 270-285 toolchain-binutils_src_compile() { Link Here
270
	has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
273
	has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
271
274
272
	myconf+=(
275
	myconf+=(
273
		--prefix=/usr
276
		--prefix="${EPREFIX}"/usr
274
		--host=${CHOST}
277
		--host=${CHOST}
275
		--target=${CTARGET}
278
		--target=${CTARGET}
276
		--datadir=${DATAPATH}
279
		--datadir="${EPREFIX}"${DATAPATH}
277
		--infodir=${DATAPATH}/info
280
		--infodir="${EPREFIX}"${DATAPATH}/info
278
		--mandir=${DATAPATH}/man
281
		--mandir="${EPREFIX}"${DATAPATH}/man
279
		--bindir=${BINPATH}
282
		--bindir="${EPREFIX}"${BINPATH}
280
		--libdir=${LIBPATH}
283
		--libdir="${EPREFIX}"${LIBPATH}
281
		--libexecdir=${LIBPATH}
284
		--libexecdir="${EPREFIX}"${LIBPATH}
282
		--includedir=${INCPATH}
285
		--includedir="${EPREFIX}"${INCPATH}
283
		--enable-obsolete
286
		--enable-obsolete
284
		--enable-shared
287
		--enable-shared
285
		--enable-threads
288
		--enable-threads
Lines 317-323 toolchain-binutils_src_compile() { Link Here
317
				--with-bfd-include-dir=${MY_BUILDDIR}/bfd
320
				--with-bfd-include-dir=${MY_BUILDDIR}/bfd
318
				--with-libbfd=${MY_BUILDDIR}/bfd/libbfd.a
321
				--with-libbfd=${MY_BUILDDIR}/bfd/libbfd.a
319
				--with-libiberty=${MY_BUILDDIR}/libiberty/libiberty.a
322
				--with-libiberty=${MY_BUILDDIR}/libiberty/libiberty.a
320
				--with-binutils-ldscript-dir=${LIBPATH}/ldscripts
323
				--with-binutils-ldscript-dir="${EPREFIX}"${LIBPATH}/ldscripts
321
			)
324
			)
322
			echo ./configure "${myconf[@]}"
325
			echo ./configure "${myconf[@]}"
323
			./configure "${myconf[@]}" || die
326
			./configure "${myconf[@]}" || die
Lines 335-346 toolchain-binutils_src_install() { Link Here
335
	local x d
338
	local x d
336
339
337
	cd "${MY_BUILDDIR}"
340
	cd "${MY_BUILDDIR}"
338
	emake DESTDIR="${D}" tooldir="${LIBPATH}" install || die
341
	emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install || die
339
	rm -rf "${D}"/${LIBPATH}/bin
342
	rm -rf "${ED}"/${LIBPATH}/bin
340
	use static-libs || find "${D}" -name '*.la' -delete
343
	use static-libs || find "${ED}" -name '*.la' -delete
341
344
342
	# Newer versions of binutils get fancy with ${LIBPATH} #171905
345
	# Newer versions of binutils get fancy with ${LIBPATH} #171905
343
	cd "${D}"/${LIBPATH}
346
	cd "${ED}"/${LIBPATH}
344
	for d in ../* ; do
347
	for d in ../* ; do
345
		[[ ${d} == ../${BVER} ]] && continue
348
		[[ ${d} == ../${BVER} ]] && continue
346
		mv ${d}/* . || die
349
		mv ${d}/* . || die
Lines 351-365 toolchain-binutils_src_install() { Link Here
351
	# When something is built to cross-compile, it installs into
354
	# When something is built to cross-compile, it installs into
352
	# /usr/$CHOST/ by default ... we have to 'fix' that :)
355
	# /usr/$CHOST/ by default ... we have to 'fix' that :)
353
	if is_cross ; then
356
	if is_cross ; then
354
		cd "${D}"/${BINPATH}
357
		cd "${ED}"/${BINPATH}
355
		for x in * ; do
358
		for x in * ; do
356
			mv ${x} ${x/${CTARGET}-}
359
			mv ${x} ${x/${CTARGET}-}
357
		done
360
		done
358
361
359
		if [[ -d ${D}/usr/${CHOST}/${CTARGET} ]] ; then
362
		if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
360
			mv "${D}"/usr/${CHOST}/${CTARGET}/include "${D}"/${INCPATH}
363
			mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
361
			mv "${D}"/usr/${CHOST}/${CTARGET}/lib/* "${D}"/${LIBPATH}/
364
			mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
362
			rm -r "${D}"/usr/${CHOST}/{include,lib}
365
			rm -r "${ED}"/usr/${CHOST}/{include,lib}
363
		fi
366
		fi
364
	fi
367
	fi
365
	insinto ${INCPATH}
368
	insinto ${INCPATH}
Lines 374-382 toolchain-binutils_src_install() { Link Here
374
		splay-tree.h
377
		splay-tree.h
375
	)
378
	)
376
	doins "${libiberty_headers[@]/#/${S}/include/}" || die
379
	doins "${libiberty_headers[@]/#/${S}/include/}" || die
377
	if [[ -d ${D}/${LIBPATH}/lib ]] ; then
380
	if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
378
		mv "${D}"/${LIBPATH}/lib/* "${D}"/${LIBPATH}/
381
		mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
379
		rm -r "${D}"/${LIBPATH}/lib
382
		rm -r "${ED}"/${LIBPATH}/lib
380
	fi
383
	fi
381
384
382
	# Insert elf2flt where appropriate
385
	# Insert elf2flt where appropriate
Lines 386-392 toolchain-binutils_src_install() { Link Here
386
		doins elf2flt.ld || die "doins elf2flt.ld failed"
389
		doins elf2flt.ld || die "doins elf2flt.ld failed"
387
		exeinto ${BINPATH}
390
		exeinto ${BINPATH}
388
		doexe elf2flt flthdr || die "doexe elf2flt flthdr failed"
391
		doexe elf2flt flthdr || die "doexe elf2flt flthdr failed"
389
		mv "${D}"/${BINPATH}/{ld,ld.real} || die
392
		mv "${ED}"/${BINPATH}/{ld,ld.real} || die
390
		newexe ld-elf2flt ld || die "doexe ld-elf2flt failed"
393
		newexe ld-elf2flt ld || die "doexe ld-elf2flt failed"
391
		newdoc README README.elf2flt
394
		newdoc README README.elf2flt
392
	fi
395
	fi
Lines 416-422 toolchain-binutils_src_install() { Link Here
416
	cat <<-EOF > env.d
419
	cat <<-EOF > env.d
417
		TARGET="${CTARGET}"
420
		TARGET="${CTARGET}"
418
		VER="${BVER}"
421
		VER="${BVER}"
419
		LIBPATH="${LIBPATH}"
422
		LIBPATH="${EPREFIX}${LIBPATH}"
420
		FAKE_TARGETS="${FAKE_TARGETS}"
423
		FAKE_TARGETS="${FAKE_TARGETS}"
421
	EOF
424
	EOF
422
	newins env.d ${CTARGET}-${BVER}
425
	newins env.d ${CTARGET}-${BVER}
Lines 441-454 toolchain-binutils_src_install() { Link Here
441
		dodoc opcodes/ChangeLog*
444
		dodoc opcodes/ChangeLog*
442
	fi
445
	fi
443
	# Remove shared info pages
446
	# Remove shared info pages
444
	rm -f "${D}"/${DATAPATH}/info/{dir,configure.info,standards.info}
447
	rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
445
	# Trim all empty dirs
448
	# Trim all empty dirs
446
	find "${D}" -type d | xargs rmdir >& /dev/null
449
	find "${ED}" -type d | xargs rmdir >& /dev/null
447
}
450
}
448
451
449
toolchain-binutils_pkg_postinst() {
452
toolchain-binutils_pkg_postinst() {
450
	# Make sure this ${CTARGET} has a binutils version selected
453
	# Make sure this ${CTARGET} has a binutils version selected
451
	[[ -e ${ROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
454
	[[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
452
	binutils-config ${CTARGET}-${BVER}
455
	binutils-config ${CTARGET}-${BVER}
453
}
456
}
454
457
Lines 461-467 toolchain-binutils_pkg_postrm() { Link Here
461
	#       rerun binutils-config if this is a remerge, as
464
	#       rerun binutils-config if this is a remerge, as
462
	#       we want the mtimes on the symlinks updated (if
465
	#       we want the mtimes on the symlinks updated (if
463
	#       it is the same as the current selected profile)
466
	#       it is the same as the current selected profile)
464
	if [[ ! -e ${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
467
	if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
465
		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
468
		local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
466
		choice=${choice//$'\n'/ }
469
		choice=${choice//$'\n'/ }
467
		choice=${choice/* }
470
		choice=${choice/* }

Return to bug 478434