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 (-46 / +52 lines)
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 970-979 toolchain_src_configure() { Link Here
970
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
975
			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
971
				confgcc+=(
976
				confgcc+=(
972
					"${confgcc_no_libc[@]}"
977
					"${confgcc_no_libc[@]}"
973
					--with-sysroot=${PREFIX}/${CTARGET}
978
					--with-sysroot="${PREFIX}"/${CTARGET}
974
				)
979
				)
975
			else
980
			else
976
				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
981
				confgcc+=( --with-sysroot="${PREFIX}"/${CTARGET} )
977
			fi
982
			fi
978
		fi
983
		fi
979
984
Lines 1633-1639 toolchain_src_install() { Link Here
1633
	if ! is_crosscompile ; then
1648
	if ! is_crosscompile ; then
1634
		local EXEEXT
1649
		local EXEEXT
1635
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1650
		eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
1636
		[[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}"
1651
		[[ -r "${D}${BINPATH}"/gcc${EXEEXT} ]] || die "gcc not found in ${D}"
1637
	fi
1652
	fi
1638
1653
1639
	dodir /etc/env.d/gcc
1654
	dodir /etc/env.d/gcc
Lines 1647-1653 toolchain_src_install() { Link Here
1647
	gcc_slot_java
1662
	gcc_slot_java
1648
1663
1649
	dodir /usr/bin
1664
	dodir /usr/bin
1650
	cd "${D}"${BINPATH}
1665
	cd "${D}${BINPATH}"
1651
	# Ugh: we really need to auto-detect this list.
1666
	# Ugh: we really need to auto-detect this list.
1652
	#      It's constantly out of date.
1667
	#      It's constantly out of date.
1653
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
1668
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
Lines 1658-1668 toolchain_src_install() { Link Here
1658
		if [[ -f ${CTARGET}-${x} ]] ; then
1673
		if [[ -f ${CTARGET}-${x} ]] ; then
1659
			if ! is_crosscompile ; then
1674
			if ! is_crosscompile ; then
1660
				ln -sf ${CTARGET}-${x} ${x}
1675
				ln -sf ${CTARGET}-${x} ${x}
1661
				dosym ${BINPATH}/${CTARGET}-${x} \
1676
				dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
1662
					/usr/bin/${x}-${GCC_CONFIG_VER}
1677
					/usr/bin/${x}-${GCC_CONFIG_VER}
1663
			fi
1678
			fi
1664
			# Create versioned symlinks
1679
			# Create versioned symlinks
1665
			dosym ${BINPATH}/${CTARGET}-${x} \
1680
			dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
1666
				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
1681
				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
1667
		fi
1682
		fi
1668
1683
Lines 1682-1688 toolchain_src_install() { Link Here
1682
	cd "${S}"
1697
	cd "${S}"
1683
	if is_crosscompile; then
1698
	if is_crosscompile; then
1684
		rm -rf "${D}"/usr/share/{man,info}
1699
		rm -rf "${D}"/usr/share/{man,info}
1685
		rm -rf "${D}"${DATAPATH}/{man,info}
1700
		rm -rf "${D}${DATAPATH}"/{man,info}
1686
	else
1701
	else
1687
		if tc_version_is_at_least 3.0 ; then
1702
		if tc_version_is_at_least 3.0 ; then
1688
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
1703
			local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
Lines 1694-1703 toolchain_src_install() { Link Here
1694
		fi
1709
		fi
1695
		has noinfo ${FEATURES} \
1710
		has noinfo ${FEATURES} \
1696
			&& rm -r "${D}/${DATAPATH}"/info \
1711
			&& rm -r "${D}/${DATAPATH}"/info \
1697
			|| prepinfo "${DATAPATH}"
1712
			|| prepinfo "${DATAPATH#${EPREFIX}}"
1698
		has noman ${FEATURES} \
1713
		has noman ${FEATURES} \
1699
			&& rm -r "${D}/${DATAPATH}"/man \
1714
			&& rm -r "${D}/${DATAPATH}"/man \
1700
			|| prepman "${DATAPATH}"
1715
			|| prepman "${DATAPATH#${EPREFIX}}"
1701
	fi
1716
	fi
1702
	# prune empty dirs left behind
1717
	# prune empty dirs left behind
1703
	find "${D}" -depth -type d -delete 2>/dev/null
1718
	find "${D}" -depth -type d -delete 2>/dev/null
Lines 1713-1719 toolchain_src_install() { Link Here
1713
	# Rather install the script, else portage with changing $FILESDIR
1728
	# Rather install the script, else portage with changing $FILESDIR
1714
	# between binary and source package borks things ....
1729
	# between binary and source package borks things ....
1715
	if ! is_crosscompile ; then
1730
	if ! is_crosscompile ; then
1716
		insinto "${DATAPATH}"
1731
		insinto "${DATAPATH#${EPREFIX}}"
1717
		if tc_version_is_at_least 4.0 ; then
1732
		if tc_version_is_at_least 4.0 ; then
1718
			newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1733
			newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
1719
			find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
1734
			find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
Lines 1721-1727 toolchain_src_install() { Link Here
1721
		else
1736
		else
1722
			doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1737
			doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
1723
		fi
1738
		fi
1724
		exeinto "${DATAPATH}"
1739
		exeinto "${DATAPATH#${EPREFIX}}"
1725
		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1740
		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
1726
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1741
		doexe "${GCC_FILESDIR}"/c{89,99} || die
1727
	fi
1742
	fi
Lines 1729-1739 toolchain_src_install() { Link Here
1729
	# Use gid of 0 because some stupid ports don't have
1744
	# Use gid of 0 because some stupid ports don't have
1730
	# the group 'root' set to gid 0.  Send to /dev/null
1745
	# the group 'root' set to gid 0.  Send to /dev/null
1731
	# for people who are testing as non-root.
1746
	# for people who are testing as non-root.
1732
	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
1747
	chown -R root:0 "${D}${LIBPATH}" 2>/dev/null
1733
1748
1734
	# Move pretty-printers to gdb datadir to shut ldconfig up
1749
	# Move pretty-printers to gdb datadir to shut ldconfig up
1735
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1750
	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1736
	pushd "${D}"${LIBPATH} >/dev/null
1751
	pushd "${D}${LIBPATH}" >/dev/null
1737
	for py in $(find . -name '*-gdb.py') ; do
1752
	for py in $(find . -name '*-gdb.py') ; do
1738
		local multidir=${py%/*}
1753
		local multidir=${py%/*}
1739
		insinto "${gdbdir}/${multidir}"
1754
		insinto "${gdbdir}/${multidir}"
Lines 1768-1783 gcc_movelibs() { Link Here
1768
1783
1769
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1784
		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1770
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1785
		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1771
		local TODIR=${D}${LIBPATH}/${MULTIDIR}
1786
		local TODIR="${D}${LIBPATH}"/${MULTIDIR}
1772
		local FROMDIR=
1787
		local FROMDIR=
1773
1788
1774
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1789
		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1775
1790
1776
		for FROMDIR in \
1791
		for FROMDIR in \
1777
			${LIBPATH}/${OS_MULTIDIR} \
1792
			"${LIBPATH}"/${OS_MULTIDIR} \
1778
			${LIBPATH}/../${MULTIDIR} \
1793
			"${LIBPATH}"/../${MULTIDIR} \
1779
			${PREFIX}/lib/${OS_MULTIDIR} \
1794
			"${PREFIX}"/lib/${OS_MULTIDIR} \
1780
			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1795
			"${PREFIX}"/${CTARGET}/lib/${OS_MULTIDIR}
1781
		do
1796
		do
1782
			removedirs="${removedirs} ${FROMDIR}"
1797
			removedirs="${removedirs} ${FROMDIR}"
1783
			FROMDIR=${D}${FROMDIR}
1798
			FROMDIR=${D}${FROMDIR}
Lines 1826-1843 fix_libtool_libdir_paths() { Link Here
1826
		./${dir}/*.la
1841
		./${dir}/*.la
1827
	sed -i \
1842
	sed -i \
1828
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
1843
		-e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \
1829
		$(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \
1844
		$(find ./"${PREFIX}"/lib* -maxdepth 3 -name '*.la') \
1830
		./${dir}/*.la
1845
		./${dir}/*.la
1831
1846
1832
	popd >/dev/null
1847
	popd >/dev/null
1833
}
1848
}
1834
1849
1835
create_gcc_env_entry() {
1850
create_gcc_env_entry() {
1836
	dodir /etc/env.d/gcc
1851
	dodir /etc/env.d/gcc
1837
	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
1852
	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
1838
1853
1839
	local gcc_specs_file
1854
	local gcc_specs_file
1840
	local gcc_envd_file="${D}${gcc_envd_base}"
1855
	local gcc_envd_file="${ED}${gcc_envd_base}"
1841
	if [[ -z $1 ]] ; then
1856
	if [[ -z $1 ]] ; then
1842
		# I'm leaving the following commented out to remind me that it
1857
		# I'm leaving the following commented out to remind me that it
1843
		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
1858
		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
Lines 1858-1864 create_gcc_env_entry() { Link Here
1858
		local mdir mosdir abi ldpath
1885
		local mdir mosdir abi ldpath
1859
		for abi in $(get_all_abis TARGET) ; do
1886
		for abi in $(get_all_abis TARGET) ; do
1860
			mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
1887
			mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
1861
			ldpath=${LIBPATH}
1888
			ldpath="${LIBPATH}"
1862
			[[ ${mdir} != "." ]] && ldpath+="/${mdir}"
1889
			[[ ${mdir} != "." ]] && ldpath+="/${mdir}"
1863
			ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
1890
			ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
1864
1891
Lines 1867-1873 create_gcc_env_entry() { Link Here
1867
		done
1894
		done
1868
	else
1895
	else
1869
		# Older gcc's didn't do multilib, so logic is simple.
1896
		# Older gcc's didn't do multilib, so logic is simple.
1870
		ldpaths=${LIBPATH}
1897
		ldpaths="${LIBPATH}"
1871
	fi
1898
	fi
1872
1899
1873
	cat <<-EOF > ${gcc_envd_file}
1900
	cat <<-EOF > ${gcc_envd_file}
Lines 1896-1902 copy_minispecs_gcc_specs() { Link Here
1896
		create_gcc_env_entry hardenednossp
1923
		create_gcc_env_entry hardenednossp
1897
	fi
1924
	fi
1898
	create_gcc_env_entry vanilla
1925
	create_gcc_env_entry vanilla
1899
	insinto ${LIBPATH}
1926
	insinto ${LIBPATH#${EPREFIX}}
1900
	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
1927
	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
1901
	# Build system specs file which, if it exists, must be a complete set of
1928
	# Build system specs file which, if it exists, must be a complete set of
1902
	# specs as it completely and unconditionally overrides the builtin specs.
1929
	# specs as it completely and unconditionally overrides the builtin specs.
Lines 1911-1942 gcc_slot_java() { Link Here
1911
	local x
1938
	local x
1912
1939
1913
	# Move Java headers to compiler-specific dir
1940
	# Move Java headers to compiler-specific dir
1914
	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
1941
	for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do
1915
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
1942
		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/
1916
	done
1943
	done
1917
	for x in gcj gnu java javax org ; do
1944
	for x in gcj gnu java javax org ; do
1918
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
1945
		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
1919
			dodir /${LIBPATH}/include/${x}
1946
			dodir /${LIBPATH#${EPREFIX}}/include/${x}
1920
			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
1947
			mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/
1921
			rm -rf "${D}"${PREFIX}/include/${x}
1948
			rm -rf "${D}${PREFIX}"/include/${x}
1922
		fi
1949
		fi
1923
	done
1950
	done
1924
1951
1925
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1952
	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1926
		dodir /${LIBPATH}/security
1953
		dodir /${LIBPATH#${EPREFIX}}/security
1927
		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
1954
		mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security
1928
		rm -rf "${D}"${PREFIX}/lib*/security
1955
		rm -rf "${D}${PREFIX}"/lib*/security
1929
	fi
1956
	fi
1930
1957
1931
	# Move random gcj files to compiler-specific directories
1958
	# Move random gcj files to compiler-specific directories
1932
	for x in libgcj.spec logging.properties ; do
1959
	for x in libgcj.spec logging.properties ; do
1933
		x="${D}${PREFIX}/lib/${x}"
1960
		x="${D}${PREFIX}/lib/${x}"
1934
		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
1961
		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/
1935
	done
1962
	done
1936
1963
1937
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1964
	# Rename jar because it could clash with Kaffe's jar if this gcc is
1938
	# primary compiler (aka don't have the -<version> extension)
1965
	# primary compiler (aka don't have the -<version> extension)
1939
	cd "${D}"${BINPATH}
1966
	cd "${D}${BINPATH}"
1940
	[[ -f jar ]] && mv -f jar gcj-jar
1967
	[[ -f jar ]] && mv -f jar gcj-jar
1941
}
1968
}
1942
1969
Lines 1956-1971 toolchain_pkg_postinst() { Link Here
1956
		echo
1983
		echo
1957
1984
1958
		# Clean up old paths
1985
		# Clean up old paths
1959
		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
1986
		rm -f "${EROOT}"/*/rcscripts/awk/fixlafiles.awk "${EROOT}"/sbin/fix_libtool_files.sh
1960
		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
1987
		rmdir "${EROOT}"/*/rcscripts{/awk,} 2>/dev/null
1961
1988
1962
		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
1989
		mkdir -p "${EROOT}"/usr/{share/gcc-data,sbin,bin}
1963
		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
1990
		# DATAPATH has EPREFIX already, use ROOT with it
1964
		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
1991
		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${EROOT}"/usr/share/gcc-data/ || die
1992
		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${EROOT}"/usr/sbin/ || die
1965
1993
1966
		# Since these aren't critical files and portage sucks with
1994
		# Since these aren't critical files and portage sucks with
1967
		# handling of binpkgs, don't require these to be found
1995
		# handling of binpkgs, don't require these to be found
1968
		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
1996
		cp "${ROOT}/${DATAPATH}"/c{89,99} "${EROOT}"/usr/bin/ 2>/dev/null
1969
	fi
1997
	fi
1970
1998
1971
	if use regression-test ; then
1999
	if use regression-test ; then
Lines 1988-1997 toolchain_pkg_postrm() { Link Here
1988
2016
1989
	# clean up the cruft left behind by cross-compilers
2017
	# clean up the cruft left behind by cross-compilers
1990
	if is_crosscompile ; then
2018
	if is_crosscompile ; then
1991
		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
2019
		if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
1992
			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
2020
			rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
1993
			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
2021
			rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
1994
			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
2022
			rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
1995
		fi
2023
		fi
1996
		return 0
2024
		return 0
1997
	fi
2025
	fi
Lines 2004-2013 toolchain_pkg_postrm() { Link Here
2004
		do_gcc_config
2032
		do_gcc_config
2005
2033
2006
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
2034
		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
2007
		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
2035
		fix_libtool_files.sh ${GCC_RELEASE_VER}
2008
		if [[ -n ${BRANCH_UPDATE} ]] ; then
2036
		if [[ -n ${BRANCH_UPDATE} ]] ; then
2009
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
2037
			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
2010
			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
2038
			fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
2011
		fi
2039
		fi
2012
	fi
2040
	fi
2013
2041

Return to bug 531610