diff options
-rwxr-xr-x | scripts/bootstrap-prefix.sh | 149 |
1 files changed, 68 insertions, 81 deletions
diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index dfdff4c99e..5ad9f4dc7a 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -474,10 +474,6 @@ bootstrap_profile() { # Disable bootstrapping libcxx* with libunwind sys-libs/libcxxabi -libunwind sys-libs/libcxx -libunwind - # Most binary Linux distributions seem to fancy toolchains that - # do not do c++ support (need to install a separate package). - sys-libs/ncurses -cxx - sys-devel/binutils -cxx EOF # On Darwin we might need this to bootstrap the compiler, since @@ -487,19 +483,6 @@ bootstrap_profile() { # For Darwin bootstraps sys-devel/native-cctools EOF - - # Strange enough, -cxx causes wrong libtool config on Cygwin, - # but we require a C++ compiler there anyway - so just use it. - cat >> "${ROOT}"/etc/portage/make.profile/package.use <<-EOF - # gmp has cxx flag enabled by default. When dealing with a host - # compiler without cxx support this causes configure failure. - # In addition, The stage2 g++ is only for compiling stage3 compiler, - # because the host libstdc++.so runtime may be not compatible and - # stage2 libstdc++.so might conflict with that of stage3. The - # trade-off is just not to use cxx. - dev-libs/gmp -cxx - sys-devel/binutils -gold - EOF } do_tree() { @@ -1822,23 +1805,26 @@ do_emerge_pkgs() { done [[ -n ${pvdb} ]] && continue + # avoid many deps at this stage which aren't necessary, e.g. + # having a bash without readline is OK, we're not using the + # shell interactive local myuse=( - -acl - -berkdb - -fortran - -gdbm - -git - -libcxx - -http2 - -nls - -pcre - -python - -qmanifest -qtegrity - -readline - -sanitize - bootstrap - clang - internal-glib + "${DISABLE_USE[@]}" + "-acl" + "-berkdb" + "-fortran" # gcc + "-gdbm" + "-libcxx" + "-nls" + "-pcre" + "-python" + "-qmanifest" # portage-utils + "-qtegrity" # portage-utils + "-readline" # bash + "-sanitize" + "bootstrap" + "clang" + "internal-glib" ) local override_make_conf_dir="${PORTAGE_OVERRIDE_EPREFIX}${MAKE_CONF_DIR#"${ROOT}"}" @@ -2032,13 +2018,18 @@ bootstrap_stage2() { # unless we only build the buildtool, bug #603012 echo "dev-build/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use + mkdir -p "${ROOT}"/tmp/etc/portage/profile # site-specific overrides if [[ ${CHOST} == *-solaris* ]] ; then # avoid complexities with the host toolchain - sed -i -e '/^sys-devel\/gcc pie$/d' \ - "${PORTDIR}"/profiles/base/package.use.force + echo "sys-devel/gcc -pie" >> \ + "${ROOT}"/tmp/etc/portage/profile/package.use.force echo "sys-devel/gcc -pie" >> "${ROOT}"/tmp/etc/portage/package.use fi + # don't use CET, we don't know if the host compiler supports it + echo "sys-devel/binutils -cet" >> \ + "${ROOT}"/tmp/etc/portage/profile/package.use.force + emerge_pkgs --nodeps "${pkgs[@]}" || return 1 # Debian multiarch supported by RAP needs ld to support sysroot. @@ -2471,8 +2462,10 @@ bootstrap_stage3() { fi # Avoid installing git or encryption just for fun while completing @system - # e.g. bug #901101 - export USE="-git -crypt -http2" + # e.g. bug #901101, this is a reduced (e.g. as minimal as possible) + # set of DISABLE_USE, to set the stage for solving circular + # dependencies, such as: + export USE="${DISABLE_USE[*]}" # Portage should figure out itself what it needs to do, if anything. local eflags=( "--deep" "--update" "--changed-use" "@system" ) @@ -2480,6 +2473,25 @@ bootstrap_stage3() { estatus "stage3: emerge ${eflags[*]}" emerge --color n -v "${eflags[@]}" || return 1 + # gcc no longer depends on sys-devel/binutils which means it is to + # be depcleaned at this point, quite strange, but to prevent this + # from happening, add to the worldfile #936629#c5 + emerge --color n --noreplace sys-devel/binutils + + # Remove the stage2 hack from above. A future emerge run will + # get env-update to happen. + rm "${ROOT}"/etc/env.d/98stage2 + + # now try and get things in the way they should be according to the + # default USE-flags + unset USE + + # re-emerge anything hopefully not running into circular deps + eflags=( "--deep" "--changed-use" "@world" ) + einfo "running emerge ${eflags[*]}" + estatus "stage3: emerge ${eflags[*]}" + emerge --color n -v "${eflags[@]}" || return 1 + # Remove anything that we don't need (compilers most likely) einfo "running emerge --depclean" estatus "stage3: emerge --depclean" @@ -2489,10 +2501,6 @@ bootstrap_stage3() { # (--depclean may fail, which is ok) sed -i -e 's/resume/cleared/' "${ROOT}"/var/cache/edb/mtimedb - # Remove the stage2 hack from above. A future emerge run will - # get env-update to happen. - rm "${ROOT}"/etc/env.d/98stage2 - estatus "stage3 finished" einfo "stage3 successfully finished" } @@ -2524,6 +2532,18 @@ set_helper_vars() { SNAPSHOT_HOST=$(rapx http://distfiles.gentoo.org http://rsync.prefix.bitzolder.nl) SNAPSHOT_URL=${SNAPSHOT_URL:-"${SNAPSHOT_HOST}/snapshots"} + # USE-flags to disable during bootstrap for they produce + # unnecessary, or worse: circular deps #901101, #936629 + # - nghttp2 -> cmake -> curl -> nghttp2 (http2) + DISABLE_USE=( + "-crypt" + "-curl_quic_openssl" # curl + "-git" + "-http2" # curl + "-http3" # curl + "-quic" # curl + ) + export MAKE CONFIG_SHELL } @@ -3130,7 +3150,7 @@ OK! I'm going to give it a try, this is what I have collected sofar: I'm now going to make an awful lot of noise going through a sequence of stages to make your box as groovy as I am myself, setting up your Prefix. In short, I'm going to run stage1, stage2, stage3, followed by -an emerge to do a final update to your system. If any of these stages +installing a package to enter your Prefix. If any of these stages fail, both you and me are in deep trouble. So let's hope that doesn't happen. EOF @@ -3289,47 +3309,14 @@ EOF [[ ${STOP_BOOTSTRAP_AFTER} == stage3 ]] && exit 0 - local cmd="emerge -v --deep --update --changed-use @world" - if [[ -e ${EPREFIX}/var/cache/edb/mtimedb ]] && \ - grep -q resume "${EPREFIX}"/var/cache/edb/mtimedb ; - then - cmd="emerge -v --resume" - fi - einfo "running ${cmd}" - if ${cmd} ; then - # Now, we've got everything in $ROOT, we can get rid of /tmp - if [[ -d ${EPREFIX}/tmp/var/tmp ]] ; then - rm -Rf "${EPREFIX}"/tmp || return 1 - mkdir -p "${EPREFIX}"/tmp || return 1 - fi - - hash -r # tmp/* stuff is removed in stage3 - else - # emerge @world fail - cat << EOF - -Oh yeah, I thought I was almost there, and then this! I did - ${cmd} -and it failed at some point :( Details might be found in the build log: -EOF - for log in "${EPREFIX}"/var/tmp/portage/*/*/temp/build.log ; do - [[ -e ${log} ]] || continue - echo " ${log}" - done - [[ -e ${log} ]] || echo " (no build logs found?!?)" - cat << EOF -I have no clue, really. Please find friendly folks in #gentoo-prefix on -irc.gentoo.org, gentoo-alt@lists.gentoo.org mailing list, or file a bug -at bugs.gentoo.org under Gentoo/Alt, Prefix Support. -You know, I got the feeling you just started to like me, but I guess -that's all gone now. I'll bother you no longer. - - CHOST: ${CHOST} - IDENT: ${CHOST_IDENTIFY} -EOF - exit 1 + # Now, we've got everything in $ROOT, we can get rid of /tmp + if [[ -d ${EPREFIX}/tmp/var/tmp ]] ; then + rm -Rf "${EPREFIX}"/tmp || return 1 + mkdir -p "${EPREFIX}"/tmp || return 1 fi + hash -r # tmp/* stuff is removed in stage3 + if ! bash "${BASH_SOURCE[0]}" "${EPREFIX}" startscript ; then # startscript fail? cat << EOF |