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 (-84 / +140 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
	# yuck, but how else to do it portable?
572
	local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
573
	if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${EPREFIX} != ${realEPREFIX} ]] ; then
574
		ewarn "Your \${EPREFIX} contains one or more symlinks.  GCC has a"
575
		ewarn "bug which prevents it from working properly when there are"
576
		ewarn "symlinks in your \${EPREFIX}."
577
		ewarn "See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29831"
578
		ewarn "Continuing with your EPREFIX set to:"
579
		ewarn "${realEPREFIX}"
580
		export EPREFIX=${realEPREFIX}
581
	fi
582
583
	# TPREFIX is the prefix of the CTARGET installation
584
	export TPREFIX=${TPREFIX:-${EPREFIX}}
585
571
	# we dont want to use the installed compiler's specs to build gcc!
586
	# we dont want to use the installed compiler's specs to build gcc!
572
	unset GCC_SPECS
587
	unset GCC_SPECS
573
588
Lines 596-611 Link Here
596
		echo
611
		echo
597
612
598
		# Clean up old paths
613
		# Clean up old paths
599
		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
614
		rm -f "${EROOT}"/*/rcscripts/awk/fixlafiles.awk "${EROOT}"/sbin/fix_libtool_files.sh
600
		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
615
		rmdir "${EROOT}"/*/rcscripts{/awk,} 2>/dev/null
601
616
602
		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
617
		mkdir -p "${EROOT}"/usr/{share/gcc-data,sbin,bin}
603
		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
618
		cp "${EROOT}/${DATAPATH}"/fixlafiles.awk "${EROOT}"/usr/share/gcc-data/ || die
604
		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
619
		cp "${EROOT}/${DATAPATH}"/fix_libtool_files.sh "${EROOT}"/usr/sbin/ || die
605
620
606
		# Since these aren't critical files and portage sucks with
621
		# Since these aren't critical files and portage sucks with
607
		# handling of binpkgs, don't require these to be found
622
		# handling of binpkgs, don't require these to be found
608
		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
623
		cp "${EROOT}/${DATAPATH}"/c{89,99} "${EROOT}"/usr/bin/ 2>/dev/null
609
	fi
624
	fi
610
625
611
	if use regression-test ; then
626
	if use regression-test ; then
Lines 622-631 Link Here
622
637
623
	# clean up the cruft left behind by cross-compilers
638
	# clean up the cruft left behind by cross-compilers
624
	if is_crosscompile ; then
639
	if is_crosscompile ; then
625
		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
640
		if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
626
			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
641
			rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
627
			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
642
			rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
628
			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
643
			rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
629
		fi
644
		fi
630
		return 0
645
		return 0
631
	fi
646
	fi
Lines 633-647 Link Here
633
	# ROOT isnt handled by the script
648
	# ROOT isnt handled by the script
634
	[[ ${ROOT} != "/" ]] && return 0
649
	[[ ${ROOT} != "/" ]] && return 0
635
650
636
	if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
651
	if [[ ! -e ${EPREFIX}${LIBPATH}/libstdc++.so ]] ; then
637
		# make sure the profile is sane during same-slot upgrade #289403
652
		# make sure the profile is sane during same-slot upgrade #289403
638
		do_gcc_config
653
		do_gcc_config
639
654
640
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
655
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
641
		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
656
		"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
642
		if [[ -n ${BRANCH_UPDATE} ]] ; then
657
		if [[ -n ${BRANCH_UPDATE} ]] ; then
643
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
658
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
644
			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
659
			"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
645
		fi
660
		fi
646
	fi
661
	fi
647
662
Lines 1049-1063 Link Here
1049
}
1064
}
1050
1065
1051
gcc_do_configure() {
1066
gcc_do_configure() {
1067
	# reset EPREFIX to its realpath equivalent, as Portage resets EPREFIX
1068
	# between phases
1069
	local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
1070
	if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${EPREFIX} != ${realEPREFIX} ]] ; then
1071
		export EPREFIX=${realEPREFIX}
1072
	fi
1073
1074
	# Set configuration based on path variables
1052
	local confgcc=(
1075
	local confgcc=(
1053
		# Set configuration based on path variables
1076
		--prefix="${EPREFIX}${PREFIX}"
1054
		--prefix="${PREFIX}"
1077
		--bindir="${EPREFIX}${BINPATH}"
1055
		--bindir="${BINPATH}"
1078
		--includedir="${EPREFIX}${INCLUDEPATH}"
1056
		--includedir="${INCLUDEPATH}"
1079
		--datadir="${EPREFIX}${DATAPATH}"
1057
		--datadir="${DATAPATH}"
1080
		--mandir="${EPREFIX}${DATAPATH}/man"
1058
		--mandir="${DATAPATH}/man"
1081
		--infodir="${EPREFIX}${DATAPATH}/info"
1059
		--infodir="${DATAPATH}/info"
1082
		--with-gxx-include-dir="${EPREFIX}${STDCXX_INCDIR}"
1060
		--with-gxx-include-dir="${STDCXX_INCDIR}"
1061
	)
1083
	)
1062
	# On Darwin we need libdir to be set in order to get correct install names
1084
	# 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
1085
	# 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
1117
	elif tc_version_is_at_least 4.6 ; then
1096
		confgcc+=( $(use_with graphite cloog) )
1118
		confgcc+=( $(use_with graphite cloog) )
1097
		confgcc+=( $(use_with graphite ppl) )
1119
		confgcc+=( $(use_with graphite ppl) )
1098
		use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl )
1120
		use graphite && confgcc+=( --with-cloog-include="${EPREFIX}"/usr/include/cloog-ppl )
1099
		use graphite && confgcc+=( --disable-ppl-version-check )
1121
		use graphite && confgcc+=( --disable-ppl-version-check )
1100
	elif tc_version_is_at_least 4.4 ; then
1122
	elif tc_version_is_at_least 4.4 ; then
1101
		confgcc+=( --without-cloog )
1123
		confgcc+=( --without-cloog )
Lines 1162-1167 Link Here
1162
		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
1184
		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
1163
		mingw*|*-mingw*) needed_libc=mingw-runtime;;
1185
		mingw*|*-mingw*) needed_libc=mingw-runtime;;
1164
		avr)			 confgcc+=( --enable-shared --disable-threads );;
1186
		avr)			 confgcc+=( --enable-shared --disable-threads );;
1187
		*-apple-darwin*) confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1188
		*-solaris*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1189
		*-freebsd*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1165
		esac
1190
		esac
1166
		if [[ -n ${needed_libc} ]] ; then
1191
		if [[ -n ${needed_libc} ]] ; then
1167
			local confgcc_no_libc=( --disable-shared )
1192
			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
1200
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
1176
				confgcc+=(
1201
				confgcc+=(
1177
					"${confgcc_no_libc[@]}"
1202
					"${confgcc_no_libc[@]}"
1178
					--with-sysroot=${PREFIX}/${CTARGET}
1203
					--with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET}
1179
				)
1204
				)
1180
			else
1205
			else
1181
				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
1206
				confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} )
1182
			fi
1207
			fi
1183
		fi
1208
		fi
1184
1209
Lines 1195-1200 Link Here
1195
		*)
1220
		*)
1196
			confgcc+=( --enable-threads=posix ) ;;
1221
			confgcc+=( --enable-threads=posix ) ;;
1197
		esac
1222
		esac
1223
1224
		if use prefix ; then
1225
			# should be /usr, because it's the path to search includes for,
1226
			# which is unrelated to TOOLCHAIN_PREFIX, a.k.a. PREFIX
1227
			confgcc+=( --with-local-prefix="${TPREFIX}"/usr )
1228
		fi
1198
	fi
1229
	fi
1199
	# __cxa_atexit is "essential for fully standards-compliant handling of
1230
	# __cxa_atexit is "essential for fully standards-compliant handling of
1200
	# destructors", but apparently requires glibc.
1231
	# destructors", but apparently requires glibc.
Lines 1231-1241 Link Here
1231
	# if the target can do biarch (-m32/-m64), enable it.  overhead should
1262
	# 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
1263
	# be small, and should simplify building of 64bit kernels in a 32bit
1233
	# userland by not needing sys-devel/kgcc64.  #349405
1264
	# userland by not needing sys-devel/kgcc64.  #349405
1265
	if ! use prefix ; then
1234
	case $(tc-arch) in
1266
	case $(tc-arch) in
1235
	ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
1267
	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 ) ;;
1268
	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 ) ;;
1269
	amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
1238
	esac
1270
	esac
1271
	fi
1239
1272
1240
	tc_version_is_at_least 4.3 && confgcc+=(
1273
	tc_version_is_at_least 4.3 && confgcc+=(
1241
		--with-bugurl=http://bugs.gentoo.org/
1274
		--with-bugurl=http://bugs.gentoo.org/
Lines 1259-1264 Link Here
1259
1292
1260
	# Nothing wrong with a good dose of verbosity
1293
	# Nothing wrong with a good dose of verbosity
1261
	echo
1294
	echo
1295
	einfo "EPREFIX:			${EPREFIX}"
1262
	einfo "PREFIX:			${PREFIX}"
1296
	einfo "PREFIX:			${PREFIX}"
1263
	einfo "BINPATH:			${BINPATH}"
1297
	einfo "BINPATH:			${BINPATH}"
1264
	einfo "LIBPATH:			${LIBPATH}"
1298
	einfo "LIBPATH:			${LIBPATH}"
Lines 1353-1362 Link Here
1353
1387
1354
	pushd "${WORKDIR}"/build >/dev/null
1388
	pushd "${WORKDIR}"/build >/dev/null
1355
1389
1390
	# we "undef" T because the GCC makefiles use this variable, and if it's set
1391
	# in the environment (like Portage does) the build fails, bug #286494
1356
	emake \
1392
	emake \
1393
		T= \
1357
		LDFLAGS="${LDFLAGS}" \
1394
		LDFLAGS="${LDFLAGS}" \
1358
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1395
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1359
		LIBPATH="${LIBPATH}" \
1396
		LIBPATH="${EPREFIX}${LIBPATH}" \
1360
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1397
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1361
		${GCC_MAKE_TARGET} \
1398
		${GCC_MAKE_TARGET} \
1362
		|| die "emake failed with ${GCC_MAKE_TARGET}"
1399
		|| die "emake failed with ${GCC_MAKE_TARGET}"
Lines 1494-1500 Link Here
1494
	touch "${S}"/gcc/c-gperf.h
1531
	touch "${S}"/gcc/c-gperf.h
1495
1532
1496
	# Do not make manpages if we do not have perl ...
1533
	# Do not make manpages if we do not have perl ...
1497
	[[ ! -x /usr/bin/perl ]] \
1534
	[[ ! -x ${EPREFIX}/usr/bin/perl ]] \
1498
		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1535
		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1499
1536
1500
	einfo "Compiling ${PN} ..."
1537
	einfo "Compiling ${PN} ..."
Lines 1534-1545 Link Here
1534
	done < <(find gcc/include*/ -name '*.h')
1571
	done < <(find gcc/include*/ -name '*.h')
1535
1572
1536
	# Do the 'make install' from the build directory
1573
	# Do the 'make install' from the build directory
1537
	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
1574
	cd "${WORKDIR}"/build
1538
1575
	local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
1576
	if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${realEPREFIX} != ${EPREFIX} ]] ; then
1577
		# compensate the changed prefix
1578
		S=${WORKDIR}/build \
1579
			emake -j1 DESTDIR="${D}"/nuke-me install || die
1580
		mkdir -p "${ED}"
1581
		mv "${D}/nuke-me${realEPREFIX}"/* "${ED}"/
1582
		rm -Rf "${D}"/nuke-me
1583
	else
1584
		S=${WORKDIR}/build \
1585
			emake -j1 DESTDIR="${D}" install || die
1586
	fi
1539
	# Punt some tools which are really only useful while building gcc
1587
	# Punt some tools which are really only useful while building gcc
1540
	find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1588
	find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1541
	# This one comes with binutils
1589
	# This one comes with binutils
1542
	find "${D}" -name libiberty.a -delete
1590
	find "${ED}" -name libiberty.a -delete
1543
1591
1544
	# Move the libraries to the proper location
1592
	# Move the libraries to the proper location
1545
	gcc_movelibs
1593
	gcc_movelibs
Lines 1548-1554 Link Here
1548
	if ! is_crosscompile ; then
1596
	if ! is_crosscompile ; then
1549
		local EXEEXT
1597
		local EXEEXT
1550
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1598
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1551
		[[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}"
1599
		[[ -r ${ED}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
1552
	fi
1600
	fi
1553
1601
1554
	dodir /etc/env.d/gcc
1602
	dodir /etc/env.d/gcc
Lines 1562-1568 Link Here
1562
	gcc_slot_java
1610
	gcc_slot_java
1563
1611
1564
	dodir /usr/bin
1612
	dodir /usr/bin
1565
	cd "${D}"${BINPATH}
1613
	cd "${ED}"${BINPATH}
1566
	# Ugh: we really need to auto-detect this list.
1614
	# Ugh: we really need to auto-detect this list.
1567
	#      It's constantly out of date.
1615
	#      It's constantly out of date.
1568
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
1616
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
Lines 1588-1621 Link Here
1588
	done
1636
	done
1589
1637
1590
	# Now do the fun stripping stuff
1638
	# Now do the fun stripping stuff
1591
	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1639
	env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${BINPATH}"
1592
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1640
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${ED}${LIBPATH}"
1593
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1641
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1594
	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
1642
	[[ -d ${ED}${PREFIX}/libexec/gcc ]] && \
1595
		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1643
		env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1596
1644
1597
	cd "${S}"
1645
	cd "${S}"
1598
	if is_crosscompile; then
1646
	if is_crosscompile; then
1599
		rm -rf "${D}"/usr/share/{man,info}
1647
		rm -rf "${ED}"/usr/share/{man,info}
1600
		rm -rf "${D}"${DATAPATH}/{man,info}
1648
		rm -rf "${ED}"${DATAPATH}/{man,info}
1601
	else
1649
	else
1602
		if tc_version_is_at_least 3.0 ; then
1650
		if tc_version_is_at_least 3.0 ; then
1603
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1651
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1604
			if [[ -d ${cxx_mandir} ]] ; then
1652
			if [[ -d ${cxx_mandir} ]] ; then
1605
				# clean bogus manpages #113902
1653
				# clean bogus manpages #113902
1606
				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1654
				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1607
				cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/
1655
				cp -r "${cxx_mandir}"/man? "${ED}/${DATAPATH}"/man/
1608
			fi
1656
			fi
1609
		fi
1657
		fi
1610
		has noinfo ${FEATURES} \
1658
		has noinfo ${FEATURES} \
1611
			&& rm -r "${D}/${DATAPATH}"/info \
1659
			&& rm -r "${ED}/${DATAPATH}"/info \
1612
			|| prepinfo "${DATAPATH}"
1660
			|| prepinfo "${DATAPATH}"
1613
		has noman ${FEATURES} \
1661
		has noman ${FEATURES} \
1614
			&& rm -r "${D}/${DATAPATH}"/man \
1662
			&& rm -r "${ED}/${DATAPATH}"/man \
1615
			|| prepman "${DATAPATH}"
1663
			|| prepman "${DATAPATH}"
1616
	fi
1664
	fi
1617
	# prune empty dirs left behind
1665
	# prune empty dirs left behind
1618
	find "${D}" -depth -type d -delete 2>/dev/null
1666
	find "${ED}" -depth -type d -delete 2>/dev/null
1619
1667
1620
	# install testsuite results
1668
	# install testsuite results
1621
	if use regression-test; then
1669
	if use regression-test; then
Lines 1628-1653 Link Here
1628
	# Rather install the script, else portage with changing $FILESDIR
1676
	# Rather install the script, else portage with changing $FILESDIR
1629
	# between binary and source package borks things ....
1677
	# between binary and source package borks things ....
1630
	if ! is_crosscompile ; then
1678
	if ! is_crosscompile ; then
1679
		cp "${GCC_FILESDIR}"/fix_libtool_files.sh "${T}"
1680
		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la "${T}"
1681
		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk "${T}"
1682
		eprefixify \
1683
			"${T}"/fix_libtool_files.sh \
1684
			"${T}"/fixlafiles.awk-no_gcc_la \
1685
			"${T}"/fixlafiles.awk
1686
1631
		insinto "${DATAPATH}"
1687
		insinto "${DATAPATH}"
1632
		if tc_version_is_at_least 4.0 ; then
1688
		if tc_version_is_at_least 4.0 ; then
1633
			newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1689
			newins "${T}"/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1634
			find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1690
			find "${ED}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1635
		else
1691
		else
1636
			doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1692
			doins "${T}"/fixlafiles.awk || die
1637
		fi
1693
		fi
1638
		exeinto "${DATAPATH}"
1694
		exeinto "${DATAPATH}"
1639
		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1695
		doexe "${T}"/fix_libtool_files.sh || die
1640
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1696
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1641
	fi
1697
	fi
1642
1698
1643
	# Use gid of 0 because some stupid ports don't have
1699
	# Use gid of 0 because some stupid ports don't have
1644
	# the group 'root' set to gid 0.  Send to /dev/null
1700
	# the group 'root' set to gid 0.  Send to /dev/null
1645
	# for people who are testing as non-root.
1701
	# for people who are testing as non-root.
1646
	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
1702
	chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${ED}"${LIBPATH} 2>/dev/null
1647
1703
1648
	# Move pretty-printers to gdb datadir to shut ldconfig up
1704
	# Move pretty-printers to gdb datadir to shut ldconfig up
1649
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1705
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1650
	pushd "${D}"${LIBPATH} >/dev/null
1706
	pushd "${ED}"${LIBPATH} >/dev/null
1651
	for py in $(find . -name '*-gdb.py') ; do
1707
	for py in $(find . -name '*-gdb.py') ; do
1652
		local multidir=${py%/*}
1708
		local multidir=${py%/*}
1653
		insinto "${gdbdir}/${multidir}"
1709
		insinto "${gdbdir}/${multidir}"
Lines 1663-1670 Link Here
1663
1719
1664
	# Disable RANDMMAP so PCH works. #301299
1720
	# Disable RANDMMAP so PCH works. #301299
1665
	if tc_version_is_at_least 4.3 ; then
1721
	if tc_version_is_at_least 4.3 ; then
1666
		pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
1722
		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"
1723
		pax-mark -r "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
1668
	fi
1724
	fi
1669
}
1725
}
1670
1726
Lines 1672-1703 Link Here
1672
	local x
1728
	local x
1673
1729
1674
	# Move Java headers to compiler-specific dir
1730
	# Move Java headers to compiler-specific dir
1675
	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
1731
	for x in "${ED}"${PREFIX}/include/gc*.h "${ED}"${PREFIX}/include/j*.h ; do
1676
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
1732
		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/include/
1677
	done
1733
	done
1678
	for x in gcj gnu java javax org ; do
1734
	for x in gcj gnu java javax org ; do
1679
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
1735
		if [[ -d ${ED}${PREFIX}/include/${x} ]] ; then
1680
			dodir /${LIBPATH}/include/${x}
1736
			dodir /${LIBPATH}/include/${x}
1681
			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
1737
			mv -f "${ED}"${PREFIX}/include/${x}/* "${ED}"${LIBPATH}/include/${x}/
1682
			rm -rf "${D}"${PREFIX}/include/${x}
1738
			rm -rf "${ED}"${PREFIX}/include/${x}
1683
		fi
1739
		fi
1684
	done
1740
	done
1685
1741
1686
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1742
	if [[ -d ${ED}${PREFIX}/lib/security ]] || [[ -d ${ED}${PREFIX}/$(get_libdir)/security ]] ; then
1687
		dodir /${LIBPATH}/security
1743
		dodir /${LIBPATH}/security
1688
		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
1744
		mv -f "${ED}"${PREFIX}/lib*/security/* "${ED}"${LIBPATH}/security
1689
		rm -rf "${D}"${PREFIX}/lib*/security
1745
		rm -rf "${ED}"${PREFIX}/lib*/security
1690
	fi
1746
	fi
1691
1747
1692
	# Move random gcj files to compiler-specific directories
1748
	# Move random gcj files to compiler-specific directories
1693
	for x in libgcj.spec logging.properties ; do
1749
	for x in libgcj.spec logging.properties ; do
1694
		x="${D}${PREFIX}/lib/${x}"
1750
		x="${ED}${PREFIX}/lib/${x}"
1695
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
1751
		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/
1696
	done
1752
	done
1697
1753
1698
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1754
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1699
	# primary compiler (aka don't have the -<version> extension)
1755
	# primary compiler (aka don't have the -<version> extension)
1700
	cd "${D}"${BINPATH}
1756
	cd "${ED}"${BINPATH}
1701
	[[ -f jar ]] && mv -f jar gcj-jar
1757
	[[ -f jar ]] && mv -f jar gcj-jar
1702
}
1758
}
1703
1759
Lines 1715-1721 Link Here
1715
1771
1716
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1772
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1717
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1773
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1718
		local TODIR=${D}${LIBPATH}/${MULTIDIR}
1774
		local TODIR=${ED}${LIBPATH}/${MULTIDIR}
1719
		local FROMDIR=
1775
		local FROMDIR=
1720
1776
1721
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1777
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
Lines 1727-1733 Link Here
1727
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1783
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1728
		do
1784
		do
1729
			removedirs="${removedirs} ${FROMDIR}"
1785
			removedirs="${removedirs} ${FROMDIR}"
1730
			FROMDIR=${D}${FROMDIR}
1786
			FROMDIR=${ED}${FROMDIR}
1731
			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1787
			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1732
				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1788
				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1733
				if [[ -n ${files} ]] ; then
1789
				if [[ -n ${files} ]] ; then
Lines 1739-1748 Link Here
1739
1795
1740
		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1796
		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1741
		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
1797
		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
1742
		for x in "${D}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
1798
		for x in "${ED}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
1743
			[[ -f ${x} ]] || continue
1799
			[[ -f ${x} ]] || continue
1744
			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
1800
			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
1745
			mv "${x}" "${D}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
1801
			mv "${x}" "${ED}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
1746
		done
1802
		done
1747
	done
1803
	done
1748
1804
Lines 1751-1759 Link Here
1751
	#	rmdir SRC/lib/../lib/
1807
	#	rmdir SRC/lib/../lib/
1752
	#	mv SRC/lib/../lib32/*.o DEST  # Bork
1808
	#	mv SRC/lib/../lib32/*.o DEST  # Bork
1753
	for FROMDIR in ${removedirs} ; do
1809
	for FROMDIR in ${removedirs} ; do
1754
		rmdir "${D}"${FROMDIR} >& /dev/null
1810
		rmdir "${ED}"${FROMDIR} >& /dev/null
1755
	done
1811
	done
1756
	find "${D}" -type d | xargs rmdir >& /dev/null
1812
	find "${ED}" -type d | xargs rmdir >& /dev/null
1757
}
1813
}
1758
#----<< src_* >>----
1814
#----<< src_* >>----
1759
1815
Lines 1876-1887 Link Here
1876
	# if the current config is invalid, we definitely want a new one
1932
	# 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
1933
	# Note: due to bash quirkiness, the following must not be 1 line
1878
	local curr_config
1934
	local curr_config
1879
	curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
1935
	curr_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>&1) || return 0
1880
1936
1881
	# if the previously selected config has the same major.minor (branch) as
1937
	# if the previously selected config has the same major.minor (branch) as
1882
	# the version we are installing, then it will probably be uninstalled
1938
	# the version we are installing, then it will probably be uninstalled
1883
	# for being in the same SLOT, make sure we run gcc-config.
1939
	# 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}')
1940
	local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
1885
1941
1886
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
1942
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
1887
1943
Lines 1916-1935 Link Here
1916
1972
1917
do_gcc_config() {
1973
do_gcc_config() {
1918
	if ! should_we_gcc_config ; then
1974
	if ! should_we_gcc_config ; then
1919
		env -i ROOT="${ROOT}" gcc-config --use-old --force
1975
		env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config --use-old --force
1920
		return 0
1976
		return 0
1921
	fi
1977
	fi
1922
1978
1923
	local current_gcc_config="" current_specs="" use_specs=""
1979
	local current_gcc_config="" current_specs="" use_specs=""
1924
1980
1925
	current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
1981
	current_gcc_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>/dev/null)
1926
	if [[ -n ${current_gcc_config} ]] ; then
1982
	if [[ -n ${current_gcc_config} ]] ; then
1927
		# figure out which specs-specific config is active
1983
		# figure out which specs-specific config is active
1928
		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
1984
		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
1929
		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
1985
		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
1930
	fi
1986
	fi
1931
	if [[ -n ${use_specs} ]] && \
1987
	if [[ -n ${use_specs} ]] && \
1932
	   [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
1988
	   [[ ! -e ${EROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
1933
	then
1989
	then
1934
		ewarn "The currently selected specs-specific gcc config,"
1990
		ewarn "The currently selected specs-specific gcc config,"
1935
		ewarn "${current_specs}, doesn't exist anymore. This is usually"
1991
		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
2071
# -are-, and not where they -used- to be.  also, any dependencies we have
2016
# on our own .la files need to be updated.
2072
# on our own .la files need to be updated.
2017
fix_libtool_libdir_paths() {
2073
fix_libtool_libdir_paths() {
2018
	pushd "${D}" >/dev/null
2074
	pushd "${ED}" >/dev/null
2019
2075
2020
	pushd "./${1}" >/dev/null
2076
	pushd "./${1}" >/dev/null
2021
	local dir="${PWD#${D%/}}"
2077
	local dir="${PWD#${D%/}}"
Lines 2024-2033 Link Here
2024
	popd >/dev/null
2080
	popd >/dev/null
2025
2081
2026
	sed -i \
2082
	sed -i \
2027
		-e "/^libdir=/s:=.*:='${dir}':" \
2083
		-e "/^libdir=/s:=.*:='${EPREFIX}/${dir##/}':" \
2028
		./${dir}/*.la
2084
		./${dir}/*.la
2029
	sed -i \
2085
	sed -i \
2030
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
2086
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${EPREFIX}/${LIBPATH##/}/\1:g" \
2031
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
2087
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
2032
		./${dir}/*.la
2088
		./${dir}/*.la
2033
2089

Return to bug 474358