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 (-83 / +113 lines)
Lines 10-16 Link Here
10
LICENSE="GPL-2 LGPL-2.1"
10
LICENSE="GPL-2 LGPL-2.1"
11
RESTRICT="strip" # cross-compilers need controlled stripping
11
RESTRICT="strip" # cross-compilers need controlled stripping
12
12
13
inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails pax-utils
13
inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails pax-utils prefix
14
14
15
if [[ ${PV} == *_pre9999* ]] ; then
15
if [[ ${PV} == *_pre9999* ]] ; then
16
	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
16
	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
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
	local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
572
	if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${EPREFIX} != ${realEPREFIX} ]] ; then
573
		ewarn "Your \${EPREFIX} contains one or more symlinks.  GCC has a"
574
		ewarn "bug which prevents it from working properly when there are"
575
		ewarn "symlinks in your \${EPREFIX}."
576
		ewarn "See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29831"
577
	fi
578
571
	# we dont want to use the installed compiler's specs to build gcc!
579
	# we dont want to use the installed compiler's specs to build gcc!
572
	unset GCC_SPECS
580
	unset GCC_SPECS
573
581
Lines 596-611 Link Here
596
		echo
604
		echo
597
605
598
		# Clean up old paths
606
		# Clean up old paths
599
		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
607
		rm -f "${EROOT}"/*/rcscripts/awk/fixlafiles.awk "${EROOT}"/sbin/fix_libtool_files.sh
600
		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
608
		rmdir "${EROOT}"/*/rcscripts{/awk,} 2>/dev/null
601
609
602
		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
610
		mkdir -p "${EROOT}"/usr/{share/gcc-data,sbin,bin}
603
		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
611
		cp "${EROOT}/${DATAPATH}"/fixlafiles.awk "${EROOT}"/usr/share/gcc-data/ || die
604
		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
612
		cp "${EROOT}/${DATAPATH}"/fix_libtool_files.sh "${EROOT}"/usr/sbin/ || die
605
613
606
		# Since these aren't critical files and portage sucks with
614
		# Since these aren't critical files and portage sucks with
607
		# handling of binpkgs, don't require these to be found
615
		# handling of binpkgs, don't require these to be found
608
		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
616
		cp "${EROOT}/${DATAPATH}"/c{89,99} "${EROOT}"/usr/bin/ 2>/dev/null
609
	fi
617
	fi
610
618
611
	if use regression-test ; then
619
	if use regression-test ; then
Lines 622-631 Link Here
622
630
623
	# clean up the cruft left behind by cross-compilers
631
	# clean up the cruft left behind by cross-compilers
624
	if is_crosscompile ; then
632
	if is_crosscompile ; then
625
		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
633
		if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
626
			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
634
			rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
627
			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
635
			rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
628
			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
636
			rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
629
		fi
637
		fi
630
		return 0
638
		return 0
631
	fi
639
	fi
Lines 633-647 Link Here
633
	# ROOT isnt handled by the script
641
	# ROOT isnt handled by the script
634
	[[ ${ROOT} != "/" ]] && return 0
642
	[[ ${ROOT} != "/" ]] && return 0
635
643
636
	if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
644
	if [[ ! -e ${EPREFIX}${LIBPATH}/libstdc++.so ]] ; then
637
		# make sure the profile is sane during same-slot upgrade #289403
645
		# make sure the profile is sane during same-slot upgrade #289403
638
		do_gcc_config
646
		do_gcc_config
639
647
640
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
648
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
641
		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
649
		"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
642
		if [[ -n ${BRANCH_UPDATE} ]] ; then
650
		if [[ -n ${BRANCH_UPDATE} ]] ; then
643
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
651
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
644
			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
652
			"${EPREFIX}"/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
645
		fi
653
		fi
646
	fi
654
	fi
647
655
Lines 1050-1063 Link Here
1050
1058
1051
gcc_do_configure() {
1059
gcc_do_configure() {
1052
	local confgcc=(
1060
	local confgcc=(
1053
		# Set configuration based on path variables
1061
		--prefix="${EPREFIX}${PREFIX}"
1054
		--prefix="${PREFIX}"
1062
		--bindir="${EPREFIX}${BINPATH}"
1055
		--bindir="${BINPATH}"
1063
		--includedir="${EPREFIX}${INCLUDEPATH}"
1056
		--includedir="${INCLUDEPATH}"
1064
		--datadir="${EPREFIX}${DATAPATH}"
1057
		--datadir="${DATAPATH}"
1065
		--mandir="${EPREFIX}${DATAPATH}/man"
1058
		--mandir="${DATAPATH}/man"
1066
		--infodir="${EPREFIX}${DATAPATH}/info"
1059
		--infodir="${DATAPATH}/info"
1067
		--with-gxx-include-dir="${EPREFIX}${STDCXX_INCDIR}"
1060
		--with-gxx-include-dir="${STDCXX_INCDIR}"
1061
	)
1068
	)
1062
	# On Darwin we need libdir to be set in order to get correct install names
1069
	# 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
1070
	# 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
1102
	elif tc_version_is_at_least 4.6 ; then
1096
		confgcc+=( $(use_with graphite cloog) )
1103
		confgcc+=( $(use_with graphite cloog) )
1097
		confgcc+=( $(use_with graphite ppl) )
1104
		confgcc+=( $(use_with graphite ppl) )
1098
		use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl )
1105
		use graphite && confgcc+=( --with-cloog-include="${EPREFIX}"/usr/include/cloog-ppl )
1099
		use graphite && confgcc+=( --disable-ppl-version-check )
1106
		use graphite && confgcc+=( --disable-ppl-version-check )
1100
	elif tc_version_is_at_least 4.4 ; then
1107
	elif tc_version_is_at_least 4.4 ; then
1101
		confgcc+=( --without-cloog )
1108
		confgcc+=( --without-cloog )
Lines 1162-1167 Link Here
1162
		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
1169
		*-w64-mingw*)	 needed_libc=mingw64-runtime;;
1163
		mingw*|*-mingw*) needed_libc=mingw-runtime;;
1170
		mingw*|*-mingw*) needed_libc=mingw-runtime;;
1164
		avr)			 confgcc+=( --enable-shared --disable-threads );;
1171
		avr)			 confgcc+=( --enable-shared --disable-threads );;
1172
		*-apple-darwin*) confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1173
		*-solaris*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1174
		*-freebsd*)      confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} );;
1165
		esac
1175
		esac
1166
		if [[ -n ${needed_libc} ]] ; then
1176
		if [[ -n ${needed_libc} ]] ; then
1167
			local confgcc_no_libc=( --disable-shared )
1177
			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
1185
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
1176
				confgcc+=(
1186
				confgcc+=(
1177
					"${confgcc_no_libc[@]}"
1187
					"${confgcc_no_libc[@]}"
1178
					--with-sysroot=${PREFIX}/${CTARGET}
1188
					--with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET}
1179
				)
1189
				)
1180
			else
1190
			else
1181
				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
1191
				confgcc+=( --with-sysroot="${EPREFIX}"${PREFIX}/${CTARGET} )
1182
			fi
1192
			fi
1183
		fi
1193
		fi
1184
1194
Lines 1195-1200 Link Here
1195
		*)
1205
		*)
1196
			confgcc+=( --enable-threads=posix ) ;;
1206
			confgcc+=( --enable-threads=posix ) ;;
1197
		esac
1207
		esac
1208
1209
		if use prefix ; then
1210
			# should be /usr, because it's the path to search includes for,
1211
			# which is unrelated to TOOLCHAIN_PREFIX, a.k.a. PREFIX
1212
			confgcc+=( --with-local-prefix="${TPREFIX}"/usr )
1213
		fi
1198
	fi
1214
	fi
1199
	# __cxa_atexit is "essential for fully standards-compliant handling of
1215
	# __cxa_atexit is "essential for fully standards-compliant handling of
1200
	# destructors", but apparently requires glibc.
1216
	# destructors", but apparently requires glibc.
Lines 1231-1241 Link Here
1231
	# if the target can do biarch (-m32/-m64), enable it.  overhead should
1247
	# 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
1248
	# be small, and should simplify building of 64bit kernels in a 32bit
1233
	# userland by not needing sys-devel/kgcc64.  #349405
1249
	# userland by not needing sys-devel/kgcc64.  #349405
1250
	if ! use prefix ; then
1234
	case $(tc-arch) in
1251
	case $(tc-arch) in
1235
	ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
1252
	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 ) ;;
1253
	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 ) ;;
1254
	amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
1238
	esac
1255
	esac
1256
	fi
1239
1257
1240
	tc_version_is_at_least 4.3 && confgcc+=(
1258
	tc_version_is_at_least 4.3 && confgcc+=(
1241
		--with-bugurl=http://bugs.gentoo.org/
1259
		--with-bugurl=http://bugs.gentoo.org/
Lines 1259-1264 Link Here
1259
1277
1260
	# Nothing wrong with a good dose of verbosity
1278
	# Nothing wrong with a good dose of verbosity
1261
	echo
1279
	echo
1280
	einfo "EPREFIX:			${EPREFIX}"
1262
	einfo "PREFIX:			${PREFIX}"
1281
	einfo "PREFIX:			${PREFIX}"
1263
	einfo "BINPATH:			${BINPATH}"
1282
	einfo "BINPATH:			${BINPATH}"
1264
	einfo "LIBPATH:			${LIBPATH}"
1283
	einfo "LIBPATH:			${LIBPATH}"
Lines 1353-1362 Link Here
1353
1372
1354
	pushd "${WORKDIR}"/build >/dev/null
1373
	pushd "${WORKDIR}"/build >/dev/null
1355
1374
1375
	# we "undef" T because the GCC makefiles use this variable, and if it's set
1376
	# in the environment (like Portage does) the build fails, bug #286494
1356
	emake \
1377
	emake \
1378
		T= \
1357
		LDFLAGS="${LDFLAGS}" \
1379
		LDFLAGS="${LDFLAGS}" \
1358
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1380
		STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1359
		LIBPATH="${LIBPATH}" \
1381
		LIBPATH="${EPREFIX}${LIBPATH}" \
1360
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1382
		BOOT_CFLAGS="${BOOT_CFLAGS}" \
1361
		${GCC_MAKE_TARGET} \
1383
		${GCC_MAKE_TARGET} \
1362
		|| die "emake failed with ${GCC_MAKE_TARGET}"
1384
		|| die "emake failed with ${GCC_MAKE_TARGET}"
Lines 1494-1500 Link Here
1494
	touch "${S}"/gcc/c-gperf.h
1516
	touch "${S}"/gcc/c-gperf.h
1495
1517
1496
	# Do not make manpages if we do not have perl ...
1518
	# Do not make manpages if we do not have perl ...
1497
	[[ ! -x /usr/bin/perl ]] \
1519
	[[ ! -x ${EPREFIX}/usr/bin/perl ]] \
1498
		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1520
		&& find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1499
1521
1500
	einfo "Compiling ${PN} ..."
1522
	einfo "Compiling ${PN} ..."
Lines 1537-1545 Link Here
1537
	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
1559
	S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
1538
1560
1539
	# Punt some tools which are really only useful while building gcc
1561
	# Punt some tools which are really only useful while building gcc
1540
	find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1562
	find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
1541
	# This one comes with binutils
1563
	# This one comes with binutils
1542
	find "${D}" -name libiberty.a -delete
1564
	find "${ED}" -name libiberty.a -delete
1543
1565
1544
	# Move the libraries to the proper location
1566
	# Move the libraries to the proper location
1545
	gcc_movelibs
1567
	gcc_movelibs
Lines 1548-1554 Link Here
1548
	if ! is_crosscompile ; then
1570
	if ! is_crosscompile ; then
1549
		local EXEEXT
1571
		local EXEEXT
1550
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1572
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1551
		[[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}"
1573
		[[ -r ${ED}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
1552
	fi
1574
	fi
1553
1575
1554
	dodir /etc/env.d/gcc
1576
	dodir /etc/env.d/gcc
Lines 1562-1568 Link Here
1562
	gcc_slot_java
1584
	gcc_slot_java
1563
1585
1564
	dodir /usr/bin
1586
	dodir /usr/bin
1565
	cd "${D}"${BINPATH}
1587
	cd "${ED}"${BINPATH}
1566
	# Ugh: we really need to auto-detect this list.
1588
	# Ugh: we really need to auto-detect this list.
1567
	#      It's constantly out of date.
1589
	#      It's constantly out of date.
1568
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
1590
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
Lines 1588-1621 Link Here
1588
	done
1610
	done
1589
1611
1590
	# Now do the fun stripping stuff
1612
	# Now do the fun stripping stuff
1591
	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1613
	env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${BINPATH}"
1592
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1614
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${ED}${LIBPATH}"
1593
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1615
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1594
	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
1616
	[[ -d ${ED}${PREFIX}/libexec/gcc ]] && \
1595
		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1617
		env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
1596
1618
1597
	cd "${S}"
1619
	cd "${S}"
1598
	if is_crosscompile; then
1620
	if is_crosscompile; then
1599
		rm -rf "${D}"/usr/share/{man,info}
1621
		rm -rf "${ED}"/usr/share/{man,info}
1600
		rm -rf "${D}"${DATAPATH}/{man,info}
1622
		rm -rf "${ED}"${DATAPATH}/{man,info}
1601
	else
1623
	else
1602
		if tc_version_is_at_least 3.0 ; then
1624
		if tc_version_is_at_least 3.0 ; then
1603
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1625
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1604
			if [[ -d ${cxx_mandir} ]] ; then
1626
			if [[ -d ${cxx_mandir} ]] ; then
1605
				# clean bogus manpages #113902
1627
				# clean bogus manpages #113902
1606
				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1628
				find "${cxx_mandir}" -name '*_build_*' -exec rm {} \;
1607
				cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/
1629
				cp -r "${cxx_mandir}"/man? "${ED}/${DATAPATH}"/man/
1608
			fi
1630
			fi
1609
		fi
1631
		fi
1610
		has noinfo ${FEATURES} \
1632
		has noinfo ${FEATURES} \
1611
			&& rm -r "${D}/${DATAPATH}"/info \
1633
			&& rm -r "${ED}/${DATAPATH}"/info \
1612
			|| prepinfo "${DATAPATH}"
1634
			|| prepinfo "${DATAPATH}"
1613
		has noman ${FEATURES} \
1635
		has noman ${FEATURES} \
1614
			&& rm -r "${D}/${DATAPATH}"/man \
1636
			&& rm -r "${ED}/${DATAPATH}"/man \
1615
			|| prepman "${DATAPATH}"
1637
			|| prepman "${DATAPATH}"
1616
	fi
1638
	fi
1617
	# prune empty dirs left behind
1639
	# prune empty dirs left behind
1618
	find "${D}" -depth -type d -delete 2>/dev/null
1640
	find "${ED}" -depth -type d -delete 2>/dev/null
1619
1641
1620
	# install testsuite results
1642
	# install testsuite results
1621
	if use regression-test; then
1643
	if use regression-test; then
Lines 1628-1653 Link Here
1628
	# Rather install the script, else portage with changing $FILESDIR
1650
	# Rather install the script, else portage with changing $FILESDIR
1629
	# between binary and source package borks things ....
1651
	# between binary and source package borks things ....
1630
	if ! is_crosscompile ; then
1652
	if ! is_crosscompile ; then
1653
		cp "${GCC_FILESDIR}"/fix_libtool_files.sh "${T}"
1654
		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la "${T}"
1655
		cp "${GCC_FILESDIR}"/awk/fixlafiles.awk "${T}"
1656
		eprefixify \
1657
			"${T}"/fix_libtool_files.sh \
1658
			"${T}"/fixlafiles.awk-no_gcc_la \
1659
			"${T}"/fixlafiles.awk
1660
1631
		insinto "${DATAPATH}"
1661
		insinto "${DATAPATH}"
1632
		if tc_version_is_at_least 4.0 ; then
1662
		if tc_version_is_at_least 4.0 ; then
1633
			newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1663
			newins "${T}"/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1634
			find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1664
			find "${ED}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1635
		else
1665
		else
1636
			doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1666
			doins "${T}"/fixlafiles.awk || die
1637
		fi
1667
		fi
1638
		exeinto "${DATAPATH}"
1668
		exeinto "${DATAPATH}"
1639
		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1669
		doexe "${T}"/fix_libtool_files.sh || die
1640
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1670
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1641
	fi
1671
	fi
1642
1672
1643
	# Use gid of 0 because some stupid ports don't have
1673
	# Use gid of 0 because some stupid ports don't have
1644
	# the group 'root' set to gid 0.  Send to /dev/null
1674
	# the group 'root' set to gid 0.  Send to /dev/null
1645
	# for people who are testing as non-root.
1675
	# for people who are testing as non-root.
1646
	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
1676
	chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${ED}"${LIBPATH} 2>/dev/null
1647
1677
1648
	# Move pretty-printers to gdb datadir to shut ldconfig up
1678
	# Move pretty-printers to gdb datadir to shut ldconfig up
1649
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1679
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1650
	pushd "${D}"${LIBPATH} >/dev/null
1680
	pushd "${ED}"${LIBPATH} >/dev/null
1651
	for py in $(find . -name '*-gdb.py') ; do
1681
	for py in $(find . -name '*-gdb.py') ; do
1652
		local multidir=${py%/*}
1682
		local multidir=${py%/*}
1653
		insinto "${gdbdir}/${multidir}"
1683
		insinto "${gdbdir}/${multidir}"
Lines 1663-1670 Link Here
1663
1693
1664
	# Disable RANDMMAP so PCH works. #301299
1694
	# Disable RANDMMAP so PCH works. #301299
1665
	if tc_version_is_at_least 4.3 ; then
1695
	if tc_version_is_at_least 4.3 ; then
1666
		pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
1696
		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"
1697
		pax-mark -r "${ED}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
1668
	fi
1698
	fi
1669
}
1699
}
1670
1700
Lines 1672-1703 Link Here
1672
	local x
1702
	local x
1673
1703
1674
	# Move Java headers to compiler-specific dir
1704
	# Move Java headers to compiler-specific dir
1675
	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
1705
	for x in "${ED}"${PREFIX}/include/gc*.h "${ED}"${PREFIX}/include/j*.h ; do
1676
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
1706
		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/include/
1677
	done
1707
	done
1678
	for x in gcj gnu java javax org ; do
1708
	for x in gcj gnu java javax org ; do
1679
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
1709
		if [[ -d ${ED}${PREFIX}/include/${x} ]] ; then
1680
			dodir /${LIBPATH}/include/${x}
1710
			dodir /${LIBPATH}/include/${x}
1681
			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
1711
			mv -f "${ED}"${PREFIX}/include/${x}/* "${ED}"${LIBPATH}/include/${x}/
1682
			rm -rf "${D}"${PREFIX}/include/${x}
1712
			rm -rf "${ED}"${PREFIX}/include/${x}
1683
		fi
1713
		fi
1684
	done
1714
	done
1685
1715
1686
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1716
	if [[ -d ${ED}${PREFIX}/lib/security ]] || [[ -d ${ED}${PREFIX}/$(get_libdir)/security ]] ; then
1687
		dodir /${LIBPATH}/security
1717
		dodir /${LIBPATH}/security
1688
		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
1718
		mv -f "${ED}"${PREFIX}/lib*/security/* "${ED}"${LIBPATH}/security
1689
		rm -rf "${D}"${PREFIX}/lib*/security
1719
		rm -rf "${ED}"${PREFIX}/lib*/security
1690
	fi
1720
	fi
1691
1721
1692
	# Move random gcj files to compiler-specific directories
1722
	# Move random gcj files to compiler-specific directories
1693
	for x in libgcj.spec logging.properties ; do
1723
	for x in libgcj.spec logging.properties ; do
1694
		x="${D}${PREFIX}/lib/${x}"
1724
		x="${ED}${PREFIX}/lib/${x}"
1695
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
1725
		[[ -f ${x} ]] && mv -f "${x}" "${ED}"${LIBPATH}/
1696
	done
1726
	done
1697
1727
1698
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1728
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1699
	# primary compiler (aka don't have the -<version> extension)
1729
	# primary compiler (aka don't have the -<version> extension)
1700
	cd "${D}"${BINPATH}
1730
	cd "${ED}"${BINPATH}
1701
	[[ -f jar ]] && mv -f jar gcj-jar
1731
	[[ -f jar ]] && mv -f jar gcj-jar
1702
}
1732
}
1703
1733
Lines 1715-1721 Link Here
1715
1745
1716
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1746
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1717
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1747
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1718
		local TODIR=${D}${LIBPATH}/${MULTIDIR}
1748
		local TODIR=${ED}${LIBPATH}/${MULTIDIR}
1719
		local FROMDIR=
1749
		local FROMDIR=
1720
1750
1721
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1751
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
Lines 1727-1733 Link Here
1727
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1757
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1728
		do
1758
		do
1729
			removedirs="${removedirs} ${FROMDIR}"
1759
			removedirs="${removedirs} ${FROMDIR}"
1730
			FROMDIR=${D}${FROMDIR}
1760
			FROMDIR=${ED}${FROMDIR}
1731
			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1761
			if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1732
				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1762
				local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1733
				if [[ -n ${files} ]] ; then
1763
				if [[ -n ${files} ]] ; then
Lines 1739-1748 Link Here
1739
1769
1740
		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1770
		# SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1741
		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
1771
		FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
1742
		for x in "${D}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
1772
		for x in "${ED}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
1743
			[[ -f ${x} ]] || continue
1773
			[[ -f ${x} ]] || continue
1744
			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
1774
			sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}"
1745
			mv "${x}" "${D}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
1775
			mv "${x}" "${ED}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
1746
		done
1776
		done
1747
	done
1777
	done
1748
1778
Lines 1751-1759 Link Here
1751
	#	rmdir SRC/lib/../lib/
1781
	#	rmdir SRC/lib/../lib/
1752
	#	mv SRC/lib/../lib32/*.o DEST  # Bork
1782
	#	mv SRC/lib/../lib32/*.o DEST  # Bork
1753
	for FROMDIR in ${removedirs} ; do
1783
	for FROMDIR in ${removedirs} ; do
1754
		rmdir "${D}"${FROMDIR} >& /dev/null
1784
		rmdir "${ED}"${FROMDIR} >& /dev/null
1755
	done
1785
	done
1756
	find "${D}" -type d | xargs rmdir >& /dev/null
1786
	find "${ED}" -type d | xargs rmdir >& /dev/null
1757
}
1787
}
1758
#----<< src_* >>----
1788
#----<< src_* >>----
1759
1789
Lines 1876-1887 Link Here
1876
	# if the current config is invalid, we definitely want a new one
1906
	# 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
1907
	# Note: due to bash quirkiness, the following must not be 1 line
1878
	local curr_config
1908
	local curr_config
1879
	curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
1909
	curr_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>&1) || return 0
1880
1910
1881
	# if the previously selected config has the same major.minor (branch) as
1911
	# if the previously selected config has the same major.minor (branch) as
1882
	# the version we are installing, then it will probably be uninstalled
1912
	# the version we are installing, then it will probably be uninstalled
1883
	# for being in the same SLOT, make sure we run gcc-config.
1913
	# 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}')
1914
	local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
1885
1915
1886
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
1916
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
1887
1917
Lines 1916-1935 Link Here
1916
1946
1917
do_gcc_config() {
1947
do_gcc_config() {
1918
	if ! should_we_gcc_config ; then
1948
	if ! should_we_gcc_config ; then
1919
		env -i ROOT="${ROOT}" gcc-config --use-old --force
1949
		env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config --use-old --force
1920
		return 0
1950
		return 0
1921
	fi
1951
	fi
1922
1952
1923
	local current_gcc_config="" current_specs="" use_specs=""
1953
	local current_gcc_config="" current_specs="" use_specs=""
1924
1954
1925
	current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
1955
	current_gcc_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>/dev/null)
1926
	if [[ -n ${current_gcc_config} ]] ; then
1956
	if [[ -n ${current_gcc_config} ]] ; then
1927
		# figure out which specs-specific config is active
1957
		# figure out which specs-specific config is active
1928
		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
1958
		current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
1929
		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
1959
		[[ -n ${current_specs} ]] && use_specs=-${current_specs}
1930
	fi
1960
	fi
1931
	if [[ -n ${use_specs} ]] && \
1961
	if [[ -n ${use_specs} ]] && \
1932
	   [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
1962
	   [[ ! -e ${EROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
1933
	then
1963
	then
1934
		ewarn "The currently selected specs-specific gcc config,"
1964
		ewarn "The currently selected specs-specific gcc config,"
1935
		ewarn "${current_specs}, doesn't exist anymore. This is usually"
1965
		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
2045
# -are-, and not where they -used- to be.  also, any dependencies we have
2016
# on our own .la files need to be updated.
2046
# on our own .la files need to be updated.
2017
fix_libtool_libdir_paths() {
2047
fix_libtool_libdir_paths() {
2018
	pushd "${D}" >/dev/null
2048
	pushd "${ED}" >/dev/null
2019
2049
2020
	pushd "./${1}" >/dev/null
2050
	pushd "./${1}" >/dev/null
2021
	local dir="${PWD#${D%/}}"
2051
	local dir="${PWD#${D%/}}"
Lines 2024-2033 Link Here
2024
	popd >/dev/null
2054
	popd >/dev/null
2025
2055
2026
	sed -i \
2056
	sed -i \
2027
		-e "/^libdir=/s:=.*:='${dir}':" \
2057
		-e "/^libdir=/s:=.*:='${EPREFIX}/${dir##/}':" \
2028
		./${dir}/*.la
2058
		./${dir}/*.la
2029
	sed -i \
2059
	sed -i \
2030
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
2060
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${EPREFIX}/${LIBPATH##/}/\1:g" \
2031
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
2061
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
2032
		./${dir}/*.la
2062
		./${dir}/*.la
2033
2063

Return to bug 474358