Lines 224-232
configure_toolchain() {
Link Here
|
224 |
# this is Clang, recent enough to compile recent clang |
224 |
# this is Clang, recent enough to compile recent clang |
225 |
compiler_stage1+=" |
225 |
compiler_stage1+=" |
226 |
${llvm_deps} |
226 |
${llvm_deps} |
227 |
sys-libs/libcxxabi |
227 |
sys-libs/compiler-rt |
228 |
sys-libs/libcxx |
|
|
229 |
sys-devel/llvm |
228 |
sys-devel/llvm |
|
|
229 |
sys-devel/lld |
230 |
sys-devel/clang-common |
230 |
sys-devel/clang |
231 |
sys-devel/clang |
231 |
" |
232 |
" |
232 |
CC=clang |
233 |
CC=clang |
Lines 235-241
configure_toolchain() {
Link Here
|
235 |
# binutils-apple, rely on the host-installed ld to |
236 |
# binutils-apple, rely on the host-installed ld to |
236 |
# build a compiler, we'll pull in binutils-apple |
237 |
# build a compiler, we'll pull in binutils-apple |
237 |
# from system set |
238 |
# from system set |
238 |
linker=sys-devel/native-cctools |
239 |
linker=sys-devel/lld |
239 |
;; |
240 |
;; |
240 |
*) |
241 |
*) |
241 |
eerror "unknown/unsupported compiler" |
242 |
eerror "unknown/unsupported compiler" |
Lines 246-255
configure_toolchain() {
Link Here
|
246 |
compiler=" |
247 |
compiler=" |
247 |
dev-libs/libffi |
248 |
dev-libs/libffi |
248 |
${llvm_deps} |
249 |
${llvm_deps} |
|
|
250 |
sys-libs/compiler-rt |
249 |
sys-libs/libcxxabi |
251 |
sys-libs/libcxxabi |
250 |
sys-libs/libcxx |
252 |
sys-libs/libcxx |
251 |
sys-devel/llvm |
253 |
sys-devel/llvm |
252 |
sys-devel/clang" |
254 |
sys-devel/lld |
|
|
255 |
sys-libs/llvm-libunwind |
256 |
sys-devel/clang-common |
257 |
sys-devel/clang |
258 |
" |
253 |
;; |
259 |
;; |
254 |
*-linux*) |
260 |
*-linux*) |
255 |
is-rap && einfo "Triggering Linux RAP bootstrap" |
261 |
is-rap && einfo "Triggering Linux RAP bootstrap" |
Lines 481-491
bootstrap_profile() {
Link Here
|
481 |
fi |
487 |
fi |
482 |
( cd "${ROOT}" && ln -s "${SDKPATH}" MacOSX.sdk ) |
488 |
( cd "${ROOT}" && ln -s "${SDKPATH}" MacOSX.sdk ) |
483 |
einfo "using system sources from ${SDKPATH}" |
489 |
einfo "using system sources from ${SDKPATH}" |
484 |
fi |
|
|
485 |
|
490 |
|
486 |
if [[ ${DARWIN_USE_GCC} == 1 ]] ; then |
491 |
if [[ ${DARWIN_USE_GCC} == 1 ]] ; then |
487 |
# amend profile, to use gcc one |
492 |
# amend profile, to use gcc one |
488 |
profile="${profile}/gcc" |
493 |
profile="${profile}/gcc" |
|
|
494 |
elif [[ "${STAGE}" != stage2 ]]; then |
495 |
profile="${profile}/clang" |
496 |
fi |
489 |
fi |
497 |
fi |
490 |
|
498 |
|
491 |
[[ -n ${PROFILE_BASE}${PROFILE_VARIANT} ]] && |
499 |
[[ -n ${PROFILE_BASE}${PROFILE_VARIANT} ]] && |
Lines 553-558
do_tree() {
Link Here
|
553 |
fi |
561 |
fi |
554 |
|
562 |
|
555 |
mkdir -p "${PORTDIR}" |
563 |
mkdir -p "${PORTDIR}" |
|
|
564 |
rm -rf "${PORTDIR}" |
565 |
cp -Rp ~/gentoo-repo "${PORTDIR}" |
566 |
return 0 |
556 |
if [[ ! -e ${PORTDIR}/.unpacked ]]; then |
567 |
if [[ ! -e ${PORTDIR}/.unpacked ]]; then |
557 |
# latest tree cannot be fetched from mirrors, always have to |
568 |
# latest tree cannot be fetched from mirrors, always have to |
558 |
# respect the source to get the latest |
569 |
# respect the source to get the latest |
Lines 1197-1214
bootstrap_cmake_core() {
Link Here
|
1197 |
|
1208 |
|
1198 |
# we need sysroot crap to build cmake itself, but it makes trouble |
1209 |
# we need sysroot crap to build cmake itself, but it makes trouble |
1199 |
# later on, so kill it in the installed version |
1210 |
# later on, so kill it in the installed version |
1200 |
ver=${A%-*} ; ver=${ver%.*} |
|
|
1201 |
sed -i -e '/cmake_gnu_set_sysroot_flag/d' \ |
1211 |
sed -i -e '/cmake_gnu_set_sysroot_flag/d' \ |
1202 |
"${ROOT}"/tmp/usr/share/${ver}/Modules/Platform/Apple-GNU-*.cmake || die |
1212 |
"${ROOT}"/tmp/usr/share/cmake*/Modules/Platform/Apple-GNU-*.cmake || die |
1203 |
# disable isysroot usage with clang as well |
1213 |
# disable isysroot usage with clang as well |
1204 |
sed -i -e '/_SYSROOT_FLAG/d' \ |
1214 |
sed -i -e '/_SYSROOT_FLAG/d' \ |
1205 |
"${ROOT}"/tmp/usr/share/${ver}/Modules/Platform/Apple-Clang.cmake || die |
1215 |
"${ROOT}"/tmp/usr/share/cmake*/Modules/Platform/Apple-Clang.cmake || die |
1206 |
|
1216 |
|
1207 |
einfo "${A%.tar.*} bootstrapped" |
1217 |
einfo "${A%.tar.*} bootstrapped" |
1208 |
} |
1218 |
} |
1209 |
|
1219 |
|
1210 |
bootstrap_cmake() { |
1220 |
bootstrap_cmake() { |
1211 |
bootstrap_cmake_core 3.16.5 || bootstrap_cmake_core 3.0.2 |
1221 |
bootstrap_cmake_core 3.20.6 || bootstrap_cmake_core 3.16.5 || bootstrap_cmake_core 3.0.2 |
1212 |
} |
1222 |
} |
1213 |
|
1223 |
|
1214 |
bootstrap_zlib_core() { |
1224 |
bootstrap_zlib_core() { |
Lines 1476-1482
bootstrap_stage1() {
Link Here
|
1476 |
|| (bootstrap_gcc5) || return 1 |
1486 |
|| (bootstrap_gcc5) || return 1 |
1477 |
fi |
1487 |
fi |
1478 |
|
1488 |
|
1479 |
configure_toolchain |
1489 |
STAGE=stage1 configure_toolchain || return 1 |
1480 |
export CC CXX |
1490 |
export CC CXX |
1481 |
|
1491 |
|
1482 |
# Run all bootstrap_* commands in a subshell since the targets |
1492 |
# Run all bootstrap_* commands in a subshell since the targets |
Lines 1645-1651
bootstrap_stage1() {
Link Here
|
1645 |
[[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || \ |
1655 |
[[ -e ${ROOT}/tmp/etc/portage/make.profile ]] || \ |
1646 |
( "${CP}" -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc && \ |
1656 |
( "${CP}" -dpR "${ROOT}"/etc/portage "${ROOT}"/tmp/etc && \ |
1647 |
rm -f "${ROOT}"/tmp/etc/portage/make.profile && \ |
1657 |
rm -f "${ROOT}"/tmp/etc/portage/make.profile && \ |
1648 |
(ROOT="${ROOT}"/tmp PREFIX_DISABLE_RAP=yes bootstrap_profile) ) || return 1 |
1658 |
(ROOT="${ROOT}"/tmp PREFIX_DISABLE_RAP=yes STAGE=stage2 bootstrap_profile) ) || return 1 |
1649 |
|
1659 |
|
1650 |
# setup portage |
1660 |
# setup portage |
1651 |
[[ -e ${ROOT}/tmp/usr/bin/emerge ]] || (bootstrap_portage) || return 1 |
1661 |
[[ -e ${ROOT}/tmp/usr/bin/emerge ]] || (bootstrap_portage) || return 1 |
Lines 1701-1707
do_emerge_pkgs() {
Link Here
|
1701 |
-fortran |
1711 |
-fortran |
1702 |
-gdbm |
1712 |
-gdbm |
1703 |
-git |
1713 |
-git |
1704 |
-libcxx |
|
|
1705 |
-http2 |
1714 |
-http2 |
1706 |
-nls |
1715 |
-nls |
1707 |
-pcre |
1716 |
-pcre |
Lines 1713-1718
do_emerge_pkgs() {
Link Here
|
1713 |
clang |
1722 |
clang |
1714 |
internal-glib |
1723 |
internal-glib |
1715 |
) |
1724 |
) |
|
|
1725 |
if [[ ${CHOST} == *-darwin* && ${DARWIN_USE_GCC} == 0 ]] ; then |
1726 |
myuse+=( |
1727 |
-binutils-plugin |
1728 |
default-compiler-rt |
1729 |
default-libcxx |
1730 |
default-lld |
1731 |
) |
1732 |
else |
1733 |
myuse+=( -libcxx ) |
1734 |
fi |
1735 |
local skip_llvm_pkg_setup="" |
1736 |
if [[ ${STAGE} == stage2 ]] ; then |
1737 |
myuse+=( bootstrap-prefix ) |
1738 |
skip_llvm_pkg_setup="yes" |
1739 |
fi |
1716 |
local override_make_conf_dir="${PORTAGE_OVERRIDE_EPREFIX}${MAKE_CONF_DIR#${ROOT}}" |
1740 |
local override_make_conf_dir="${PORTAGE_OVERRIDE_EPREFIX}${MAKE_CONF_DIR#${ROOT}}" |
1717 |
|
1741 |
|
1718 |
if [[ " ${USE} " == *" prefix-stack "* ]] && |
1742 |
if [[ " ${USE} " == *" prefix-stack "* ]] && |
Lines 1740-1746
do_emerge_pkgs() {
Link Here
|
1740 |
|
1764 |
|
1741 |
# Disable the STALE warning because the snapshot frequently gets stale. |
1765 |
# Disable the STALE warning because the snapshot frequently gets stale. |
1742 |
# |
1766 |
# |
1743 |
# Need need to spam the user about news until the emerge -e system |
1767 |
# No need to spam the user about news until the emerge -e system |
1744 |
# because the tools aren't available to read the news item yet anyway. |
1768 |
# because the tools aren't available to read the news item yet anyway. |
1745 |
# |
1769 |
# |
1746 |
# Avoid circular deps caused by the default profiles (and IUSE |
1770 |
# Avoid circular deps caused by the default profiles (and IUSE |
Lines 1756-1761
do_emerge_pkgs() {
Link Here
|
1756 |
PORTAGE_SYNC_STALE=0 \ |
1780 |
PORTAGE_SYNC_STALE=0 \ |
1757 |
FEATURES="-news ${FEATURES}" \ |
1781 |
FEATURES="-news ${FEATURES}" \ |
1758 |
USE="${myuse[*]}" \ |
1782 |
USE="${myuse[*]}" \ |
|
|
1783 |
LLVM_ECLASS_SKIP_PKG_SETUP="${skip_llvm_pkg_setup}" \ |
1759 |
emerge --color n -v --oneshot --root-deps ${opts} "${pkg}" |
1784 |
emerge --color n -v --oneshot --root-deps ${opts} "${pkg}" |
1760 |
) |
1785 |
) |
1761 |
[[ $? -eq 0 ]] || return 1 |
1786 |
[[ $? -eq 0 ]] || return 1 |
Lines 1772-1782
bootstrap_stage2() {
Link Here
|
1772 |
|
1797 |
|
1773 |
# Find out what toolchain packages we need, and configure LDFLAGS |
1798 |
# Find out what toolchain packages we need, and configure LDFLAGS |
1774 |
# and friends. |
1799 |
# and friends. |
1775 |
configure_toolchain || return 1 |
1800 |
STAGE=stage2 configure_toolchain || return 1 |
1776 |
configure_cflags || return 1 |
1801 |
configure_cflags || return 1 |
1777 |
export CONFIG_SHELL="${ROOT}"/tmp/bin/bash |
1802 |
export CONFIG_SHELL="${ROOT}"/tmp/bin/bash |
1778 |
export CC CXX |
1803 |
export CC CXX |
1779 |
|
1804 |
|
|
|
1805 |
# provide active SDK link on Darwin |
1806 |
if [[ ${CHOST} == *-darwin* ]] ; then |
1807 |
rm -f "${ROOT}"/tmp/MacOSX.sdk |
1808 |
( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk . ) |
1809 |
if [[ ${DARWIN_USE_GCC} == 0 ]] ; then |
1810 |
# TODO: libtool is here only because of the hack in the compiler-rt's ebuild |
1811 |
for bin in libtool clang clang++ ; do |
1812 |
{ |
1813 |
echo "#!${ROOT}/tmp/bin/sh" |
1814 |
echo "${bin}"' "$@"' |
1815 |
} > "${ROOT}"/tmp/usr/bin/${CHOST}-${bin} |
1816 |
chmod +x "${ROOT}"/tmp/usr/bin/${CHOST}-${bin} |
1817 |
done |
1818 |
fi |
1819 |
if [[ ${DARWIN_USE_GCC} == 123 ]] ; then |
1820 |
{ |
1821 |
echo 'PATH="/Library/Developer/CommandLineTools/usr/bin:$PATH"' |
1822 |
echo "CFLAGS=\"-L ${ROOT}/tmp/MacOSX.sdk/usr/lib -isystem ${ROOT}/tmp/MacOSX.sdk/usr/include ${CFLAGS}\"" |
1823 |
#echo 'CXXFLAGS="${CFLAGS}"' |
1824 |
#echo 'LDFLAGS="${LDFLAGS} -mlinker-version=305"' |
1825 |
#echo LIBTOOL=libtool |
1826 |
# clang-cpp and llvm-ar set by profile don't exist yet |
1827 |
#echo 'CPP="clang -E"' |
1828 |
#echo 'AR=ar' |
1829 |
#echo 'NM=nm' |
1830 |
#echo 'RANLIB=ranlib' |
1831 |
} > "${ROOT}/tmp/etc/portage/make.conf/0102_bootstrap_prefix_darwin.conf" |
1832 |
fi |
1833 |
fi |
1834 |
|
1780 |
emerge_pkgs() { |
1835 |
emerge_pkgs() { |
1781 |
EPREFIX="${ROOT}"/tmp \ |
1836 |
EPREFIX="${ROOT}"/tmp \ |
1782 |
STAGE=stage2 \ |
1837 |
STAGE=stage2 \ |
Lines 1858-1878
bootstrap_stage2() {
Link Here
|
1858 |
sys-devel/binutils-config |
1913 |
sys-devel/binutils-config |
1859 |
) |
1914 |
) |
1860 |
|
1915 |
|
1861 |
# provide active SDK link on Darwin |
|
|
1862 |
if [[ ${CHOST} == *-darwin* ]] ; then |
1863 |
rm -f "${ROOT}"/tmp/MacOSX.sdk |
1864 |
( cd "${ROOT}"/tmp && ln -s ../MacOSX.sdk ) |
1865 |
fi |
1866 |
|
1867 |
# cmake has some external dependencies which require autoconf, etc. |
1916 |
# cmake has some external dependencies which require autoconf, etc. |
1868 |
# unless we only build the buildtool, bug #603012 |
1917 |
# unless we only build the buildtool, bug #603012 |
1869 |
echo "dev-build/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use |
1918 |
echo "dev-build/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use |
1870 |
|
1919 |
|
1871 |
emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
1920 |
emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
1872 |
|
1921 |
|
1873 |
# Debian multiarch supported by RAP needs ld to support sysroot. |
1922 |
if [[ ${CHOST} == *-darwin* && ${DARWIN_USE_GCC} == 0 ]] ; then |
1874 |
EXTRA_ECONF=$(rapx --with-sysroot=/) \ |
1923 |
: |
1875 |
emerge_pkgs --nodeps ${linker} || return 1 |
1924 |
else |
|
|
1925 |
# Debian multiarch supported by RAP needs ld to support sysroot. |
1926 |
EXTRA_ECONF=$(rapx --with-sysroot=/) \ |
1927 |
emerge_pkgs --nodeps ${linker} || return 1 |
1928 |
fi |
1876 |
|
1929 |
|
1877 |
# During Gentoo prefix bootstrap stage2, GCC is built with |
1930 |
# During Gentoo prefix bootstrap stage2, GCC is built with |
1878 |
# "--disable-bootstrap". For Darwin, it means that rather than letting |
1931 |
# "--disable-bootstrap". For Darwin, it means that rather than letting |
Lines 1889-1895
bootstrap_stage2() {
Link Here
|
1889 |
# Thus, embedded rpath should be disabled during prefix bootstrap stage2 |
1942 |
# Thus, embedded rpath should be disabled during prefix bootstrap stage2 |
1890 |
# and passed into EXTRA_ECONF. |
1943 |
# and passed into EXTRA_ECONF. |
1891 |
# https://bugs.gentoo.org/895334 |
1944 |
# https://bugs.gentoo.org/895334 |
1892 |
if [[ ${CHOST} == *-darwin* ]] ; |
1945 |
if [[ ${CHOST} == *-darwin* && ${DARWIN_USE_GCC} == 1 ]] ; |
1893 |
then |
1946 |
then |
1894 |
local disable_darwin_rpath="--disable-darwin-at-rpath" |
1947 |
local disable_darwin_rpath="--disable-darwin-at-rpath" |
1895 |
else |
1948 |
else |
Lines 1904-1913
bootstrap_stage2() {
Link Here
|
1904 |
# to find our prefix |
1957 |
# to find our prefix |
1905 |
# For >=gcc-12.2.0, rpath needs to be disabled in stage2 on |
1958 |
# For >=gcc-12.2.0, rpath needs to be disabled in stage2 on |
1906 |
# Darwin, see above. |
1959 |
# Darwin, see above. |
|
|
1960 |
# OVERRIDE_CXXFLAGS="${CPPFLAGS} ${OVERRIDE_CXXFLAGS}" \ |
1907 |
EXTRA_ECONF="--disable-bootstrap $(rapx --with-linker-hash-style=both) --with-local-prefix=${ROOT} ${disable_darwin_rpath}" \ |
1961 |
EXTRA_ECONF="--disable-bootstrap $(rapx --with-linker-hash-style=both) --with-local-prefix=${ROOT} ${disable_darwin_rpath}" \ |
1908 |
MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \ |
1962 |
MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \ |
1909 |
GCC_MAKE_TARGET=all \ |
1963 |
GCC_MAKE_TARGET=all \ |
1910 |
OVERRIDE_CXXFLAGS="${CPPFLAGS} ${OVERRIDE_CXXFLAGS}" \ |
|
|
1911 |
TPREFIX="${ROOT}" \ |
1964 |
TPREFIX="${ROOT}" \ |
1912 |
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \ |
1965 |
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \ |
1913 |
emerge_pkgs --nodeps ${pkg} || return 1 |
1966 |
emerge_pkgs --nodeps ${pkg} || return 1 |
Lines 1920-1925
bootstrap_stage2() {
Link Here
|
1920 |
[[ -x ${ROOT}/tmp/usr/bin/clang++ ]] && CXX=clang++ |
1973 |
[[ -x ${ROOT}/tmp/usr/bin/clang++ ]] && CXX=clang++ |
1921 |
fi |
1974 |
fi |
1922 |
done |
1975 |
done |
|
|
1976 |
if [[ ${CHOST} == *-darwin* && ${DARWIN_USE_GCC} == 0 ]] ; then |
1977 |
rm ${ROOT}/tmp/usr/bin/${CHOST}-{libtool,clang,clang++} |
1978 |
mkdir -p ${ROOT}/usr/local/bin |
1979 |
ln -s ${ROOT}/tmp/usr/lib/llvm/*/bin/llvm-libtool-darwin ${ROOT}/usr/local/bin/libtool |
1980 |
fi |
1923 |
|
1981 |
|
1924 |
if [[ ${compiler_type} == clang ]] ; then |
1982 |
if [[ ${compiler_type} == clang ]] ; then |
1925 |
# We use Clang as our toolchain compiler, so we need to make |
1983 |
# We use Clang as our toolchain compiler, so we need to make |
Lines 1928-1933
bootstrap_stage2() {
Link Here
|
1928 |
{ |
1986 |
{ |
1929 |
echo |
1987 |
echo |
1930 |
echo "# System compiler on $(uname) Prefix is Clang, do not remove this" |
1988 |
echo "# System compiler on $(uname) Prefix is Clang, do not remove this" |
|
|
1989 |
echo "AS=\"${CHOST}-clang -c\"" |
1990 |
echo "CPP=${CHOST}-clang-cpp" |
1931 |
echo "CC=${CHOST}-clang" |
1991 |
echo "CC=${CHOST}-clang" |
1932 |
echo "CXX=${CHOST}-clang++" |
1992 |
echo "CXX=${CHOST}-clang++" |
1933 |
echo "OBJC=${CHOST}-clang" |
1993 |
echo "OBJC=${CHOST}-clang" |
Lines 1983-1989
bootstrap_stage3() {
Link Here
|
1983 |
# they stop mucking up builds. |
2043 |
# they stop mucking up builds. |
1984 |
rm -f "${ROOT}"/tmp/usr/local/bin/* |
2044 |
rm -f "${ROOT}"/tmp/usr/local/bin/* |
1985 |
|
2045 |
|
1986 |
configure_toolchain || return 1 |
2046 |
STAGE=stage3 configure_toolchain || return 1 |
1987 |
|
2047 |
|
1988 |
if [[ ${compiler_type} == clang ]] ; then |
2048 |
if [[ ${compiler_type} == clang ]] ; then |
1989 |
if ! type -P clang > /dev/null ; then |
2049 |
if ! type -P clang > /dev/null ; then |
Lines 2034-2040
bootstrap_stage3() {
Link Here
|
2034 |
# (CBUILD, BDEPEND) and with the system being built |
2094 |
# (CBUILD, BDEPEND) and with the system being built |
2035 |
# (CHOST, RDEPEND). To correctly bootstrap stage3, |
2095 |
# (CHOST, RDEPEND). To correctly bootstrap stage3, |
2036 |
# PORTAGE_OVERRIDE_EPREFIX as BROOT is needed. |
2096 |
# PORTAGE_OVERRIDE_EPREFIX as BROOT is needed. |
2037 |
PREROOTPATH="${ROOT}"$(echo /{,tmp/}{usr/,}{,lib/llvm/{12,11,10}/}{s,}bin | sed "s, ,:${ROOT},g") \ |
2097 |
#PREROOTPATH="${ROOT}"$(echo /{,tmp/}{usr/,}{,lib/llvm/{12,11,10}/}{s,}bin | sed "s, ,:${ROOT},g") \ |
|
|
2098 |
|
2038 |
EPREFIX="${ROOT}" PORTAGE_TMPDIR="${PORTAGE_TMPDIR}" \ |
2099 |
EPREFIX="${ROOT}" PORTAGE_TMPDIR="${PORTAGE_TMPDIR}" \ |
2039 |
EMERGE_LOG_DIR="${ROOT}"/var/log \ |
2100 |
EMERGE_LOG_DIR="${ROOT}"/var/log \ |
2040 |
STAGE=stage3 \ |
2101 |
STAGE=stage3 \ |
Lines 2174-2181
bootstrap_stage3() {
Link Here
|
2174 |
sys-devel/flex |
2235 |
sys-devel/flex |
2175 |
sys-devel/binutils-config |
2236 |
sys-devel/binutils-config |
2176 |
sys-libs/zlib |
2237 |
sys-libs/zlib |
2177 |
${linker} |
|
|
2178 |
) |
2238 |
) |
|
|
2239 |
if [[ ${CHOST} == *-darwin* && ${DARWIN_USE_GCC} == 0 ]] ; then |
2240 |
: |
2241 |
else |
2242 |
pkgs+=(${linker}) |
2243 |
fi |
2179 |
|
2244 |
|
2180 |
pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
2245 |
pre_emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
2181 |
fi |
2246 |
fi |
Lines 2198-2203
bootstrap_stage3() {
Link Here
|
2198 |
# in addition, avoid collisions |
2263 |
# in addition, avoid collisions |
2199 |
rm -Rf "${ROOT}"/tmp/usr/lib/python$(python_ver)/site-packages/clang |
2264 |
rm -Rf "${ROOT}"/tmp/usr/lib/python$(python_ver)/site-packages/clang |
2200 |
|
2265 |
|
|
|
2266 |
if [[ ${CHOST} == *-darwin* && ${DARWIN_USE_GCC} == 0 ]] ; then |
2267 |
# TODO: libtool is here only because of the hack in the compiler-rt's ebuild |
2268 |
if [[ ! -e ${ROOT}/usr/bin/${CHOST}-libtool ]]; then |
2269 |
ln -s ${ROOT}/tmp/usr/lib/llvm/*/bin/llvm-libtool-darwin ${ROOT}/usr/bin/${CHOST}-libtool |
2270 |
fi |
2271 |
fi |
2272 |
|
2201 |
# Try to get ourself out of the mud, bug #575324 |
2273 |
# Try to get ourself out of the mud, bug #575324 |
2202 |
EXTRA_ECONF="--disable-compiler-version-checks $(rapx '--disable-lto --disable-bootstrap')" \ |
2274 |
EXTRA_ECONF="--disable-compiler-version-checks $(rapx '--disable-lto --disable-bootstrap')" \ |
2203 |
GCC_MAKE_TARGET=$(rapx all) \ |
2275 |
GCC_MAKE_TARGET=$(rapx all) \ |
Lines 2205-2214
bootstrap_stage3() {
Link Here
|
2205 |
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \ |
2277 |
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \ |
2206 |
pre_emerge_pkgs --nodeps ${compiler} || return 1 |
2278 |
pre_emerge_pkgs --nodeps ${compiler} || return 1 |
2207 |
|
2279 |
|
|
|
2280 |
# At this point our libc++abi.dylib is dynamically linked to /usr/lib/libc++abi.dylib. |
2281 |
# That causes issues with perl later. Force rebuild of sys-libs/libcxxabi to break this link. |
2282 |
rm -rf "${ROOT}/var/db/pkg/sys-libs/libcxxabi"* |
2283 |
PYTHON_COMPAT_OVERRIDE=python$(python_ver) \ |
2284 |
pre_emerge_pkgs --nodeps "sys-libs/libcxxabi" || return 1 |
2285 |
|
2208 |
# Undo libgcc_s.so path of stage2 |
2286 |
# Undo libgcc_s.so path of stage2 |
2209 |
# Now we have the compiler right there |
2287 |
# Now we have the compiler right there |
2210 |
unset CC CXX CPPFLAGS LDFLAGS |
2288 |
unset CC CXX CPPFLAGS LDFLAGS |
2211 |
|
2289 |
|
|
|
2290 |
# Now clang is ready, can use it instead of /usr/bin/gcc |
2291 |
# TODO: perhaps symlink the whole etc/portage instead? |
2292 |
ln -s -f "${ROOT}/etc/portage/make.profile" "${ROOT}/tmp/etc/portage/make.profile" |
2293 |
if [[ ${compiler_type} == clang ]] ; then |
2294 |
cp "${ROOT}/etc/portage/make.conf/0100_bootstrap_prefix_clang.conf" \ |
2295 |
"${ROOT}/tmp/etc/portage/make.conf/" |
2296 |
fi |
2297 |
|
2212 |
rm -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf |
2298 |
rm -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf |
2213 |
|
2299 |
|
2214 |
# need special care, it depends on texinfo, #717786 |
2300 |
# need special care, it depends on texinfo, #717786 |
Lines 2221-2231
bootstrap_stage3() {
Link Here
|
2221 |
ln -s bash "${ROOT}"/bin/sh |
2307 |
ln -s bash "${ROOT}"/bin/sh |
2222 |
fi |
2308 |
fi |
2223 |
|
2309 |
|
2224 |
# Start using apps from the final destination Prefix |
2310 |
# Start using apps from new target |
2225 |
export PREROOTPATH="${ROOT}/usr/bin:${ROOT}/bin" |
2311 |
cat > "${ROOT}"/tmp/etc/env.d/10stage3 <<-EOF |
|
|
2312 |
PATH="${ROOT}/usr/bin:${ROOT}/bin:${ROOT}" |
2313 |
EOF |
2314 |
if [[ ${compiler_type} == clang ]] ; then |
2315 |
if [[ ! -e "${ROOT}"/tmp/etc/env.d/11stage3-llvm ]]; then |
2316 |
ln -s "${ROOT}"/etc/env.d/60llvm-* "${ROOT}"/tmp/etc/env.d/11stage3-llvm |
2317 |
fi |
2318 |
# Prevent usage of AppleClang aka gcc for bad packages |
2319 |
if [[ ! -e "${ROOT}"/usr/bin/gcc ]]; then |
2320 |
echo "#!${ROOT}/bin/bash" > "${ROOT}"/usr/bin/gcc |
2321 |
echo "false ${CHOST}-clang \"\$@\"" >> "${ROOT}"/usr/bin/gcc |
2322 |
fi |
2323 |
if [[ ! -e "${ROOT}"/usr/bin/g++ ]]; then |
2324 |
echo "#!${ROOT}/bin/bash" > "${ROOT}"/usr/bin/g++ |
2325 |
echo "false ${CHOST}-clang++ \"\$@\"" >> "${ROOT}"/usr/bin/g++ |
2326 |
fi |
2327 |
chmod +x "${ROOT}"/usr/bin/{gcc,g++} |
2328 |
if [[ ${CHOST} == *-darwin* ]]; then |
2329 |
if [[ ! -e "${ROOT}"/usr/bin/ld ]]; then |
2330 |
echo "#!${ROOT}/bin/bash" > "${ROOT}"/usr/bin/ld |
2331 |
echo "false ld64.lld \"\$@\"" >> "${ROOT}"/usr/bin/ld |
2332 |
fi |
2333 |
chmod +x "${ROOT}"/usr/bin/ld |
2334 |
fi |
2335 |
fi |
2336 |
"${ROOT}"/tmp/usr/sbin/env-update |
2226 |
|
2337 |
|
2227 |
# Get a sane bash, overwriting tmp symlinks |
2338 |
# Get a sane bash, overwriting tmp symlinks |
2228 |
pre_emerge_pkgs "" "app-shells/bash" || return 1 |
2339 |
pre_emerge_pkgs "" "app-shells/bash" || return 1 |
|
|
2340 |
ln -s "${ROOT}"/bin/bash "${ROOT}"/usr/bin/bash |
2229 |
|
2341 |
|
2230 |
# now we have a shell right there |
2342 |
# now we have a shell right there |
2231 |
unset CONFIG_SHELL |
2343 |
unset CONFIG_SHELL |
Lines 3298-3304
case ${CHOST} in
Link Here
|
3298 |
case ${DARWIN_USE_GCC} in |
3412 |
case ${DARWIN_USE_GCC} in |
3299 |
yes|true|1) DARWIN_USE_GCC=1 ;; |
3413 |
yes|true|1) DARWIN_USE_GCC=1 ;; |
3300 |
no|false|0) DARWIN_USE_GCC=0 ;; |
3414 |
no|false|0) DARWIN_USE_GCC=0 ;; |
3301 |
*) DARWIN_USE_GCC=1 ;; # default to GCC build |
3415 |
*) DARWIN_USE_GCC=0 ;; # default to Clang build |
3302 |
esac |
3416 |
esac |
3303 |
;; |
3417 |
;; |
3304 |
*) |
3418 |
*) |