diff options
author | 2004-10-22 05:30:23 +0000 | |
---|---|---|
committer | 2004-10-22 05:30:23 +0000 | |
commit | 07a6b43010f7c37ed68f128a9f68426d9ac88b78 (patch) | |
tree | 0200b75ca35ad6cd0086ed43900d3b61a29da3b4 /scripts | |
parent | Fixed some more filtering that needed to be done for pic stuff to work. (Mani... (diff) | |
download | gentoo-2-07a6b43010f7c37ed68f128a9f68426d9ac88b78.tar.gz gentoo-2-07a6b43010f7c37ed68f128a9f68426d9ac88b78.tar.bz2 gentoo-2-07a6b43010f7c37ed68f128a9f68426d9ac88b78.zip |
Removing depracated bootstrap-2.6.sh and bootstrap.sh. Renaming bootstrap-cascade.sh to bootstrap.sh. So let it be written. So let it be done.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bootstrap-2.6.sh | 293 | ||||
-rw-r--r-- | scripts/bootstrap-cascade.sh | 274 | ||||
-rwxr-xr-x | scripts/bootstrap.sh | 309 |
3 files changed, 161 insertions, 715 deletions
diff --git a/scripts/bootstrap-2.6.sh b/scripts/bootstrap-2.6.sh deleted file mode 100644 index 08c6143310e2..000000000000 --- a/scripts/bootstrap-2.6.sh +++ /dev/null @@ -1,293 +0,0 @@ -#!/bin/bash -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License, v2 -# $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap-2.6.sh,v 1.11 2004/08/19 14:19:34 vapier Exp $ - -# IMPORTANT NOTE: -# This script no longer accepts an optional argument. -# It was removed by the same person who added it -- me, drobbins -- when I optimized -# bootstrap to complete 20 mins to 2 hours faster, depending on CPU. I did this by -# merging both stages of bootstrap into a single stage. We no longer compile gcc and -# binutils twice. Doing this is unnecessary and a holdover from very early versions -# of Gentoo, where we were being ultra-paranoid. - -# (drobbins, 06 Jun 2003) - -unset STRAP_EMERGE_OPTS -STRAP_RUN=1 -if [ "$1" = "--fetchonly" -o "$1" = "-f" ] -then - echo "Running in fetch-only mode..." - STRAP_EMERGE_OPTS="-f" - unset STRAP_RUN -elif [ "$1" = "-h" -o "$1" = "--help" ] -then - echo "bootstrap.sh: Please run with no arguments to start bootstrap, or specify" - echo "--fetchonly or -f to download source archives only. -h/--help displays this" - echo "help." - exit 1 -fi - -MYPROFILEDIR="`readlink -f /etc/make.profile`" -if [ ! -d "${MYPROFILEDIR}" ] -then - echo "!!! Error: '${MYPROFILEDIR}' does not exist. Exiting." - exit 1 -fi - -if [ -f "${MYPROFILEDIR}/parent" ] -then - echo "!!! Error: You must use 'bootstrap-cascade.sh' with cascading profiles. Exiting." - exit 1 -fi - -if [ -e /usr/bin/spython ] -then - # 1.0_rc6 and earlier - PYTHON="/usr/bin/spython" -else - # 1.0 and later - PYTHON="/usr/bin/python" -fi - -if [ -e /etc/init.d/functions.sh ] -then - source /etc/init.d/functions.sh - - # Use our own custom script, else logger cause things to - # 'freeze' if we do not have a system logger running - esyslog() { - echo &> /dev/null - } -fi -if [ -e /etc/profile ] -then - source /etc/profile -fi - -echo -echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; \e[34;01mhttp://www.gentoo.org/${NORMAL}" -echo -e "Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL" -if [ "${STRAP_EMERGE_OPTS}" = "-f" ] -then - echo "Fetching all bootstrap-related archives..." -else - echo "Starting Bootstrap of base system ..." -fi -echo - -# This should not be set to get glibc to build properly. See bug #7652. -LD_LIBRARY_PATH= - -# We do not want stray $TMP, $TMPDIR or $TEMP settings -unset TMP TMPDIR TEMP - -cleanup() { - if [ -n "${STRAP_RUN}" ] - then - if [ -f /etc/make.conf.build ] - then - mv -f /etc/make.conf.build /etc/make.conf - fi - fi - exit $1 -} - -# Trap ctrl-c and stuff. This should fix the users make.conf -# not being restored. -if [ -n "${STRAP_RUN}" ] -then - cp -f /etc/make.conf /etc/make.conf.build -fi - -#TSTP messes ^Z of bootstrap up, so we don't trap it anymore. -trap "cleanup" TERM KILL INT QUIT ABRT - -# USE may be set from the environment so we back it up for later. -export ORIGUSE="`${PYTHON} -c 'import portage; print portage.settings["USE"];'`" - -# Check for 'build' or 'bootstrap' in USE ... -INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" ' - BEGIN { - if (ORIGUSE ~ /[[:space:]]*(build|bootstrap)[[:space:]]*/) - print "yes" - }'`" - -# Do not do the check for stage build scripts ... -if [ "${INVALID_USE}" = "yes" ] -then - echo - eerror "You have 'build' or 'bootstrap' in your USE flags. Please" - eerror "remove it before trying to continue, since these USE flags" - eerror "are used for internal purposes and shouldn't be specified" - eerror "by you." - echo - cleanup 1 -fi - -# bug #50158 -# if ! which portageq &>/dev/null -if type -path portageq &>/dev/null -then - # Check if the user have 'nptl' in USE, and if so, check if we - # have proper linux headers ... - if [ "${ORIGUSE}" != "${ORIGUSE/nptl}" -a \ - "${ORIGUSE}" = "${ORIGUSE/-nptl}" ] && \ - [ -z "`portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0'`" ] - then - echo - eerror "You need to have >=sys-kernel/linux26-headers-2.6.0 unmasked!" - eerror "Please edit the latest >=sys-kernel/linux26-headers-2.6.0 package," - eerror "and add your ARCH to KEYWORDS." - echo - cleanup 1 - fi -else - echo - eerror "Your portage version is too old. Please use a later stage1 image." - echo - cleanup 1 -fi - -# We really need to upgrade baselayout now that it's possible: -myBASELAYOUT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/baselayout | sed 's:^\*::'` -myPORTAGE=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/portage | sed 's:^\*::'` -myGETTEXT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gettext | sed 's:^\*::'` -# Not all profiles have gettest in the system profile anymore ... -[ -z "${myGETTEXT}" ] && myGETTEXT="sys-devel/gettext" -myBINUTILS=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/binutils | sed 's:^\*::'` -myGCC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gcc | sed 's:^\*::'` -myVOS_HEADERS=`cat ${MYPROFILEDIR}/virtuals | grep -v '^#' | grep virtual/os-headers | awk '{print $2}'` -myOS_HEADERS=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep ${myVOS_HEADERS} | sed 's:^\*::'` - -if [ -z "${myOS_HEADERS}" ]; then - myOS_HEADERS=${myVOS_HEADERS} -fi - -myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-libs/glibc | sed 's:^\*::'` -# for non-glibc based systems such as uClibc -[ -z "${myGLIBC}" ] && myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep virtual/libc | awk '{print $2}'` && myGETTEXT="" -myTEXINFO=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-apps/texinfo |sed 's:^\*::'` -myZLIB=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/zlib |sed 's:^\*::'` -myNCURSES=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/ncurses |sed 's:^\*::'` - -echo "Using ${myBASELAYOUT}" -echo "Using ${myPORTAGE}" -echo "Using ${myBINUTILS}" -echo "Using ${myGCC}" -echo "Using ${myGETTEXT}" -echo "Using ${myOS_HEADERS}" -echo "Using ${myGLIBC}" -echo "Using ${myTEXINFO}" -echo "Using ${myZLIB}" -echo "Using ${myNCURSES}" -echo - -echo "Configuring environment..." -export GENTOO_MIRRORS="`${PYTHON} -c 'import portage; print portage.settings["GENTOO_MIRRORS"];'`" - -export PORTDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTDIR"];'`" -export DISTDIR="`${PYTHON} -c 'import portage; print portage.settings["DISTDIR"];'`" -export PKGDIR="`${PYTHON} -c 'import portage; print portage.settings["PKGDIR"];'`" -export PORTAGE_TMPDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTAGE_TMPDIR"];'`" - -# Get correct CFLAGS, CHOST, CXXFLAGS, MAKEOPTS since make.conf will be -# overwritten -export CFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CFLAGS"];'`" -export CHOST="`${PYTHON} -c 'import portage; print portage.settings["CHOST"];'`" -export CXXFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CXXFLAGS"];'`" -export MAKEOPTS="`${PYTHON} -c 'import portage; print portage.settings["MAKEOPTS"];'`" -#to make it easier to get experimental bootstraps: -export ACCEPT_KEYWORDS="`${PYTHON} -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];'`" - -PROXY="`${PYTHON} -c 'import portage; print portage.settings["PROXY"];'`" -if [ -n "${PROXY}" ] -then - echo "exporting PROXY=${PROXY}" - export PROXY -fi -HTTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["HTTP_PROXY"];'`" -if [ -n "${HTTP_PROXY}" ] -then - echo "exporting HTTP_PROXY=${HTTP_PROXY}" - export HTTP_PROXY -fi -FTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["FTP_PROXY"];'`" -if [ -n "${FTP_PROXY}" ] -then - echo "exporting FTP_PROXY=${FTP_PROXY}" - export FTP_PROXY -fi -if [ -x /usr/bin/gcc-config ] -then - GCC_CONFIG="/usr/bin/gcc-config" - -elif [ -x /usr/sbin/gcc-config ] -then - GCC_CONFIG="/usr/sbin/gcc-config" -fi - -# Disable autoclean, or it b0rks -export AUTOCLEAN="no" - -# Allow portage to overwrite stuff -export CONFIG_PROTECT="-*" - -USE="-* build bootstrap" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1 - -export USE="${ORIGUSE} bootstrap" -emerge ${STRAP_EMERGE_OPTS} ${myOS_HEADERS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1 - -# If say both gcc and binutils was build for i486, and we then merge -# binutils for i686 without removing the i486 version (Note that this is -# _only_ when its exactly the same version of binutils ... if we have say -# 2.14.90.0.6 build for i486, and bootstrap then merge 2.14.90.0.7 for i686, -# we will not have issues. More below ...), gcc's search path will -# still have -# -# /usr/lib/gcc-lib/i486-pc-linux-gnu/<gcc_version>/../../../../i486-pc-linux-gnu/bin/ -# -# before /usr/bin, and thus it will use the i486 versions of binutils binaries -# which causes issues. The reason for this issues is that when bootstrap merge -# exactly the same version for i686, both will have installed the same files to -# /usr/lib, and thus also USE the same libraries, cause as/ld to fail with -# unresolved symbols during compiling/linking. -# -# More info on this can be found by looking at bug #32140: -# -# http://bugs.gentoo.org/show_bug.cgi?id=32140 -# -# We now thus run an 'emerge clean' just after merging binutils ... -# -# NB: thanks to <rac@gentoo.org> for bringing me on the right track -# (http://forums.gentoo.org/viewtopic.php?t=100263) -# -# <azarah@gentoo.org> (1 Nov 2003) -if [ -n "${STRAP_RUN}" ] -then - emerge clean || cleanup 1 -fi - -emerge ${STRAP_EMERGE_OPTS} ${myGCC} || cleanup 1 - -# Basic support for gcc multi version/arch scheme ... -if [ -n "${STRAP_RUN}" ] -then - if test -x ${GCC_CONFIG} &>/dev/null && \ - ${GCC_CONFIG} --get-current-profile &>/dev/null - then - # Make sure we get the old gcc unmerged ... - emerge clean || cleanup 1 - # Make sure the profile and /lib/cpp and /usr/bin/cc are valid ... - ${GCC_CONFIG} "`${GCC_CONFIG} --get-current-profile`" &>/dev/null - fi -fi - -emerge ${STRAP_EMERGE_OPTS} ${myGLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1 -# ncurses-5.3 and up also build c++ bindings, so we need to rebuild it -export USE="${ORIGUSE}" -emerge ${STRAP_EMERGE_OPTS} ${myNCURSES} || cleanup 1 - -# Restore original make.conf -cleanup 0 - diff --git a/scripts/bootstrap-cascade.sh b/scripts/bootstrap-cascade.sh deleted file mode 100644 index 2866bd793b06..000000000000 --- a/scripts/bootstrap-cascade.sh +++ /dev/null @@ -1,274 +0,0 @@ -#!/bin/bash -# Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap-cascade.sh,v 1.17 2004/10/18 13:43:53 vapier Exp $ - -# people who were here: -# (drobbins, 06 Jun 2003) -# (solar, Jul 2004) -# (vapier, Aug 2004) - -if [ -e /etc/init.d/functions.sh ] ; then - source /etc/init.d/functions.sh - - # Use our own custom script, else logger cause things to - # 'freeze' if we do not have a system logger running - esyslog() { - echo &> /dev/null - } -fi - -unset STRAP_EMERGE_OPTS -STRAP_RUN=1 -DEBUG=0 - -for opt in "$@" ; do - case "${opt}" in - --fetchonly|-f) - echo "Running in fetch-only mode ..." - STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -f" - unset STRAP_RUN;; - --help|-h) - echo -e "Usage: ${HILITE}bootstrap-cascade.sh${NORMAL} ${GOOD}[options]${NORMAL}" - echo -e " ${GOOD}--fetchonly (-f)${NORMAL} Just download all the source files" - echo -e " ${GOOD}--info (-i)${NORMAL} Show system related information" - echo -e " ${GOOD}--pretend (-p)${NORMAL} Display the packages that will be merged" - echo -e " ${GOOD}--resume (-r)${NORMAL} Build/use binary packages" - echo -e " ${GOOD}--debug (-d)${NORMAL} Run with debug information turned on" - exit 1;; - --info|-i) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --info" ; unset STRAP_RUN ;; - --pretend|-p) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -p" ; unset STRAP_RUN ;; - --resume|-r) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --usepkg --buildpkg";; - --verbose|-v) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -v";; - --debug|-d) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --debug"; DEBUG=1;; - *) ;; - esac -done - -MYPROFILEDIR="$(readlink -f /etc/make.profile)" -if [ ! -d "${MYPROFILEDIR}" ] ; then - echo "!!! Error: '${MYPROFILEDIR}' does not exist. Exiting." - exit 1 -fi - -# spython is 1.0_rc6 and earlier and python is 1.0 and later -[ -e /usr/bin/spython ] && PYTHON="/usr/bin/spython" || PYTHON="/usr/bin/python" - -[ -e /etc/profile ] && source /etc/profile - -echo -e "\n${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}" -echo -e "Copyright 1999-2004 Gentoo Foundation; Distributed under the GPLv2" -if [ "${STRAP_EMERGE_OPTS:0:2}" = "-f" ]; then - echo "Fetching all bootstrap-related archives ..." -else - echo "Starting Bootstrap of base system ..." -fi -echo ------------------------------------------------------------------------------- - -# This should not be set to get glibc to build properly. See bug #7652. -unset LD_LIBRARY_PATH - -# We do not want stray $TMP, $TMPDIR or $TEMP settings -unset TMP TMPDIR TEMP - -cleanup() { - if [ -n "${STRAP_RUN}" ]; then - if [ -f /etc/make.conf.build ]; then - mv -f /etc/make.conf.build /etc/make.conf - fi - fi - exit $1 -} - -pycmd() { - [ "${DEBUG}" = 1 ] && echo ${PYTHON} -c "$@" > /dev/stderr - ${PYTHON} -c "$@" -} - -# Trap ctrl-c and stuff. This should fix the users make.conf -# not being restored. -[ -n "${STRAP_RUN}" ] && cp -f /etc/make.conf /etc/make.conf.build - -#TSTP messes ^Z of bootstrap up, so we don't trap it anymore. -trap "cleanup" TERM KILL INT QUIT ABRT - -# USE may be set from the environment so we back it up for later. -export ORIGUSE="$(pycmd 'import portage; print portage.settings["USE"];')" - -# Check for 'build' or 'bootstrap' in USE ... -INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" ' - BEGIN { - if (ORIGUSE ~ /[[:space:]]*(build|bootstrap)[[:space:]]*/) - print "yes" - }'`" - -# Do not do the check for stage build scripts ... -if [ "${INVALID_USE}" = "yes" ]; then - echo - eerror "You have 'build' or 'bootstrap' in your USE flags. Please" - eerror "remove it before trying to continue, since these USE flags" - eerror "are used for internal purposes and shouldn't be specified" - eerror "by you." - echo - cleanup 1 -fi - -# bug #50158 (don't use `which` in a bootstrap). -if ! type -path portageq &>/dev/null; then - echo - eerror "Your portage version is too old. Please use a newer stage1 image." - echo - cleanup 1 -fi - -# gettext should only be needed when used with nls -for opt in ${ORIGUSE} ; do - case "${opt}" in - nls) myGETTEXT="gettext";; - nptl) - if [ -z "`portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0'`" ]; then - eerror "You need to have >=sys-kernel/linux26-headers-2.6.0 unmasked!" - eerror "Please edit the latest >=sys-kernel/linux26-headers-2.6.0 package," - eerror "and add your ARCH to KEYWORDS." - echo - cleanup 1 - fi - USE_NPTL=1 - ;; - esac -done - -# With cascading profiles, the packages profile at the leaf is not a -# complete system, just the restrictions to it for the specific profile. -# The complete profile consists of an aggregate of the leaf and all its -# parents. So we now call portage to read the aggregate profile and store -# that into a variable. - -eval $(pycmd 'import portage; print portage.settings.packages;' | -sed 's/[][,]//g; s/ /\n/g; s/\*//g' | while read p; do n=${p##*/}; n=${n%\'}; -n=${n%%-[0-9]*}; echo "my$(tr a-z- A-Z_ <<<$n)=$p; "; done) - -# this stuff should never fail but will if not enough is installed. -#[ "${myBASELAYOUT}" = "" ] && myBASELAYOUT="$(portageq best_version / virtual/baselayout)" -[ "${myBASELAYOUT}" = "" ] && myBASELAYOUT="baselayout" -[ "${myPORTAGE}" = "" ] && myPORTAGE="portage" -[ "${myBINUTILS}" = "" ] && myBINUTILS="binutils" -[ "${myGCC}" = "" ] && myGCC="gcc" -[ "${myLIBC}" = "" ] && myLIBC="virtual/libc" -[ "${myTEXINFO}" = "" ] && myTEXINFO="sys-apps/texinfo" -[ "${myZLIB}" = "" ] && myZLIB="zlib" -[ "${myNCURSES}" = "" ] && myNCURSES="ncurses" - -# Do we really have no 2.4.x nptl kernels in portage? -if [ "${USE_NPTL}" = 1 ]; then - myOS_HEADERS="$(portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0')" - [ "${myOS_HEADERS}" != "" ] && myOS_HEADERS=">=${myOS_HEADERS}" -fi -[ "${myOS_HEADERS}" = "" ] && myOS_HEADERS="virtual/os-headers" - -einfo "Using baselayout : ${myBASELAYOUT}" -einfo "Using portage : ${myPORTAGE}" -einfo "Using os-headers : ${myOS_HEADERS}" -einfo "Using binutils : ${myBINUTILS}" -einfo "Using gcc : ${myGCC}" -[ "${myGETTEXT}" != "" ] && einfo "Using gettext : ${myGETTEXT}" -einfo "Using libc : ${myLIBC}" -einfo "Using texinfo : ${myTEXINFO}" -einfo "Using zlib : ${myZLIB}" -einfo "Using ncurses : ${myNCURSES}" -echo ------------------------------------------------------------------------------- -echo "Configuring environment ..." - -# Get correct CFLAGS, CHOST, CXXFLAGS, MAKEOPTS since make.conf will be -# overwritten. - -ENV_EXPORTS="GENTOO_MIRRORS PORTDIR DISTDIR PKGDIR PORTAGE_TMPDIR - CFLAGS CHOST CXXFLAGS MAKEOPTS ACCEPT_KEYWORDS PROXY HTTP_PROXY - FTP_PROXY FEATURES STAGE1_USE" - -for opt in ${ENV_EXPORTS}; do - val=$(pycmd 'import portage; print portage.settings["'${opt}'"];' ) - if [ "${val}" != "" ]; then - einfo "${opt}='${val}'" - export ${opt}="${val}" - fi -done -echo ------------------------------------------------------------------------------- - -[ -x /usr/sbin/gcc-config ] && GCC_CONFIG="/usr/sbin/gcc-config" -[ -x /usr/bin/gcc-config ] && GCC_CONFIG="/usr/bin/gcc-config" - -# Disable autoclean, or it b0rks -export AUTOCLEAN="no" - -# Allow portage to overwrite stuff -export CONFIG_PROTECT="-*" - -# disable collision-protection -export FEATURES="${FEATURES} -collision-protect" - -USE="-* build bootstrap ${STAGE1_USE}" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1 -echo ------------------------------------------------------------------------------- -export USE="${ORIGUSE} bootstrap ${STAGE1_USE}" - -# We can't unmerge headers which may or may not exist yet. If your -# trying to use nptl, it may be needed to flush out any old headers -# before fully bootstrapping. -#emerge ${STRAP_EMERGE_OPTS} -C virtual/os-headers || cleanup 1 -emerge ${STRAP_EMERGE_OPTS} ${myOS_HEADERS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1 -echo ------------------------------------------------------------------------------- - -# If say both gcc and binutils were built for i486, and we then merge -# binutils for i686 without removing the i486 version (Note that this is -# _only_ when its exactly the same version of binutils ... if we have say -# 2.14.90.0.6 build for i486, and bootstrap then merge 2.14.90.0.7 for i686, -# we will not have issues. More below ...), gcc's search path will -# still have -# -# /usr/lib/gcc-lib/i486-pc-linux-gnu/<gcc_version>/../../../../i486-pc-linux-gnu/bin/ -# -# before /usr/bin, and thus it will use the i486 versions of binutils binaries -# which causes issues. The reason for this issues is that when bootstrap merge -# exactly the same version for i686, both will have installed the same files to -# /usr/lib, and thus also USE the same libraries, cause as/ld to fail with -# unresolved symbols during compiling/linking. -# -# More info on this can be found by looking at bug #32140: -# -# http://bugs.gentoo.org/show_bug.cgi?id=32140 -# -# We now thus run an 'emerge clean' just after merging binutils ... -# -# NB: thanks to <rac@gentoo.org> for bringing me on the right track -# (http://forums.gentoo.org/viewtopic.php?t=100263) -# -# <azarah@gentoo.org> (1 Nov 2003) -if [ -n "${STRAP_RUN}" ]; then - emerge clean || cleanup 1 -fi - -emerge ${STRAP_EMERGE_OPTS} ${myGCC} || cleanup 1 -echo ------------------------------------------------------------------------------- - -# Basic support for gcc multi version/arch scheme ... -if [ -n "${STRAP_RUN}" ]; then - if test -x ${GCC_CONFIG} &>/dev/null && \ - ${GCC_CONFIG} --get-current-profile &>/dev/null - then - # Make sure we get the old gcc unmerged ... - emerge clean || cleanup 1 - # Make sure the profile and /lib/cpp and /usr/bin/cc are valid ... - ${GCC_CONFIG} "`${GCC_CONFIG} --get-current-profile`" &>/dev/null - fi -fi - -emerge ${STRAP_EMERGE_OPTS} ${myLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1 -echo ------------------------------------------------------------------------------- - -# ncurses-5.3 and up also build c++ bindings, so we need to rebuild it -export USE="${ORIGUSE}" -emerge ${STRAP_EMERGE_OPTS} ${myNCURSES} || cleanup 1 -echo ------------------------------------------------------------------------------- - -# Restore original make.conf -cleanup 0 diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 9d5d2758dd36..cb687f01c348 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -1,57 +1,14 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation -# Distributed under the terms of the GNU General Public License, v2 -# $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap.sh,v 1.58 2004/08/18 02:39:27 vapier Exp $ - -# IMPORTANT NOTE: -# This script no longer accepts an optional argument. -# It was removed by the same person who added it -- me, drobbins -- when I optimized -# bootstrap to complete 20 mins to 2 hours faster, depending on CPU. I did this by -# merging both stages of bootstrap into a single stage. We no longer compile gcc and -# binutils twice. Doing this is unnecessary and a holdover from very early versions -# of Gentoo, where we were being ultra-paranoid. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap.sh,v 1.59 2004/10/22 05:30:23 wolf31o2 Exp $ +# people who were here: # (drobbins, 06 Jun 2003) +# (solar, Jul 2004) +# (vapier, Aug 2004) -unset STRAP_EMERGE_OPTS -STRAP_RUN=1 -if [ "$1" = "--fetchonly" -o "$1" = "-f" ] -then - echo "Running in fetch-only mode..." - STRAP_EMERGE_OPTS="-f" - unset STRAP_RUN -elif [ "$1" = "-h" -o "$1" = "--help" ] -then - echo "bootstrap.sh: Please run with no arguments to start bootstrap, or specify" - echo "--fetchonly or -f to download source archives only. -h/--help displays this" - echo "help." - exit 1 -fi - -MYPROFILEDIR="`readlink -f /etc/make.profile`" -if [ ! -d "${MYPROFILEDIR}" ] -then - echo "!!! Error: '${MYPROFILEDIR}' does not exist. Exiting." - exit 1 -fi - -if [ -f "${MYPROFILEDIR}/parent" ] -then - echo "!!! Error: You must use 'bootstrap-cascade.sh' with cascading profiles. Exiting." - exit 1 -fi - -if [ -e /usr/bin/spython ] -then - # 1.0_rc6 and earlier - PYTHON="/usr/bin/spython" -else - # 1.0 and later - PYTHON="/usr/bin/python" -fi - -if [ -e /etc/init.d/functions.sh ] -then +if [ -e /etc/init.d/functions.sh ] ; then source /etc/init.d/functions.sh # Use our own custom script, else logger cause things to @@ -60,51 +17,83 @@ then echo &> /dev/null } fi -if [ -e /etc/profile ] -then - source /etc/profile + +unset STRAP_EMERGE_OPTS +STRAP_RUN=1 +DEBUG=0 + +for opt in "$@" ; do + case "${opt}" in + --fetchonly|-f) + echo "Running in fetch-only mode ..." + STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -f" + unset STRAP_RUN;; + --help|-h) + echo -e "Usage: ${HILITE}bootstrap-cascade.sh${NORMAL} ${GOOD}[options]${NORMAL}" + echo -e " ${GOOD}--fetchonly (-f)${NORMAL} Just download all the source files" + echo -e " ${GOOD}--info (-i)${NORMAL} Show system related information" + echo -e " ${GOOD}--pretend (-p)${NORMAL} Display the packages that will be merged" + echo -e " ${GOOD}--resume (-r)${NORMAL} Build/use binary packages" + echo -e " ${GOOD}--debug (-d)${NORMAL} Run with debug information turned on" + exit 1;; + --info|-i) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --info" ; unset STRAP_RUN ;; + --pretend|-p) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -p" ; unset STRAP_RUN ;; + --resume|-r) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --usepkg --buildpkg";; + --verbose|-v) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} -v";; + --debug|-d) STRAP_EMERGE_OPTS="${STRAP_EMERGE_OPTS} --debug"; DEBUG=1;; + *) ;; + esac +done + +MYPROFILEDIR="$(readlink -f /etc/make.profile)" +if [ ! -d "${MYPROFILEDIR}" ] ; then + echo "!!! Error: '${MYPROFILEDIR}' does not exist. Exiting." + exit 1 fi -echo -echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; \e[34;01mhttp://www.gentoo.org/${NORMAL}" -echo -e "Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL" -if [ "${STRAP_EMERGE_OPTS}" = "-f" ] -then - echo "Fetching all bootstrap-related archives..." +# spython is 1.0_rc6 and earlier and python is 1.0 and later +[ -e /usr/bin/spython ] && PYTHON="/usr/bin/spython" || PYTHON="/usr/bin/python" + +[ -e /etc/profile ] && source /etc/profile + +echo -e "\n${GOOD}Gentoo Linux${GENTOO_VERS}; ${BRACKET}http://www.gentoo.org/${NORMAL}" +echo -e "Copyright 1999-2004 Gentoo Foundation; Distributed under the GPLv2" +if [ "${STRAP_EMERGE_OPTS:0:2}" = "-f" ]; then + echo "Fetching all bootstrap-related archives ..." else echo "Starting Bootstrap of base system ..." fi -echo +echo ------------------------------------------------------------------------------- # This should not be set to get glibc to build properly. See bug #7652. -LD_LIBRARY_PATH= +unset LD_LIBRARY_PATH # We do not want stray $TMP, $TMPDIR or $TEMP settings unset TMP TMPDIR TEMP cleanup() { - if [ -n "${STRAP_RUN}" ] - then - if [ -f /etc/make.conf.build ] - then + if [ -n "${STRAP_RUN}" ]; then + if [ -f /etc/make.conf.build ]; then mv -f /etc/make.conf.build /etc/make.conf fi fi exit $1 } +pycmd() { + [ "${DEBUG}" = 1 ] && echo ${PYTHON} -c "$@" > /dev/stderr + ${PYTHON} -c "$@" +} + # Trap ctrl-c and stuff. This should fix the users make.conf # not being restored. -if [ -n "${STRAP_RUN}" ] -then - cp -f /etc/make.conf /etc/make.conf.build -fi +[ -n "${STRAP_RUN}" ] && cp -f /etc/make.conf /etc/make.conf.build #TSTP messes ^Z of bootstrap up, so we don't trap it anymore. trap "cleanup" TERM KILL INT QUIT ABRT # USE may be set from the environment so we back it up for later. -export ORIGUSE="`${PYTHON} -c 'import portage; print portage.settings["USE"];'`" +export ORIGUSE="$(pycmd 'import portage; print portage.settings["USE"];')" # Check for 'build' or 'bootstrap' in USE ... INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" ' @@ -114,8 +103,7 @@ INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" ' }'`" # Do not do the check for stage build scripts ... -if [ "${INVALID_USE}" = "yes" ] -then +if [ "${INVALID_USE}" = "yes" ]; then echo eerror "You have 'build' or 'bootstrap' in your USE flags. Please" eerror "remove it before trying to continue, since these USE flags" @@ -125,88 +113,112 @@ then cleanup 1 fi -# We really need to upgrade baselayout now that it's possible: -myBASELAYOUT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/baselayout | sed 's:^\*::'` -myPORTAGE=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/portage | sed 's:^\*::'` -myGETTEXT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gettext | sed 's:^\*::'` -# Not all profiles have gettest in the system profile anymore ... -[ -z "${myGETTEXT}" ] && myGETTEXT="sys-devel/gettext" -myBINUTILS=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/binutils | sed 's:^\*::'` -myGCC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gcc | sed 's:^\*::'` -myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-libs/glibc | sed 's:^\*::'` -# for non-glibc based systems such as uClibc -[ -z "${myGLIBC}" ] && myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep virtual/libc | awk '{print $2}'` && myGETTEXT="" -myTEXINFO=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-apps/texinfo |sed 's:^\*::'` -myZLIB=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/zlib |sed 's:^\*::'` -myNCURSES=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/ncurses |sed 's:^\*::'` - -echo "Using ${myBASELAYOUT}" -echo "Using ${myPORTAGE}" -echo "Using ${myBINUTILS}" -echo "Using ${myGCC}" -echo "Using ${myGETTEXT}" -echo "Using ${myGLIBC}" -echo "Using ${myTEXINFO}" -echo "Using ${myZLIB}" -echo "Using ${myNCURSES}" -echo - -echo "Configuring environment..." -export GENTOO_MIRRORS="`${PYTHON} -c 'import portage; print portage.settings["GENTOO_MIRRORS"];'`" - -export PORTDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTDIR"];'`" -export DISTDIR="`${PYTHON} -c 'import portage; print portage.settings["DISTDIR"];'`" -export PKGDIR="`${PYTHON} -c 'import portage; print portage.settings["PKGDIR"];'`" -export PORTAGE_TMPDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTAGE_TMPDIR"];'`" - -# Get correct CFLAGS, CHOST, CXXFLAGS, MAKEOPTS since make.conf will be -# overwritten -export CFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CFLAGS"];'`" -export CHOST="`${PYTHON} -c 'import portage; print portage.settings["CHOST"];'`" -export CXXFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CXXFLAGS"];'`" -export MAKEOPTS="`${PYTHON} -c 'import portage; print portage.settings["MAKEOPTS"];'`" -#to make it easier to get experimental bootstraps: -export ACCEPT_KEYWORDS="`${PYTHON} -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];'`" - -PROXY="`${PYTHON} -c 'import portage; print portage.settings["PROXY"];'`" -if [ -n "${PROXY}" ] -then - echo "exporting PROXY=${PROXY}" - export PROXY -fi -HTTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["HTTP_PROXY"];'`" -if [ -n "${HTTP_PROXY}" ] -then - echo "exporting HTTP_PROXY=${HTTP_PROXY}" - export HTTP_PROXY -fi -FTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["FTP_PROXY"];'`" -if [ -n "${FTP_PROXY}" ] -then - echo "exporting FTP_PROXY=${FTP_PROXY}" - export FTP_PROXY +# bug #50158 (don't use `which` in a bootstrap). +if ! type -path portageq &>/dev/null; then + echo + eerror "Your portage version is too old. Please use a newer stage1 image." + echo + cleanup 1 fi -if [ -x /usr/bin/gcc-config ] -then - GCC_CONFIG="/usr/bin/gcc-config" -elif [ -x /usr/sbin/gcc-config ] -then - GCC_CONFIG="/usr/sbin/gcc-config" +# gettext should only be needed when used with nls +for opt in ${ORIGUSE} ; do + case "${opt}" in + nls) myGETTEXT="gettext";; + nptl) + if [ -z "`portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0'`" ]; then + eerror "You need to have >=sys-kernel/linux26-headers-2.6.0 unmasked!" + eerror "Please edit the latest >=sys-kernel/linux26-headers-2.6.0 package," + eerror "and add your ARCH to KEYWORDS." + echo + cleanup 1 + fi + USE_NPTL=1 + ;; + esac +done + +# With cascading profiles, the packages profile at the leaf is not a +# complete system, just the restrictions to it for the specific profile. +# The complete profile consists of an aggregate of the leaf and all its +# parents. So we now call portage to read the aggregate profile and store +# that into a variable. + +eval $(pycmd 'import portage; print portage.settings.packages;' | +sed 's/[][,]//g; s/ /\n/g; s/\*//g' | while read p; do n=${p##*/}; n=${n%\'}; +n=${n%%-[0-9]*}; echo "my$(tr a-z- A-Z_ <<<$n)=$p; "; done) + +# this stuff should never fail but will if not enough is installed. +#[ "${myBASELAYOUT}" = "" ] && myBASELAYOUT="$(portageq best_version / virtual/baselayout)" +[ "${myBASELAYOUT}" = "" ] && myBASELAYOUT="baselayout" +[ "${myPORTAGE}" = "" ] && myPORTAGE="portage" +[ "${myBINUTILS}" = "" ] && myBINUTILS="binutils" +[ "${myGCC}" = "" ] && myGCC="gcc" +[ "${myLIBC}" = "" ] && myLIBC="virtual/libc" +[ "${myTEXINFO}" = "" ] && myTEXINFO="sys-apps/texinfo" +[ "${myZLIB}" = "" ] && myZLIB="zlib" +[ "${myNCURSES}" = "" ] && myNCURSES="ncurses" + +# Do we really have no 2.4.x nptl kernels in portage? +if [ "${USE_NPTL}" = 1 ]; then + myOS_HEADERS="$(portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0')" + [ "${myOS_HEADERS}" != "" ] && myOS_HEADERS=">=${myOS_HEADERS}" fi +[ "${myOS_HEADERS}" = "" ] && myOS_HEADERS="virtual/os-headers" + +einfo "Using baselayout : ${myBASELAYOUT}" +einfo "Using portage : ${myPORTAGE}" +einfo "Using os-headers : ${myOS_HEADERS}" +einfo "Using binutils : ${myBINUTILS}" +einfo "Using gcc : ${myGCC}" +[ "${myGETTEXT}" != "" ] && einfo "Using gettext : ${myGETTEXT}" +einfo "Using libc : ${myLIBC}" +einfo "Using texinfo : ${myTEXINFO}" +einfo "Using zlib : ${myZLIB}" +einfo "Using ncurses : ${myNCURSES}" +echo ------------------------------------------------------------------------------- +echo "Configuring environment ..." + +# Get correct CFLAGS, CHOST, CXXFLAGS, MAKEOPTS since make.conf will be +# overwritten. + +ENV_EXPORTS="GENTOO_MIRRORS PORTDIR DISTDIR PKGDIR PORTAGE_TMPDIR + CFLAGS CHOST CXXFLAGS MAKEOPTS ACCEPT_KEYWORDS PROXY HTTP_PROXY + FTP_PROXY FEATURES STAGE1_USE" + +for opt in ${ENV_EXPORTS}; do + val=$(pycmd 'import portage; print portage.settings["'${opt}'"];' ) + if [ "${val}" != "" ]; then + einfo "${opt}='${val}'" + export ${opt}="${val}" + fi +done +echo ------------------------------------------------------------------------------- + +[ -x /usr/sbin/gcc-config ] && GCC_CONFIG="/usr/sbin/gcc-config" +[ -x /usr/bin/gcc-config ] && GCC_CONFIG="/usr/bin/gcc-config" # Disable autoclean, or it b0rks export AUTOCLEAN="no" # Allow portage to overwrite stuff export CONFIG_PROTECT="-*" - -USE="-* build bootstrap" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1 -export USE="${ORIGUSE} bootstrap" -emerge ${STRAP_EMERGE_OPTS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1 +# disable collision-protection +export FEATURES="${FEATURES} -collision-protect" + +USE="-* build bootstrap ${STAGE1_USE}" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1 +echo ------------------------------------------------------------------------------- +export USE="${ORIGUSE} bootstrap ${STAGE1_USE}" + +# We can't unmerge headers which may or may not exist yet. If your +# trying to use nptl, it may be needed to flush out any old headers +# before fully bootstrapping. +#emerge ${STRAP_EMERGE_OPTS} -C virtual/os-headers || cleanup 1 +emerge ${STRAP_EMERGE_OPTS} ${myOS_HEADERS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1 +echo ------------------------------------------------------------------------------- -# If say both gcc and binutils was build for i486, and we then merge +# If say both gcc and binutils were built for i486, and we then merge # binutils for i686 without removing the i486 version (Note that this is # _only_ when its exactly the same version of binutils ... if we have say # 2.14.90.0.6 build for i486, and bootstrap then merge 2.14.90.0.7 for i686, @@ -231,16 +243,15 @@ emerge ${STRAP_EMERGE_OPTS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1 # (http://forums.gentoo.org/viewtopic.php?t=100263) # # <azarah@gentoo.org> (1 Nov 2003) -if [ -n "${STRAP_RUN}" ] -then +if [ -n "${STRAP_RUN}" ]; then emerge clean || cleanup 1 fi emerge ${STRAP_EMERGE_OPTS} ${myGCC} || cleanup 1 +echo ------------------------------------------------------------------------------- # Basic support for gcc multi version/arch scheme ... -if [ -n "${STRAP_RUN}" ] -then +if [ -n "${STRAP_RUN}" ]; then if test -x ${GCC_CONFIG} &>/dev/null && \ ${GCC_CONFIG} --get-current-profile &>/dev/null then @@ -251,11 +262,13 @@ then fi fi -emerge ${STRAP_EMERGE_OPTS} ${myGLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1 +emerge ${STRAP_EMERGE_OPTS} ${myLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1 +echo ------------------------------------------------------------------------------- + # ncurses-5.3 and up also build c++ bindings, so we need to rebuild it export USE="${ORIGUSE}" emerge ${STRAP_EMERGE_OPTS} ${myNCURSES} || cleanup 1 +echo ------------------------------------------------------------------------------- # Restore original make.conf cleanup 0 - |