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

Collapse All | Expand All

(-)a/eclass/toolchain.eclass (-55 / +61 lines)
Lines 8-14 DESCRIPTION="The GNU Compiler Collection" Link Here
8
HOMEPAGE="https://gcc.gnu.org/"
8
HOMEPAGE="https://gcc.gnu.org/"
9
RESTRICT="strip" # cross-compilers need controlled stripping
9
RESTRICT="strip" # cross-compilers need controlled stripping
10
10
11
inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator
11
inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix
12
12
13
if [[ ${PV} == *_pre9999* ]] ; then
13
if [[ ${PV} == *_pre9999* ]] ; then
14
	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
14
	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
Lines 49-54 is_crosscompile() { Link Here
49
	[[ ${CHOST} != ${CTARGET} ]]
49
	[[ ${CHOST} != ${CTARGET} ]]
50
}
50
}
51
51
52
if [[ ${EAPI:-0} == [012] ]] ; then
53
		: ${ED:=${D}}
54
		: ${EROOT:=${ROOT}}
55
fi
56
52
# General purpose version check.  Without a second arg matches up to minor version (x.x.x)
57
# General purpose version check.  Without a second arg matches up to minor version (x.x.x)
53
tc_version_is_at_least() {
58
tc_version_is_at_least() {
54
	version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
59
	version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
Lines 93-99 fi Link Here
93
98
94
export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
99
export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
95
100
96
PREFIX=${TOOLCHAIN_PREFIX:-/usr}
101
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
97
102
98
if tc_version_is_at_least 3.4.0 ; then
103
if tc_version_is_at_least 3.4.0 ; then
99
	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
104
	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
Lines 983-992 toolchain_src_configure() { Link Here
983
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
988
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
984
				confgcc+=(
989
				confgcc+=(
985
					"${confgcc_no_libc[@]}"
990
					"${confgcc_no_libc[@]}"
986
					--with-sysroot=${PREFIX}/${CTARGET}
991
					--with-sysroot="${PREFIX}"/${CTARGET}
987
				)
992
				)
988
			else
993
			else
989
				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
994
				confgcc+=( --with-sysroot="${PREFIX}"/${CTARGET} )
990
			fi
995
			fi
991
		fi
996
		fi
992
997
Lines 1073-1079 toolchain_src_configure() { Link Here
1073
		[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
1078
		[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
1074
		# See if this is a valid --with-arch flag
1079
		# See if this is a valid --with-arch flag
1075
		if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
1080
		if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
1076
		    . "${srcdir}"/config.gcc) &>/dev/null
1081
			. "${srcdir}"/config.gcc) &>/dev/null
1077
		then
1082
		then
1078
			confgcc+=( --with-arch=${arm_arch} )
1083
			confgcc+=( --with-arch=${arm_arch} )
1079
		fi
1084
		fi
Lines 1267-1273 toolchain_src_configure() { Link Here
1267
	echo "${S}"/configure "${confgcc[@]}"
1272
	echo "${S}"/configure "${confgcc[@]}"
1268
	# Older gcc versions did not detect bash and re-exec itself, so force the
1273
	# Older gcc versions did not detect bash and re-exec itself, so force the
1269
	# use of bash.  Newer ones will auto-detect, but this is not harmeful.
1274
	# use of bash.  Newer ones will auto-detect, but this is not harmeful.
1270
	CONFIG_SHELL="/bin/bash" \
1275
	CONFIG_SHELL="${EPREFIX}/bin/bash" \
1271
	bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
1276
	bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
1272
1277
1273
	# return to whatever directory we were in before
1278
	# return to whatever directory we were in before
Lines 1703-1713 toolchain_src_install() { Link Here
1703
		if [[ -f ${CTARGET}-${x} ]] ; then
1708
		if [[ -f ${CTARGET}-${x} ]] ; then
1704
			if ! is_crosscompile ; then
1709
			if ! is_crosscompile ; then
1705
				ln -sf ${CTARGET}-${x} ${x}
1710
				ln -sf ${CTARGET}-${x} ${x}
1706
				dosym ${BINPATH}/${CTARGET}-${x} \
1711
				dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
1707
					/usr/bin/${x}-${GCC_CONFIG_VER}
1712
					/usr/bin/${x}-${GCC_CONFIG_VER}
1708
			fi
1713
			fi
1709
			# Create versioned symlinks
1714
			# Create versioned symlinks
1710
			dosym ${BINPATH}/${CTARGET}-${x} \
1715
			dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
1711
				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
1716
				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
1712
		fi
1717
		fi
1713
1718
Lines 1727-1733 toolchain_src_install() { Link Here
1727
	# Now do the fun stripping stuff
1732
	# Now do the fun stripping stuff
1728
	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1733
	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
1729
	is_crosscompile && \
1734
	is_crosscompile && \
1730
		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}/${HOSTLIBPATH}"
1735
		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}"
1731
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1736
	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
1732
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1737
	# gcc used to install helper binaries in lib/ but then moved to libexec/
1733
	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
1738
	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
Lines 1735-1741 toolchain_src_install() { Link Here
1735
1740
1736
	cd "${S}"
1741
	cd "${S}"
1737
	if is_crosscompile; then
1742
	if is_crosscompile; then
1738
		rm -rf "${D}"/usr/share/{man,info}
1743
		rm -rf "${ED}"usr/share/{man,info}
1739
		rm -rf "${D}"${DATAPATH}/{man,info}
1744
		rm -rf "${D}"${DATAPATH}/{man,info}
1740
	else
1745
	else
1741
		if tc_version_is_at_least 3.0 ; then
1746
		if tc_version_is_at_least 3.0 ; then
Lines 1745-1755 toolchain_src_install() { Link Here
1745
			fi
1750
			fi
1746
		fi
1751
		fi
1747
		has noinfo ${FEATURES} \
1752
		has noinfo ${FEATURES} \
1748
			&& rm -r "${D}/${DATAPATH}"/info \
1753
			&& rm -r "${D}${DATAPATH}"/info \
1749
			|| prepinfo "${DATAPATH}"
1754
			|| prepinfo "${DATAPATH#${EPREFIX}}"
1750
		has noman ${FEATURES} \
1755
		has noman ${FEATURES} \
1751
			&& rm -r "${D}/${DATAPATH}"/man \
1756
			&& rm -r "${D}${DATAPATH}"/man \
1752
			|| prepman "${DATAPATH}"
1757
			|| prepman "${DATAPATH#${EPREFIX}}"
1753
	fi
1758
	fi
1754
	# prune empty dirs left behind
1759
	# prune empty dirs left behind
1755
	find "${D}" -depth -type d -delete 2>/dev/null
1760
	find "${D}" -depth -type d -delete 2>/dev/null
Lines 1764-1773 toolchain_src_install() { Link Here
1764
	# Rather install the script, else portage with changing $FILESDIR
1769
	# Rather install the script, else portage with changing $FILESDIR
1765
	# between binary and source package borks things ....
1770
	# between binary and source package borks things ....
1766
	if ! is_crosscompile ; then
1771
	if ! is_crosscompile ; then
1767
		insinto "${DATAPATH}"
1772
		insinto "${DATAPATH#${EPREFIX}}"
1768
		newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1773
		newins "$(prefixify_ro "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
1769
		exeinto "${DATAPATH}"
1774
		exeinto "${DATAPATH#${EPREFIX}}"
1770
		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1775
		doexe "$(prefixify_ro "${GCC_FILESDIR}"/fix_libtool_files.sh)" || die
1771
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1776
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1772
	fi
1777
	fi
1773
1778
Lines 1812-1822 toolchain_src_install() { Link Here
1812
	# Use gid of 0 because some stupid ports don't have
1817
	# Use gid of 0 because some stupid ports don't have
1813
	# the group 'root' set to gid 0.  Send to /dev/null
1818
	# the group 'root' set to gid 0.  Send to /dev/null
1814
	# for people who are testing as non-root.
1819
	# for people who are testing as non-root.
1815
	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
1820
	chown -R root:0 "${D}${LIBPATH}" 2>/dev/null
1816
1821
1817
	# Move pretty-printers to gdb datadir to shut ldconfig up
1822
	# Move pretty-printers to gdb datadir to shut ldconfig up
1818
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1823
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1819
	pushd "${D}"${LIBPATH} >/dev/null
1824
	pushd "${D}${LIBPATH}" >/dev/null
1820
	for py in $(find . -name '*-gdb.py') ; do
1825
	for py in $(find . -name '*-gdb.py') ; do
1821
		local multidir=${py%/*}
1826
		local multidir=${py%/*}
1822
		insinto "${gdbdir}/${multidir}"
1827
		insinto "${gdbdir}/${multidir}"
Lines 1849-1856 gcc_movelibs() { Link Here
1849
	# that you want to link against when building tools rather than building
1854
	# that you want to link against when building tools rather than building
1850
	# code to run on the target.
1855
	# code to run on the target.
1851
	if tc_version_is_at_least 5 && is_crosscompile ; then
1856
	if tc_version_is_at_least 5 && is_crosscompile ; then
1852
		dodir "${HOSTLIBPATH}"
1857
		dodir "${HOSTLIBPATH#${EPREFIX}}"
1853
		mv "${D}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
1858
		mv "${ED}"usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
1854
	fi
1859
	fi
1855
1860
1856
	# For all the libs that are built for CTARGET, move them into the
1861
	# For all the libs that are built for CTARGET, move them into the
Lines 1862-1877 gcc_movelibs() { Link Here
1862
1867
1863
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1868
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1864
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1869
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1865
		local TODIR=${D}${LIBPATH}/${MULTIDIR}
1870
		local TODIR="${D}${LIBPATH}"/${MULTIDIR}
1866
		local FROMDIR=
1871
		local FROMDIR=
1867
1872
1868
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1873
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1869
1874
1870
		for FROMDIR in \
1875
		for FROMDIR in \
1871
			${LIBPATH}/${OS_MULTIDIR} \
1876
			"${LIBPATH}"/${OS_MULTIDIR} \
1872
			${LIBPATH}/../${MULTIDIR} \
1877
			"${LIBPATH}"/../${MULTIDIR} \
1873
			${PREFIX}/lib/${OS_MULTIDIR} \
1878
			"${PREFIX}"/lib/${OS_MULTIDIR} \
1874
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1879
			"${PREFIX}"/${CTARGET}/lib/${OS_MULTIDIR}
1875
		do
1880
		do
1876
			removedirs="${removedirs} ${FROMDIR}"
1881
			removedirs="${removedirs} ${FROMDIR}"
1877
			FROMDIR=${D}${FROMDIR}
1882
			FROMDIR=${D}${FROMDIR}
Lines 1935-1941 create_gcc_env_entry() { Link Here
1935
	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
1940
	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
1936
1941
1937
	local gcc_specs_file
1942
	local gcc_specs_file
1938
	local gcc_envd_file="${D}${gcc_envd_base}"
1943
	local gcc_envd_file="${ED}${gcc_envd_base}"
1939
	if [[ -z $1 ]] ; then
1944
	if [[ -z $1 ]] ; then
1940
		# I'm leaving the following commented out to remind me that it
1945
		# I'm leaving the following commented out to remind me that it
1941
		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
1946
		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
Lines 1999-2005 copy_minispecs_gcc_specs() { Link Here
1999
		create_gcc_env_entry hardenednossp
2004
		create_gcc_env_entry hardenednossp
2000
	fi
2005
	fi
2001
	create_gcc_env_entry vanilla
2006
	create_gcc_env_entry vanilla
2002
	insinto ${LIBPATH}
2007
	insinto ${LIBPATH#${EPREFIX}}
2003
	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
2008
	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
2004
	# Build system specs file which, if it exists, must be a complete set of
2009
	# Build system specs file which, if it exists, must be a complete set of
2005
	# specs as it completely and unconditionally overrides the builtin specs.
2010
	# specs as it completely and unconditionally overrides the builtin specs.
Lines 2014-2045 gcc_slot_java() { Link Here
2014
	local x
2019
	local x
2015
2020
2016
	# Move Java headers to compiler-specific dir
2021
	# Move Java headers to compiler-specific dir
2017
	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
2022
	for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do
2018
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
2023
		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/
2019
	done
2024
	done
2020
	for x in gcj gnu java javax org ; do
2025
	for x in gcj gnu java javax org ; do
2021
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
2026
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
2022
			dodir /${LIBPATH}/include/${x}
2027
			dodir /${LIBPATH#${EPREFIX}}/include/${x}
2023
			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
2028
			mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/
2024
			rm -rf "${D}"${PREFIX}/include/${x}
2029
			rm -rf "${D}${PREFIX}"/include/${x}
2025
		fi
2030
		fi
2026
	done
2031
	done
2027
2032
2028
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
2033
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
2029
		dodir /${LIBPATH}/security
2034
		dodir /${LIBPATH#${EPREFIX}}/security
2030
		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
2035
		mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security
2031
		rm -rf "${D}"${PREFIX}/lib*/security
2036
		rm -rf "${D}${PREFIX}"/lib*/security
2032
	fi
2037
	fi
2033
2038
2034
	# Move random gcj files to compiler-specific directories
2039
	# Move random gcj files to compiler-specific directories
2035
	for x in libgcj.spec logging.properties ; do
2040
	for x in libgcj.spec logging.properties ; do
2036
		x="${D}${PREFIX}/lib/${x}"
2041
		x="${D}${PREFIX}/lib/${x}"
2037
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
2042
		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/
2038
	done
2043
	done
2039
2044
2040
	# Rename jar because it could clash with Kaffe's jar if this gcc is
2045
	# Rename jar because it could clash with Kaffe's jar if this gcc is
2041
	# primary compiler (aka don't have the -<version> extension)
2046
	# primary compiler (aka don't have the -<version> extension)
2042
	cd "${D}"${BINPATH}
2047
	cd "${D}${BINPATH}"
2043
	[[ -f jar ]] && mv -f jar gcj-jar
2048
	[[ -f jar ]] && mv -f jar gcj-jar
2044
}
2049
}
2045
2050
Lines 2059-2074 toolchain_pkg_postinst() { Link Here
2059
		echo
2064
		echo
2060
2065
2061
		# Clean up old paths
2066
		# Clean up old paths
2062
		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
2067
		rm -f "${EROOT}"*/rcscripts/awk/fixlafiles.awk "${EROOT}"sbin/fix_libtool_files.sh
2063
		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
2068
		rmdir "${EROOT}"*/rcscripts{/awk,} 2>/dev/null
2064
2069
2065
		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
2070
		mkdir -p "${EROOT}"usr/{share/gcc-data,sbin,bin}
2066
		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
2071
		# DATAPATH has EPREFIX already, use ROOT with it
2067
		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
2072
		cp "${ROOT}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die
2073
		cp "${ROOT}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die
2068
2074
2069
		# Since these aren't critical files and portage sucks with
2075
		# Since these aren't critical files and portage sucks with
2070
		# handling of binpkgs, don't require these to be found
2076
		# handling of binpkgs, don't require these to be found
2071
		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
2077
		cp "${ROOT}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null
2072
	fi
2078
	fi
2073
2079
2074
	if use regression-test ; then
2080
	if use regression-test ; then
Lines 2091-2100 toolchain_pkg_postrm() { Link Here
2091
2097
2092
	# clean up the cruft left behind by cross-compilers
2098
	# clean up the cruft left behind by cross-compilers
2093
	if is_crosscompile ; then
2099
	if is_crosscompile ; then
2094
		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
2100
		if [[ -z $(ls "${EROOT}"etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
2095
			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
2101
			rm -f "${EROOT}"etc/env.d/gcc/config-${CTARGET}
2096
			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
2102
			rm -f "${EROOT}"etc/env.d/??gcc-${CTARGET}
2097
			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
2103
			rm -f "${EROOT}"usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
2098
		fi
2104
		fi
2099
		return 0
2105
		return 0
2100
	fi
2106
	fi
Lines 2107-2116 toolchain_pkg_postrm() { Link Here
2107
		do_gcc_config
2113
		do_gcc_config
2108
2114
2109
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
2115
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
2110
		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
2116
		fix_libtool_files.sh ${GCC_RELEASE_VER}
2111
		if [[ -n ${BRANCH_UPDATE} ]] ; then
2117
		if [[ -n ${BRANCH_UPDATE} ]] ; then
2112
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
2118
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
2113
			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
2119
			fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
2114
		fi
2120
		fi
2115
	fi
2121
	fi
2116
2122
Lines 2119-2131 toolchain_pkg_postrm() { Link Here
2119
2125
2120
do_gcc_config() {
2126
do_gcc_config() {
2121
	if ! should_we_gcc_config ; then
2127
	if ! should_we_gcc_config ; then
2122
		env -i ROOT="${ROOT}" gcc-config --use-old --force
2128
		env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config --use-old --force
2123
		return 0
2129
		return 0
2124
	fi
2130
	fi
2125
2131
2126
	local current_gcc_config target
2132
	local current_gcc_config target
2127
2133
2128
	current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
2134
	current_gcc_config=$(env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
2129
	if [[ -n ${current_gcc_config} ]] ; then
2135
	if [[ -n ${current_gcc_config} ]] ; then
2130
		local current_specs use_specs
2136
		local current_specs use_specs
2131
		# figure out which specs-specific config is active
2137
		# figure out which specs-specific config is active
Lines 2159-2170 should_we_gcc_config() { Link Here
2159
	# if the current config is invalid, we definitely want a new one
2165
	# if the current config is invalid, we definitely want a new one
2160
	# Note: due to bash quirkiness, the following must not be 1 line
2166
	# Note: due to bash quirkiness, the following must not be 1 line
2161
	local curr_config
2167
	local curr_config
2162
	curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
2168
	curr_config=$(env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
2163
2169
2164
	# if the previously selected config has the same major.minor (branch) as
2170
	# if the previously selected config has the same major.minor (branch) as
2165
	# the version we are installing, then it will probably be uninstalled
2171
	# the version we are installing, then it will probably be uninstalled
2166
	# for being in the same SLOT, make sure we run gcc-config.
2172
	# for being in the same SLOT, make sure we run gcc-config.
2167
	local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
2173
	local curr_config_ver=$(env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
2168
2174
2169
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
2175
	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
2170
2176

Return to bug 531610