1
1
#! /usr/bin/env bash
2
- # shellcheck disable=SC1091,SC2016,SC2030,SC2031,SC2038,SC2185,SC2120
2
+ # shellcheck disable=SC1091,SC2015, SC2016,SC2030,SC2031,SC2038,SC2185,SC2120
3
3
# Copyright 2006-2024 Gentoo Authors
4
4
# Distributed under the terms of the GNU General Public License v2
5
5
@@ -1902,8 +1902,10 @@ bootstrap_stage2() {
1902
1902
emerge_pkgs --nodeps " ${pkgs[@]} " || return 1
1903
1903
1904
1904
# Debian multiarch supported by RAP needs ld to support sysroot.
1905
- EXTRA_ECONF=$( rapx --with-sysroot=/) \
1906
- emerge_pkgs --nodeps ${linker} || return 1
1905
+ for pkg in ${linker} ; do
1906
+ EXTRA_ECONF=$( rapx --with-sysroot=/) \
1907
+ emerge_pkgs --nodeps " ${pkg} " || return 1
1908
+ done
1907
1909
1908
1910
# During Gentoo prefix bootstrap stage2, GCC is built with
1909
1911
# "--disable-bootstrap". For Darwin, it means that rather than letting
@@ -1941,7 +1943,7 @@ bootstrap_stage2() {
1941
1943
OVERRIDE_CXXFLAGS=" ${CPPFLAGS} ${OVERRIDE_CXXFLAGS} " \
1942
1944
TPREFIX=" ${ROOT} " \
1943
1945
PYTHON_COMPAT_OVERRIDE=python$( python_ver) \
1944
- emerge_pkgs --nodeps ${pkg} || return 1
1946
+ emerge_pkgs --nodeps " ${pkg} " || return 1
1945
1947
1946
1948
if [[ " ${pkg} " == * sys-devel/llvm* || ${pkg} == * sys-devel/clang* ]] ;
1947
1949
then
@@ -1972,7 +1974,9 @@ bootstrap_stage2() {
1972
1974
# multilib.eclass -- can't blame it at this point really)
1973
1975
# do it ourselves here to make the bootstrap continue
1974
1976
if [[ -x " ${ROOT} " /tmp/usr/bin/${CHOST} -clang ]] ; then
1975
- ( cd " ${ROOT} " /tmp/usr/bin && ln -s clang ${CHOST} -clang && ln -s clang++ ${CHOST} -clang++ )
1977
+ ( cd " ${ROOT} " /tmp/usr/bin && \
1978
+ ln -s clang " ${CHOST} -clang" && \
1979
+ ln -s clang++ " ${CHOST} -clang++" )
1976
1980
fi
1977
1981
elif ! is-rap ; then
1978
1982
# make sure the EPREFIX gcc shared libraries are there
@@ -1990,11 +1994,11 @@ bootstrap_stage2_log() {
1990
1994
echo " CHOST: ${CHOST} "
1991
1995
echo " IDENT: ${CHOST_IDENTIFY} "
1992
1996
echo " ==========================================="
1993
- } >> ${ROOT} /stage2.log
1994
- bootstrap_stage2 " ${@ } " 2>&1 | tee -a ${ROOT} /stage2.log
1997
+ } >> " ${ROOT} " /stage2.log
1998
+ bootstrap_stage2 " ${@ } " 2>&1 | tee -a " ${ROOT} " /stage2.log
1995
1999
local ret=${PIPESTATUS[0]}
1996
2000
[[ ${ret} == 0 ]] && touch " ${ROOT} /.stage2-finished"
1997
- return ${ret}
2001
+ return " ${ret} "
1998
2002
}
1999
2003
2000
2004
bootstrap_stage3 () {
@@ -2038,7 +2042,7 @@ bootstrap_stage3() {
2038
2042
# tmp, we basically made the system unusable, so remove python-exec
2039
2043
# here so we can use the python in tmp
2040
2044
for pef in python{,3} python{,3}-config ; do
2041
- rm -f " ${ROOT} " /tmp/usr/bin/${pef}
2045
+ rm -f " ${ROOT} /tmp/usr/bin/${pef} "
2042
2046
[[ ${pef} == * -config ]] && ppf=-config || ppf=
2043
2047
( cd " ${ROOT} " /tmp/usr/bin && \
2044
2048
ln -s " python$( python_ver) ${ppf} " " ${pef} " )
@@ -2084,13 +2088,13 @@ bootstrap_stage3() {
2084
2088
# packages installed end up in ROOT/tmp, which means we keep using
2085
2089
# stage2 area and config which breaks things like binutils-config'
2086
2090
# path search, so don't use this
2087
- with_stack_emerge_pkgs () {
2088
- # keep FEATURES=stacked-prefix until we bump portage in stage1
2089
- FEATURES=" ${FEATURES} stacked-prefix" \
2090
- USE=" ${USE} prefix-stack" \
2091
- PORTAGE_OVERRIDE_EPREFIX=" ${ROOT} /tmp" \
2092
- emerge_pkgs " $@ "
2093
- }
2091
+ # with_stack_emerge_pkgs() {
2092
+ # # keep FEATURES=stacked-prefix until we bump portage in stage1
2093
+ # FEATURES="${FEATURES} stacked-prefix" \
2094
+ # USE="${USE} prefix-stack" \
2095
+ # PORTAGE_OVERRIDE_EPREFIX="${ROOT}/tmp" \
2096
+ # emerge_pkgs "$@"
2097
+ # }
2094
2098
2095
2099
# pre_emerge_pkgs relies on stage 2 portage, but installs into the
2096
2100
# final destination Prefix
@@ -2116,7 +2120,9 @@ bootstrap_stage3() {
2116
2120
cp -a " ${ROOT} " {/tmp,}/usr/share/portage
2117
2121
fi
2118
2122
2123
+ local -a linker_pkgs compiler_pkgs
2119
2124
read -r -a linker_pkgs <<< " ${linker}"
2125
+ read -r -a compiler_pkgs <<< " ${compiler}"
2120
2126
2121
2127
if is-rap ; then
2122
2128
# We need ${ROOT}/usr/bin/perl to merge glibc.
@@ -2222,7 +2228,7 @@ bootstrap_stage3() {
2222
2228
fi
2223
2229
# remove stage2 ld so that stage3 ld is used by stage2 gcc.
2224
2230
is-rap && [[ -f ${ROOT} /tmp/usr/${CHOST} /bin/ld ]] && \
2225
- mv ${ROOT} /tmp/usr/${CHOST} /bin/ld{,.stage2}
2231
+ mv " ${ROOT} /tmp/usr/${CHOST} /bin" /ld{,.stage2}
2226
2232
2227
2233
# On some hosts, gcc gets confused now when it uses the new linker,
2228
2234
# see for instance bug #575480. While we would like to hide that
@@ -2241,10 +2247,10 @@ bootstrap_stage3() {
2241
2247
2242
2248
# Try to get ourself out of the mud, bug #575324
2243
2249
EXTRA_ECONF=" --disable-compiler-version-checks $( rapx ' --disable-lto --disable-bootstrap' ) " \
2244
- GCC_MAKE_TARGET=$( rapx all) \
2250
+ GCC_MAKE_TARGET=" $( rapx all) " \
2245
2251
MYCMAKEARGS=" -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \
2246
- PYTHON_COMPAT_OVERRIDE=python$( python_ver) \
2247
- pre_emerge_pkgs --nodeps ${compiler} || return 1
2252
+ PYTHON_COMPAT_OVERRIDE=" python$( python_ver) " \
2253
+ pre_emerge_pkgs --nodeps " ${compiler_pkgs[@]} " || return 1
2248
2254
2249
2255
# Undo libgcc_s.so path of stage2
2250
2256
# Now we have the compiler right there
@@ -2348,11 +2354,11 @@ bootstrap_stage3_log() {
2348
2354
echo " CHOST: ${CHOST} "
2349
2355
echo " IDENT: ${CHOST_IDENTIFY} "
2350
2356
echo " ==========================================="
2351
- } >> ${ROOT} /stage3.log
2352
- bootstrap_stage3 " ${@ } " 2>&1 | tee -a ${ROOT} /stage3.log
2357
+ } >> " ${ROOT} " /stage3.log
2358
+ bootstrap_stage3 " ${@ } " 2>&1 | tee -a " ${ROOT} " /stage3.log
2353
2359
local ret=${PIPESTATUS[0]}
2354
2360
[[ ${ret} == 0 ]] && touch " ${ROOT} /.stage3-finished"
2355
- return ${ret}
2361
+ return " ${ret} "
2356
2362
}
2357
2363
2358
2364
set_helper_vars () {
@@ -2403,7 +2409,7 @@ bootstrap_interactive() {
2403
2409
2404
2410
EOF
2405
2411
[[ ${TODO} == ' noninteractive' ]] && ans=yes ||
2406
- read -p " Do you want me to start off now? [Yn] " ans
2412
+ read -r - p " Do you want me to start off now? [Yn] " ans
2407
2413
case " ${ans} " in
2408
2414
[Yy][Ee][Ss]|[Yy]|" " )
2409
2415
: ;;
0 commit comments