/[gentoo-x86]/scripts/bootstrap-2.6.sh
Gentoo

Contents of /scripts/bootstrap-2.6.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download) (as text)
Fri Oct 22 05:30:23 2004 UTC (14 years, 11 months ago) by wolf31o2
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
File MIME type: text/x-sh
FILE REMOVED
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.

1 #!/bin/bash
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License, v2
4 # $Header: /var/cvsroot/gentoo-x86/scripts/bootstrap-2.6.sh,v 1.11 2004/08/19 14:19:34 vapier Exp $
5
6 # IMPORTANT NOTE:
7 # This script no longer accepts an optional argument.
8 # It was removed by the same person who added it -- me, drobbins -- when I optimized
9 # bootstrap to complete 20 mins to 2 hours faster, depending on CPU. I did this by
10 # merging both stages of bootstrap into a single stage. We no longer compile gcc and
11 # binutils twice. Doing this is unnecessary and a holdover from very early versions
12 # of Gentoo, where we were being ultra-paranoid.
13
14 # (drobbins, 06 Jun 2003)
15
16 unset STRAP_EMERGE_OPTS
17 STRAP_RUN=1
18 if [ "$1" = "--fetchonly" -o "$1" = "-f" ]
19 then
20 echo "Running in fetch-only mode..."
21 STRAP_EMERGE_OPTS="-f"
22 unset STRAP_RUN
23 elif [ "$1" = "-h" -o "$1" = "--help" ]
24 then
25 echo "bootstrap.sh: Please run with no arguments to start bootstrap, or specify"
26 echo "--fetchonly or -f to download source archives only. -h/--help displays this"
27 echo "help."
28 exit 1
29 fi
30
31 MYPROFILEDIR="`readlink -f /etc/make.profile`"
32 if [ ! -d "${MYPROFILEDIR}" ]
33 then
34 echo "!!! Error: '${MYPROFILEDIR}' does not exist. Exiting."
35 exit 1
36 fi
37
38 if [ -f "${MYPROFILEDIR}/parent" ]
39 then
40 echo "!!! Error: You must use 'bootstrap-cascade.sh' with cascading profiles. Exiting."
41 exit 1
42 fi
43
44 if [ -e /usr/bin/spython ]
45 then
46 # 1.0_rc6 and earlier
47 PYTHON="/usr/bin/spython"
48 else
49 # 1.0 and later
50 PYTHON="/usr/bin/python"
51 fi
52
53 if [ -e /etc/init.d/functions.sh ]
54 then
55 source /etc/init.d/functions.sh
56
57 # Use our own custom script, else logger cause things to
58 # 'freeze' if we do not have a system logger running
59 esyslog() {
60 echo &> /dev/null
61 }
62 fi
63 if [ -e /etc/profile ]
64 then
65 source /etc/profile
66 fi
67
68 echo
69 echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; \e[34;01mhttp://www.gentoo.org/${NORMAL}"
70 echo -e "Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL"
71 if [ "${STRAP_EMERGE_OPTS}" = "-f" ]
72 then
73 echo "Fetching all bootstrap-related archives..."
74 else
75 echo "Starting Bootstrap of base system ..."
76 fi
77 echo
78
79 # This should not be set to get glibc to build properly. See bug #7652.
80 LD_LIBRARY_PATH=
81
82 # We do not want stray $TMP, $TMPDIR or $TEMP settings
83 unset TMP TMPDIR TEMP
84
85 cleanup() {
86 if [ -n "${STRAP_RUN}" ]
87 then
88 if [ -f /etc/make.conf.build ]
89 then
90 mv -f /etc/make.conf.build /etc/make.conf
91 fi
92 fi
93 exit $1
94 }
95
96 # Trap ctrl-c and stuff. This should fix the users make.conf
97 # not being restored.
98 if [ -n "${STRAP_RUN}" ]
99 then
100 cp -f /etc/make.conf /etc/make.conf.build
101 fi
102
103 #TSTP messes ^Z of bootstrap up, so we don't trap it anymore.
104 trap "cleanup" TERM KILL INT QUIT ABRT
105
106 # USE may be set from the environment so we back it up for later.
107 export ORIGUSE="`${PYTHON} -c 'import portage; print portage.settings["USE"];'`"
108
109 # Check for 'build' or 'bootstrap' in USE ...
110 INVALID_USE="`gawk -v ORIGUSE="${ORIGUSE}" '
111 BEGIN {
112 if (ORIGUSE ~ /[[:space:]]*(build|bootstrap)[[:space:]]*/)
113 print "yes"
114 }'`"
115
116 # Do not do the check for stage build scripts ...
117 if [ "${INVALID_USE}" = "yes" ]
118 then
119 echo
120 eerror "You have 'build' or 'bootstrap' in your USE flags. Please"
121 eerror "remove it before trying to continue, since these USE flags"
122 eerror "are used for internal purposes and shouldn't be specified"
123 eerror "by you."
124 echo
125 cleanup 1
126 fi
127
128 # bug #50158
129 # if ! which portageq &>/dev/null
130 if type -path portageq &>/dev/null
131 then
132 # Check if the user have 'nptl' in USE, and if so, check if we
133 # have proper linux headers ...
134 if [ "${ORIGUSE}" != "${ORIGUSE/nptl}" -a \
135 "${ORIGUSE}" = "${ORIGUSE/-nptl}" ] && \
136 [ -z "`portageq best_visible / '>=sys-kernel/linux26-headers-2.6.0'`" ]
137 then
138 echo
139 eerror "You need to have >=sys-kernel/linux26-headers-2.6.0 unmasked!"
140 eerror "Please edit the latest >=sys-kernel/linux26-headers-2.6.0 package,"
141 eerror "and add your ARCH to KEYWORDS."
142 echo
143 cleanup 1
144 fi
145 else
146 echo
147 eerror "Your portage version is too old. Please use a later stage1 image."
148 echo
149 cleanup 1
150 fi
151
152 # We really need to upgrade baselayout now that it's possible:
153 myBASELAYOUT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/baselayout | sed 's:^\*::'`
154 myPORTAGE=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-apps/portage | sed 's:^\*::'`
155 myGETTEXT=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gettext | sed 's:^\*::'`
156 # Not all profiles have gettest in the system profile anymore ...
157 [ -z "${myGETTEXT}" ] && myGETTEXT="sys-devel/gettext"
158 myBINUTILS=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/binutils | sed 's:^\*::'`
159 myGCC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-devel/gcc | sed 's:^\*::'`
160 myVOS_HEADERS=`cat ${MYPROFILEDIR}/virtuals | grep -v '^#' | grep virtual/os-headers | awk '{print $2}'`
161 myOS_HEADERS=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep ${myVOS_HEADERS} | sed 's:^\*::'`
162
163 if [ -z "${myOS_HEADERS}" ]; then
164 myOS_HEADERS=${myVOS_HEADERS}
165 fi
166
167 myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep sys-libs/glibc | sed 's:^\*::'`
168 # for non-glibc based systems such as uClibc
169 [ -z "${myGLIBC}" ] && myGLIBC=`cat ${MYPROFILEDIR}/packages | grep -v '^#' | grep virtual/libc | awk '{print $2}'` && myGETTEXT=""
170 myTEXINFO=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-apps/texinfo |sed 's:^\*::'`
171 myZLIB=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/zlib |sed 's:^\*::'`
172 myNCURSES=`cat ${MYPROFILEDIR}/packages|grep -v '^#'|grep sys-libs/ncurses |sed 's:^\*::'`
173
174 echo "Using ${myBASELAYOUT}"
175 echo "Using ${myPORTAGE}"
176 echo "Using ${myBINUTILS}"
177 echo "Using ${myGCC}"
178 echo "Using ${myGETTEXT}"
179 echo "Using ${myOS_HEADERS}"
180 echo "Using ${myGLIBC}"
181 echo "Using ${myTEXINFO}"
182 echo "Using ${myZLIB}"
183 echo "Using ${myNCURSES}"
184 echo
185
186 echo "Configuring environment..."
187 export GENTOO_MIRRORS="`${PYTHON} -c 'import portage; print portage.settings["GENTOO_MIRRORS"];'`"
188
189 export PORTDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTDIR"];'`"
190 export DISTDIR="`${PYTHON} -c 'import portage; print portage.settings["DISTDIR"];'`"
191 export PKGDIR="`${PYTHON} -c 'import portage; print portage.settings["PKGDIR"];'`"
192 export PORTAGE_TMPDIR="`${PYTHON} -c 'import portage; print portage.settings["PORTAGE_TMPDIR"];'`"
193
194 # Get correct CFLAGS, CHOST, CXXFLAGS, MAKEOPTS since make.conf will be
195 # overwritten
196 export CFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CFLAGS"];'`"
197 export CHOST="`${PYTHON} -c 'import portage; print portage.settings["CHOST"];'`"
198 export CXXFLAGS="`${PYTHON} -c 'import portage; print portage.settings["CXXFLAGS"];'`"
199 export MAKEOPTS="`${PYTHON} -c 'import portage; print portage.settings["MAKEOPTS"];'`"
200 #to make it easier to get experimental bootstraps:
201 export ACCEPT_KEYWORDS="`${PYTHON} -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];'`"
202
203 PROXY="`${PYTHON} -c 'import portage; print portage.settings["PROXY"];'`"
204 if [ -n "${PROXY}" ]
205 then
206 echo "exporting PROXY=${PROXY}"
207 export PROXY
208 fi
209 HTTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["HTTP_PROXY"];'`"
210 if [ -n "${HTTP_PROXY}" ]
211 then
212 echo "exporting HTTP_PROXY=${HTTP_PROXY}"
213 export HTTP_PROXY
214 fi
215 FTP_PROXY="`${PYTHON} -c 'import portage; print portage.settings["FTP_PROXY"];'`"
216 if [ -n "${FTP_PROXY}" ]
217 then
218 echo "exporting FTP_PROXY=${FTP_PROXY}"
219 export FTP_PROXY
220 fi
221 if [ -x /usr/bin/gcc-config ]
222 then
223 GCC_CONFIG="/usr/bin/gcc-config"
224
225 elif [ -x /usr/sbin/gcc-config ]
226 then
227 GCC_CONFIG="/usr/sbin/gcc-config"
228 fi
229
230 # Disable autoclean, or it b0rks
231 export AUTOCLEAN="no"
232
233 # Allow portage to overwrite stuff
234 export CONFIG_PROTECT="-*"
235
236 USE="-* build bootstrap" emerge ${STRAP_EMERGE_OPTS} ${myPORTAGE} || cleanup 1
237
238 export USE="${ORIGUSE} bootstrap"
239 emerge ${STRAP_EMERGE_OPTS} ${myOS_HEADERS} ${myTEXINFO} ${myGETTEXT} ${myBINUTILS} || cleanup 1
240
241 # If say both gcc and binutils was build for i486, and we then merge
242 # binutils for i686 without removing the i486 version (Note that this is
243 # _only_ when its exactly the same version of binutils ... if we have say
244 # 2.14.90.0.6 build for i486, and bootstrap then merge 2.14.90.0.7 for i686,
245 # we will not have issues. More below ...), gcc's search path will
246 # still have
247 #
248 # /usr/lib/gcc-lib/i486-pc-linux-gnu/<gcc_version>/../../../../i486-pc-linux-gnu/bin/
249 #
250 # before /usr/bin, and thus it will use the i486 versions of binutils binaries
251 # which causes issues. The reason for this issues is that when bootstrap merge
252 # exactly the same version for i686, both will have installed the same files to
253 # /usr/lib, and thus also USE the same libraries, cause as/ld to fail with
254 # unresolved symbols during compiling/linking.
255 #
256 # More info on this can be found by looking at bug #32140:
257 #
258 # http://bugs.gentoo.org/show_bug.cgi?id=32140
259 #
260 # We now thus run an 'emerge clean' just after merging binutils ...
261 #
262 # NB: thanks to <rac@gentoo.org> for bringing me on the right track
263 # (http://forums.gentoo.org/viewtopic.php?t=100263)
264 #
265 # <azarah@gentoo.org> (1 Nov 2003)
266 if [ -n "${STRAP_RUN}" ]
267 then
268 emerge clean || cleanup 1
269 fi
270
271 emerge ${STRAP_EMERGE_OPTS} ${myGCC} || cleanup 1
272
273 # Basic support for gcc multi version/arch scheme ...
274 if [ -n "${STRAP_RUN}" ]
275 then
276 if test -x ${GCC_CONFIG} &>/dev/null && \
277 ${GCC_CONFIG} --get-current-profile &>/dev/null
278 then
279 # Make sure we get the old gcc unmerged ...
280 emerge clean || cleanup 1
281 # Make sure the profile and /lib/cpp and /usr/bin/cc are valid ...
282 ${GCC_CONFIG} "`${GCC_CONFIG} --get-current-profile`" &>/dev/null
283 fi
284 fi
285
286 emerge ${STRAP_EMERGE_OPTS} ${myGLIBC} ${myBASELAYOUT} ${myZLIB} || cleanup 1
287 # ncurses-5.3 and up also build c++ bindings, so we need to rebuild it
288 export USE="${ORIGUSE}"
289 emerge ${STRAP_EMERGE_OPTS} ${myNCURSES} || cleanup 1
290
291 # Restore original make.conf
292 cleanup 0
293

  ViewVC Help
Powered by ViewVC 1.1.20