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

Collapse All | Expand All

(-)tauon.orig/toolchain.eclass (-82 / +108 lines)
Lines 472-478 Link Here
472
	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
472
	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
473
473
474
	local gcc_specs_file
474
	local gcc_specs_file
475
	local gcc_envd_file="${D}${gcc_envd_base}"
475
	local gcc_envd_file="${ED}${gcc_envd_base}"
476
	if [[ -z $1 ]] ; then
476
	if [[ -z $1 ]] ; then
477
		# I'm leaving the following commented out to remind me that it
477
		# I'm leaving the following commented out to remind me that it
478
		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
478
		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
Lines 481-487 Link Here
481
		gcc_specs_file=""
481
		gcc_specs_file=""
482
	else
482
	else
483
		gcc_envd_file+="-$1"
483
		gcc_envd_file+="-$1"
484
		gcc_specs_file="${LIBPATH}/$1.specs"
484
		gcc_specs_file="${EPREFIX}${LIBPATH}/$1.specs"
485
	fi
485
	fi
486
486
487
	# We want to list the default ABI's LIBPATH first so libtool
487
	# We want to list the default ABI's LIBPATH first so libtool
Lines 493-499 Link Here
493
		local mdir mosdir abi ldpath
493
		local mdir mosdir abi ldpath
494
		for abi in $(get_all_abis TARGET) ; do
494
		for abi in $(get_all_abis TARGET) ; do
495
			mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
495
			mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
496
			ldpath=${LIBPATH}
496
			ldpath=${EPREFIX}${LIBPATH}
497
			[[ ${mdir} != "." ]] && ldpath+="/${mdir}"
497
			[[ ${mdir} != "." ]] && ldpath+="/${mdir}"
498
			ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
498
			ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
499
499
Lines 502-517 Link Here
502
		done
502
		done
503
	else
503
	else
504
		# Older gcc's didn't do multilib, so logic is simple.
504
		# Older gcc's didn't do multilib, so logic is simple.
505
		ldpaths=${LIBPATH}
505
		ldpaths=${EPREFIX}${LIBPATH}
506
	fi
506
	fi
507
507
508
	cat <<-EOF > ${gcc_envd_file}
508
	cat <<-EOF > ${gcc_envd_file}
509
	PATH="${BINPATH}"
509
	PATH="${EPREFIX}${BINPATH}"
510
	ROOTPATH="${BINPATH}"
510
	ROOTPATH="${EPREFIX}${BINPATH}"
511
	GCC_PATH="${BINPATH}"
511
	GCC_PATH="${EPREFIX}${BINPATH}"
512
	LDPATH="${ldpaths}"
512
	LDPATH="${ldpaths}"
513
	MANPATH="${DATAPATH}/man"
513
	MANPATH="${EPREFIX}${DATAPATH}/man"
514
	INFOPATH="${DATAPATH}/info"
514
	INFOPATH="${EPREFIX}${DATAPATH}/info"
515
	STDCXX_INCDIR="${STDCXX_INCDIR##*/}"
515
	STDCXX_INCDIR="${STDCXX_INCDIR##*/}"
516
	CTARGET="${CTARGET}"
516
	CTARGET="${CTARGET}"
517
	GCC_SPECS="${gcc_specs_file}"
517
	GCC_SPECS="${gcc_specs_file}"
Lines 568-573 Link Here
568
			"in your make.conf if you want to use this version."
568
			"in your make.conf if you want to use this version."
569
	fi
569
	fi
570
570
571
572
	# TPREFIX is the prefix of the CTARGET installation
573
	export TPREFIX=${TPREFIX:-${EPREFIX}}
574
571
	# we dont want to use the installed compiler's specs to build gcc!
575
	# we dont want to use the installed compiler's specs to build gcc!
572
	unset GCC_SPECS
576
	unset GCC_SPECS
573
577
Lines 596-611 Link Here
596
		echo
600
		echo
597
601
598
		# Clean up old paths
602
		# Clean up old paths
599
		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
603
		rm -f "${EROOT}"/*/rcscripts/awk/fixlafiles.awk "${EROOT}"/sbin/fix_libtool_files.sh
600
		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
604
		rmdir "${EROOT}"/*/rcscripts{/awk,} 2>/dev/null
601
605
602
		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
606
		mkdir -p "${EROOT}"/usr/{share/gcc-data,sbin,bin}
603
		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
607
		cp "${EROOT}/${DATAPATH}"/fixlafiles.awk "${EROOT}"/usr/share/gcc-data/ || die
604
		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
608
		cp "${EROOT}/${DATAPATH}"/fix_libtool_files.sh "${EROOT}"/usr/sbin/ || die
605
609
606
		# Since these aren't critical files and portage sucks with
610
		# Since these aren't critical files and portage sucks with
607
		# handling of binpkgs, don't require these to be found
611
		# handling of binpkgs, don't require these to be found
608
		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
612
		cp "${EROOT}/${DATAPATH}"/c{89,99} "${EROOT}"/usr/bin/ 2>/dev/null
609
	fi
613
	fi
610
614
611
	if use regression-test ; then
615
	if use regression-test ; then
Lines 622-631 Link Here
622
626
623
	# clean up the cruft left behind by cross-compilers
627
	# clean up the cruft left behind by cross-compilers
624
	if is_crosscompile ; then
628
	if is_crosscompile ; then
625
		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
629
		if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
626
			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
630
			rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
627
			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
631
			rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
628
			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
632
			rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
629
		fi
633
		fi
630
		return 0
634
		return 0
631
	fi
635
	fi
Lines 633-647 Link Here
633
	# ROOT isnt handled by the script
637
	# ROOT isnt handled by the script
634
	[[ ${ROOT} != "/" ]] && return 0
638
	[[ ${ROOT} != "/" ]] && return 0
635
639
636
	if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
640
	if [[ ! -e ${EPREFIX}${LIBPATH}/libstdc++.so ]] ; then
637
		# make sure the profile is sane during same-slot upgrade #289403
641
		# make sure the profile is sane during same-slot upgrade #289403
638
		do_gcc_config
642
		do_gcc_config
639
643
640
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
644
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
641
		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
645
		"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
642
		if [[ -n ${BRANCH_UPDATE} ]] ; then
646
		if [[ -n ${BRANCH_UPDATE} ]] ; then
643
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
647
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
644
			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
648
			"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
645
		fi
649
		fi
646
	fi
650
	fi
647
651
Lines 1050-1063 Link Here
1050
1054
1051
gcc_do_configure() {
1055
gcc_do_configure() {
1052
	local confgcc=(
1056
	local confgcc=(
1053
		# Set configuration based on path variables
1057
		--prefix="${EPREFIX}${PREFIX}"
1054
		--prefix="${PREFIX}"
1058
		--bindir="${EPREFIX}${BINPATH}"
1055
		--bindir="${BINPATH}"
1059
		--includedir="${EPREFIX}${INCLUDEPATH}"
1056
		--includedir="${INCLUDEPATH}"
1060
		--datadir="${EPREFIX}${DATAPATH}"
1057
		--datadir="${DATAPATH}"
1061
		--mandir="${EPREFIX}${DATAPATH}/man"
1058
		--mandir="${DATAPATH}/man"
1062
		--infodir="${EPREFIX}${DATAPATH}/info"
1059
		--infodir="${DATAPATH}/info"
1063
		--with-gxx-include-dir="${EPREFIX}${STDCXX_INCDIR}"
1060
		--with-gxx-include-dir="${STDCXX_INCDIR}"
1061
	)
1064
	)
1062
	# On Darwin we need libdir to be set in order to get correct install names
1065
	# On Darwin we need libdir to be set in order to get correct install names
1063
	# for things like libobjc-gnu, libgcj and libfortran.  If we enable it on
1066
	# for things like libobjc-gnu, libgcj and libfortran.  If we enable it on
Lines 1095-1101 Link Here
1095
	elif tc_version_is_at_least 4.6 ; then
1098
	elif tc_version_is_at_least 4.6 ; then
1096
		confgcc+=( $(use_with graphite cloog) )
1099
		confgcc+=( $(use_with graphite cloog) )
1097
		confgcc+=( $(use_with graphite ppl) )
1100
		confgcc+=( $(use_with graphite ppl) )
1098
		use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl )
1101
		use graphite && confgcc+=( --with-cloog-include="${EPREFIX}"/usr/include/cloog-ppl )
1099
		use graphite && confgcc+=( --disable-ppl-version-check )
1102
		use graphite && confgcc+=( --disable-ppl-version-check )
1100
	elif tc_version_is_at_least 4.4 ; then
1103
	elif tc_version_is_at_least 4.4 ; then
1101
		confgcc+=( --without-cloog )
1104
		confgcc+=( --without-cloog )
Lines 1162-1167 Link Here
1162
		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
1165
		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
1163
		mingw*|*-mingw*) needed_libc=mingw-runtime;;
1166
		mingw*|*-mingw*) needed_libc=mingw-runtime;;
1164
		avr)			 confgcc+=( --enable-shared --disable-threads );;
1167
		avr)			 confgcc+=( --enable-shared --disable-threads );;
1168
		*-apple-darwin*) confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1169
		*-solaris*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1170
		*-freebsd*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1165
		esac
1171
		esac
1166
		if [[ -n ${needed_libc} ]] ; then
1172
		if [[ -n ${needed_libc} ]] ; then
1167
			local confgcc_no_libc=( --disable-shared )
1173
			local confgcc_no_libc=( --disable-shared )
Lines 1175-1184 Link Here
1175
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
1181
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
1176
				confgcc+=(
1182
				confgcc+=(
1177
					"${confgcc_no_libc[@]}"
1183
					"${confgcc_no_libc[@]}"
1178
					--with-sysroot=${PREFIX}/${CTARGET}
1184
					--with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET}
1179
				)
1185
				)
1180
			else
1186
			else
1181
				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
1187
				confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} )
1182
			fi
1188
			fi
1183
		fi
1189
		fi
1184
1190
Lines 1195-1200 Link Here
1195
		*)
1201
		*)
1196
			confgcc+=( --enable-threads=posix ) ;;
1202
			confgcc+=( --enable-threads=posix ) ;;
1197
		esac
1203
		esac
1204
1205
		if use prefix ; then
1206
			# should be /usr, because it's the path to search includes for,
1207
			# which is unrelated to TOOLCHAIN_PREFIX, a.k.a. PREFIX
1208
			confgcc+=( --with-local-prefix="${TPREFIX}"/usr )
1209
		fi
1198
	fi
1210
	fi
1199
	# __cxa_atexit is "essential for fully standards-compliant handling of
1211
	# __cxa_atexit is "essential for fully standards-compliant handling of
1200
	# destructors", but apparently requires glibc.
1212
	# destructors", but apparently requires glibc.
Lines 1231-1241 Link Here
1231
	# if the target can do biarch (-m32/-m64), enable it.  overhead should
1243
	# if the target can do biarch (-m32/-m64), enable it.  overhead should
1232
	# be small, and should simplify building of 64bit kernels in a 32bit
1244
	# be small, and should simplify building of 64bit kernels in a 32bit
1233
	# userland by not needing sys-devel/kgcc64.  #349405
1245
	# userland by not needing sys-devel/kgcc64.  #349405
1246
	if ! use prefix ; then
1234
	case $(tc-arch) in
1247
	case $(tc-arch) in
1235
	ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
1248
	ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
1236
	sparc)     tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) ;;
1249
	sparc)     tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) ;;
1237
	amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
1250
	amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
1238
	esac
1251
	esac
1252
	fi
1239
1253
1240
	tc_version_is_at_least 4.3 && confgcc+=(
1254
	tc_version_is_at_least 4.3 && confgcc+=(
1241
		--with-bugurl=http://bugs.gentoo.org/
1255
		--with-bugurl=http://bugs.gentoo.org/
Lines 1259-1264 Link Here
1259
1273
1260
	# Nothing wrong with a good dose of verbosity
1274
	# Nothing wrong with a good dose of verbosity
1261
	echo
1275
	echo
1276
	einfo "EPREFIX:			${EPREFIX}"
1262
	einfo "PREFIX:			${PREFIX}"
1277
	einfo "PREFIX:			${PREFIX}"
1263
	einfo "BINPATH:			${BINPATH}"
1278
	einfo "BINPATH:			${BINPATH}"
1264
	einfo "LIBPATH:			${LIBPATH}"
1279
	einfo "LIBPATH:			${LIBPATH}"
Lines 1353-1362 Link Here
1353
1368
1354
	pushd "${WORKDIR}"/build >/dev/null
1369
	pushd "${WORKDIR}"/build >/dev/null
1355
1370
1371
	# we "undef" T because the GCC makefiles use this variable, and if it's set
1372
	# in the environment (like Portage does) the build fails, bug #286494
1356
	emake \
1373
	emake \
1374
		T= \
1357
		LDFLAGS="${LDFLAGS}" \
1375
		LDFLAGS="${LDFLAGS}" \
1358
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1376
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1359
		LIBPATH="${LIBPATH}" \
1377
		LIBPATH="${EPREFIX}${LIBPATH}" \
1360
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1378
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1361
		${GCC_MAKE_TARGET} \
1379
		${GCC_MAKE_TARGET} \
1362
		|| die "emake failed with ${GCC_MAKE_TARGET}"
1380
		|| die "emake failed with ${GCC_MAKE_TARGET}"
Lines 1494-1500 Link Here
1494
	touch "${S}"/gcc/c-gperf.h
1512
	touch "${S}"/gcc/c-gperf.h
1495
1513
1496
	# Do not make manpages if we do not have perl ...
1514
	# Do not make manpages if we do not have perl ...
1497
	[[ ! -x /usr/bin/perl ]] \
1515
	[[ ! -x ${EPREFIX}/usr/bin/perl ]] \
1498
		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1516
		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1499
1517
1500
	einfo "Compiling ${PN} ..."
1518
	einfo "Compiling ${PN} ..."
Lines 1537-1545 Link Here
1537
	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
1555
	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
1538
1556
1539
	# Punt some tools which are really only useful while building gcc
1557
	# Punt some tools which are really only useful while building gcc
1540
	find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1558
	find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1541
	# This one comes with binutils
1559
	# This one comes with binutils
1542
	find "${D}" -name libiberty.a -delete
1560
	find "${ED}" -name libiberty.a -delete
1543
1561
1544
	# Move the libraries to the proper location
1562
	# Move the libraries to the proper location
1545
	gcc_movelibs
1563
	gcc_movelibs
Lines 1548-1554 Link Here
1548
	if ! is_crosscompile ; then
1566
	if ! is_crosscompile ; then
1549
		local EXEEXT
1567
		local EXEEXT
1550
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1568
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1551
		[[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}"
1569
		[[ -r ${ED}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
1552
	fi
1570
	fi
1553
1571
1554
	dodir /etc/env.d/gcc
1572
	dodir /etc/env.d/gcc
Lines 1562-1568 Link Here
1562
	gcc_slot_java
1580
	gcc_slot_java
1563
1581
1564
	dodir /usr/bin
1582
	dodir /usr/bin
1565
	cd "${D}"${BINPATH}
1583
	cd "${ED}"${BINPATH}
1566
	# Ugh: we really need to auto-detect this list.
1584
	# Ugh: we really need to auto-detect this list.
1567
	#      It's constantly out of date.
1585
	#      It's constantly out of date.
1568
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
1586
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
Lines 1588-1621 Link Here
1588
	done
1606
	done
1589
1607
1590
	# Now do the fun stripping stuff
1608
	# Now do the fun stripping stuff
1591
	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1609
	env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${BINPATH}"
1592
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1610
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${ED}${LIBPATH}"
1593
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1611
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1594
	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
1612
	[[ -d ${ED}${PREFIX}/libexec/gcc ]] && \
1595
		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1613
		env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1596
1614
1597
	cd "${S}"
1615
	cd "${S}"
1598
	if is_crosscompile; then
1616
	if is_crosscompile; then
1599
		rm -rf "${D}"/usr/share/{man,info}
1617
		rm -rf "${ED}"/usr/share/{man,info}
1600
		rm -rf "${D}"${DATAPATH}/{man,info}
1618
		rm -rf "${ED}"${DATAPATH}/{man,info}
1601
	else
1619
	else
1602
		if tc_version_is_at_least 3.0 ; then
1620
		if tc_version_is_at_least 3.0 ; then
1603
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1621
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1604
			if [[ -d ${cxx_mandir} ]] ; then
1622
			if [[ -d ${cxx_mandir} ]] ; then
1605
				# clean bogus manpages #113902
1623
				# clean bogus manpages #113902
1606
				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1624
				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1607
				cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/
1625
				cp -r "${cxx_mandir}"/man? "${ED}/${DATAPATH}"/man/
1608
			fi
1626
			fi
1609
		fi
1627
		fi
1610
		has noinfo ${FEATURES} \
1628
		has noinfo ${FEATURES} \
1611
			&& rm -r "${D}/${DATAPATH}"/info \
1629
			&& rm -r "${ED}/${DATAPATH}"/info \
1612
			|| prepinfo "${DATAPATH}"
1630
			|| prepinfo "${DATAPATH}"
1613
		has noman ${FEATURES} \
1631
		has noman ${FEATURES} \
1614
			&& rm -r "${D}/${DATAPATH}"/man \
1632
			&& rm -r "${ED}/${DATAPATH}"/man \
1615
			|| prepman "${DATAPATH}"
1633
			|| prepman "${DATAPATH}"
1616
	fi
1634
	fi
1617
	# prune empty dirs left behind
1635
	# prune empty dirs left behind
1618
	find "${D}" -depth -type d -delete 2>/dev/null
1636
	find "${ED}" -depth -type d -delete 2>/dev/null
1619
1637
1620
	# install testsuite results
1638
	# install testsuite results
1621
	if use regression-test; then
1639
	if use regression-test; then
Lines 1628-1653 Link Here
1628
	# Rather install the script, else portage with changing $FILESDIR
1646
	# Rather install the script, else portage with changing $FILESDIR
1629
	# between binary and source package borks things ....
1647
	# between binary and source package borks things ....
1630
	if ! is_crosscompile ; then
1648
	if ! is_crosscompile ; then
1649
		cp "${GCC_FILESDIR}"/fix_libtool_files.sh "${T}"
1650
		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la "${T}"
1651
		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk "${T}"
1652
		eprefixify \
1653
			"${T}"/fix_libtool_files.sh \
1654
			"${T}"/fixlafiles.awk-no_gcc_la \
1655
			"${T}"/fixlafiles.awk
1656
1631
		insinto "${DATAPATH}"
1657
		insinto "${DATAPATH}"
1632
		if tc_version_is_at_least 4.0 ; then
1658
		if tc_version_is_at_least 4.0 ; then
1633
			newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1659
			newins "${T}"/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1634
			find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1660
			find "${ED}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1635
		else
1661
		else
1636
			doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1662
			doins "${T}"/fixlafiles.awk || die
1637
		fi
1663
		fi
1638
		exeinto "${DATAPATH}"
1664
		exeinto "${DATAPATH}"
1639
		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1665
		doexe "${T}"/fix_libtool_files.sh || die
1640
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1666
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1641
	fi
1667
	fi
1642
1668
1643
	# Use gid of 0 because some stupid ports don't have
1669
	# Use gid of 0 because some stupid ports don't have
1644
	# the group 'root' set to gid 0.  Send to /dev/null
1670
	# the group 'root' set to gid 0.  Send to /dev/null
1645
	# for people who are testing as non-root.
1671
	# for people who are testing as non-root.
1646
	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
1672
	chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${ED}"${LIBPATH} 2>/dev/null
1647
1673
1648
	# Move pretty-printers to gdb datadir to shut ldconfig up
1674
	# Move pretty-printers to gdb datadir to shut ldconfig up
1649
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1675
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1650
	pushd "${D}"${LIBPATH} >/dev/null
1676
	pushd "${ED}"${LIBPATH} >/dev/null
1651
	for py in $(find . -name '*-gdb.py') ; do
1677
	for py in $(find . -name '*-gdb.py') ; do
1652
		local multidir=${py%/*}
1678
		local multidir=${py%/*}
1653
		insinto "${gdbdir}/${multidir}"
1679
		insinto "${gdbdir}/${multidir}"
Lines 1663-1670 Link Here
1663
1689
1664
	# Disable RANDMMAP so PCH works. #301299
1690
	# Disable RANDMMAP so PCH works. #301299
1665
	if tc_version_is_at_least 4.3 ; then
1691
	if tc_version_is_at_least 4.3 ; then
1666
		pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
1692
		pax-mark -r "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
1667
		pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
1693
		pax-mark -r "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
1668
	fi
1694
	fi
1669
}
1695
}
1670
1696
Lines 1672-1703 Link Here
1672
	local x
1698
	local x
1673
1699
1674
	# Move Java headers to compiler-specific dir
1700
	# Move Java headers to compiler-specific dir
1675
	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
1701
	for x in "${ED}"${PREFIX}/include/gc*.h "${ED}"${PREFIX}/include/j*.h ; do
1676
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
1702
		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/include/
1677
	done
1703
	done
1678
	for x in gcj gnu java javax org ; do
1704
	for x in gcj gnu java javax org ; do
1679
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
1705
		if [[ -d ${ED}${PREFIX}/include/${x} ]] ; then
1680
			dodir /${LIBPATH}/include/${x}
1706
			dodir /${LIBPATH}/include/${x}
1681
			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
1707
			mv -f "${ED}"${PREFIX}/include/${x}/* "${ED}"${LIBPATH}/include/${x}/
1682
			rm -rf "${D}"${PREFIX}/include/${x}
1708
			rm -rf "${ED}"${PREFIX}/include/${x}
1683
		fi
1709
		fi
1684
	done
1710
	done
1685
1711
1686
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1712
	if [[ -d ${ED}${PREFIX}/lib/security ]] || [[ -d ${ED}${PREFIX}/$(get_libdir)/security ]] ; then
1687
		dodir /${LIBPATH}/security
1713
		dodir /${LIBPATH}/security
1688
		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
1714
		mv -f "${ED}"${PREFIX}/lib*/security/* "${ED}"${LIBPATH}/security
1689
		rm -rf "${D}"${PREFIX}/lib*/security
1715
		rm -rf "${ED}"${PREFIX}/lib*/security
1690
	fi
1716
	fi
1691
1717
1692
	# Move random gcj files to compiler-specific directories
1718
	# Move random gcj files to compiler-specific directories
1693
	for x in libgcj.spec logging.properties ; do
1719
	for x in libgcj.spec logging.properties ; do
1694
		x="${D}${PREFIX}/lib/${x}"
1720
		x="${ED}${PREFIX}/lib/${x}"
1695
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
1721
		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/
1696
	done
1722
	done
1697
1723
1698
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1724
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1699
	# primary compiler (aka don't have the -<version> extension)
1725
	# primary compiler (aka don't have the -<version> extension)
1700
	cd "${D}"${BINPATH}
1726
	cd "${ED}"${BINPATH}
1701
	[[ -f jar ]] && mv -f jar gcj-jar
1727
	[[ -f jar ]] && mv -f jar gcj-jar
1702
}
1728
}
1703
1729
Lines 1715-1721 Link Here
1715
1741
1716
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1742
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1717
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1743
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1718
		local TODIR=${D}${LIBPATH}/${MULTIDIR}
1744
		local TODIR=${ED}${LIBPATH}/${MULTIDIR}
1719
		local FROMDIR=
1745
		local FROMDIR=
1720
1746
1721
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1747
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
Lines 1727-1733 Link Here
1727
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1753
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1728
		do
1754
		do
1729
			removedirs="${removedirs} ${FROMDIR}"
1755
			removedirs="${removedirs} ${FROMDIR}"
1730
			FROMDIR=${D}${FROMDIR}
1756
			FROMDIR=${ED}${FROMDIR}
1731
			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1757
			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1732
				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1758
				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1733
				if [[ -n ${files} ]] ; then
1759
				if [[ -n ${files} ]] ; then
Lines 1739-1748 Link Here
1739
1765
1740
		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1766
		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1741
		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
1767
		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
1742
		for x in "${D}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
1768
		for x in "${ED}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
1743
			[[ -f ${x} ]] || continue
1769
			[[ -f ${x} ]] || continue
1744
			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
1770
			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
1745
			mv "${x}" "${D}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
1771
			mv "${x}" "${ED}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
1746
		done
1772
		done
1747
	done
1773
	done
1748
1774
Lines 1751-1759 Link Here
1751
	#	rmdir SRC/lib/../lib/
1777
	#	rmdir SRC/lib/../lib/
1752
	#	mv SRC/lib/../lib32/*.o DEST  # Bork
1778
	#	mv SRC/lib/../lib32/*.o DEST  # Bork
1753
	for FROMDIR in ${removedirs} ; do
1779
	for FROMDIR in ${removedirs} ; do
1754
		rmdir "${D}"${FROMDIR} >& /dev/null
1780
		rmdir "${ED}"${FROMDIR} >& /dev/null
1755
	done
1781
	done
1756
	find "${D}" -type d | xargs rmdir >& /dev/null
1782
	find "${ED}" -type d | xargs rmdir >& /dev/null
1757
}
1783
}
1758
#----<< src_* >>----
1784
#----<< src_* >>----
1759
1785
Lines 1876-1887 Link Here
1876
	# if the current config is invalid, we definitely want a new one
1902
	# if the current config is invalid, we definitely want a new one
1877
	# Note: due to bash quirkiness, the following must not be 1 line
1903
	# Note: due to bash quirkiness, the following must not be 1 line
1878
	local curr_config
1904
	local curr_config
1879
	curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
1905
	curr_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>&1) || return 0
1880
1906
1881
	# if the previously selected config has the same major.minor (branch) as
1907
	# if the previously selected config has the same major.minor (branch) as
1882
	# the version we are installing, then it will probably be uninstalled
1908
	# the version we are installing, then it will probably be uninstalled
1883
	# for being in the same SLOT, make sure we run gcc-config.
1909
	# for being in the same SLOT, make sure we run gcc-config.
1884
	local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
1910
	local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
1885
1911
1886
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
1912
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
1887
1913
Lines 1916-1935 Link Here
1916
1942
1917
do_gcc_config() {
1943
do_gcc_config() {
1918
	if ! should_we_gcc_config ; then
1944
	if ! should_we_gcc_config ; then
1919
		env -i ROOT="${ROOT}" gcc-config --use-old --force
1945
		env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config --use-old --force
1920
		return 0
1946
		return 0
1921
	fi
1947
	fi
1922
1948
1923
	local current_gcc_config="" current_specs="" use_specs=""
1949
	local current_gcc_config="" current_specs="" use_specs=""
1924
1950
1925
	current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
1951
	current_gcc_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>/dev/null)
1926
	if [[ -n ${current_gcc_config} ]] ; then
1952
	if [[ -n ${current_gcc_config} ]] ; then
1927
		# figure out which specs-specific config is active
1953
		# figure out which specs-specific config is active
1928
		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
1954
		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
1929
		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
1955
		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
1930
	fi
1956
	fi
1931
	if [[ -n ${use_specs} ]] && \
1957
	if [[ -n ${use_specs} ]] && \
1932
	   [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
1958
	   [[ ! -e ${EROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
1933
	then
1959
	then
1934
		ewarn "The currently selected specs-specific gcc config,"
1960
		ewarn "The currently selected specs-specific gcc config,"
1935
		ewarn "${current_specs}, doesn't exist anymore. This is usually"
1961
		ewarn "${current_specs}, doesn't exist anymore. This is usually"
Lines 2015-2021 Link Here
2015
# -are-, and not where they -used- to be.  also, any dependencies we have
2041
# -are-, and not where they -used- to be.  also, any dependencies we have
2016
# on our own .la files need to be updated.
2042
# on our own .la files need to be updated.
2017
fix_libtool_libdir_paths() {
2043
fix_libtool_libdir_paths() {
2018
	pushd "${D}" >/dev/null
2044
	pushd "${ED}" >/dev/null
2019
2045
2020
	pushd "./${1}" >/dev/null
2046
	pushd "./${1}" >/dev/null
2021
	local dir="${PWD#${D%/}}"
2047
	local dir="${PWD#${D%/}}"
Lines 2024-2033 Link Here
2024
	popd >/dev/null
2050
	popd >/dev/null
2025
2051
2026
	sed -i \
2052
	sed -i \
2027
		-e "/^libdir=/s:=.*:='${dir}':" \
2053
		-e "/^libdir=/s:=.*:='${EPREFIX}/${dir##/}':" \
2028
		./${dir}/*.la
2054
		./${dir}/*.la
2029
	sed -i \
2055
	sed -i \
2030
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
2056
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${EPREFIX}/${LIBPATH##/}/\1:g" \
2031
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
2057
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
2032
		./${dir}/*.la
2058
		./${dir}/*.la
2033
2059

Return to bug 474358