]>
gcc.gnu.org Git - gcc.git/blob - contrib/gcc_build
a5bf8649c92a98034c1f7b35c969e9bcab1b479b
3 ########################################################################
6 # Author: Mark Mitchell
10 # Script to automatically download and build GCC.
12 # Copyright (c) 2000 Free Software Foundation.
14 # This file is part of GNU CC.
16 # GNU CC is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2, or (at your option)
21 # GNU CC is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with GNU CC; see the file COPYING. If not, write to
28 # the Free Software Foundation, 59 Temple Place - Suite 330,
29 # Boston, MA 02111-1307, USA.
31 ########################################################################
33 ########################################################################
35 ########################################################################
37 # If you are using password-based CVS, you must manually log in, and
38 # not log out from, the CVS server before running this script.
40 ########################################################################
42 ########################################################################
44 # Issue the error message given by $1 and exit with a non-zero
48 echo "build-gcc.sh: error: $1"
52 # Issue a usage message explaining how to use this script.
56 build-gcc.sh [-c configure_options]
57 [-d destination_directory]
72 # Change to the directory given by $1.
76 error
"Could not change directory to $1"
79 # Set up CVS environment variables
82 CVSROOT
=":${CVS_PROTOCOL}:${CVS_USERNAME}@"
83 CVSROOT
="${CVSROOT}${CVS_SERVER}:${CVS_REPOSITORY}"
87 # Checkout a fresh copy of the GCC build tree.
90 # Tell CVS where to find everything.
93 # If the destination already exists, don't risk destroying it.
94 test -e ${DESTINATION} && \
95 error
"${DESTINATION} already exists"
97 # CVS doesn't allow an absolute path for the destination directory.
98 DESTINATION_PARENT
=`dirname ${DESTINATION}`
99 test -d ${DESTINATION_PARENT} || \
100 error
"${DESTINATION_PARENT} is not a directory"
101 changedir
${DESTINATION_PARENT}
104 cvs
-z 9 co
-d `basename ${DESTINATION}` gcc || \
105 error
"Could not check out GCC"
111 # Tell CVS where to find everything
114 # If the destination does not already exist, complain.
115 test -d ${DESTINATION} || \
116 error
"{$DESTINATION} does not exist"
117 # Enter the destination directory.
118 changedir
${DESTINATION}
121 .
/contrib
/gcc_update || \
122 error
"Could not update GCC"
128 # Go to the source directory.
129 changedir
${DESTINATION}
131 # Remove the object directory.
135 error
"Could not create ${OBJDIR}"
139 # Configure the tree.
140 (eval ${DESTINATION}/configure
${CONFIGURE_OPTIONS} |
141 tee -a ${LOGFILE}) 2>&1 || \
142 error
"Could not configure the compiler"
144 # Bootstrap the compiler
145 (eval make ${MAKE_OPTIONS} bootstrap |
146 tee -a ${LOGFILE}) 2>&1 || \
147 error
"Could not build the compiler"
153 # Go to the source directory.
154 changedir
${DESTINATION}
155 # Go to the object directory.
158 echo "Running tests... This will take a while."
159 (make -k check |
tee -a ${LOGFILE}) 2>&1
160 (${DESTINATION}/contrib
/test_summary |
tee -a ${LOGFILE})
163 # Export the GCC source tree.
166 # Go to the source directory.
167 changedir
${DESTINATION}
170 # Build a tarbal off the source directory.
172 --exclude=${OBJDIR} \
176 `basename ${DESTINATION}`
182 # Go to the source directory.
183 changedir
${DESTINATION}
184 # Go to the object directory.
187 make install > ${LOGFILE} 2>&1 || \
188 error
"Installation failed"
191 ########################################################################
193 ########################################################################
195 # The CVS server containing the GCC repository.
196 CVS_SERVER
="gcc.gnu.org"
197 # The path to the repository on that server.
198 CVS_REPOSITORY
="/cvs/gcc"
199 # The CVS protocol to use.
200 CVS_PROTOCOL
="pserver"
201 # The username to use when connecting to the server.
202 CVS_USERNAME
="anoncvs"
204 # The directory where the checked out GCC will be placed.
205 DESTINATION
="${HOME}/dev/gcc"
206 # The relative path from the top of the source tree to the
210 # The file where information will be logged.
211 LOGFILE
=${HOME}/build-gcc.$$.log
212 # The file where the tarred up sources will be placed.
213 TARFILE
="${HOME}/dev/gcc.tgz"
215 # Options to pass to configure.
217 # Options to pass to make.
228 ########################################################################
230 ########################################################################
233 while getopts "c:d:m:t:" ARG
; do
235 c
) CONFIGURE_OPTIONS
="${OPTARG}";;
236 d
) DESTINATION
="${OPTARG}";;
237 m
) MAKE_OPTIONS
="${OPTARG}";;
238 u
) CVS_USERNAME
="${OPTARG}";;
239 p
) CVS_PROTOCOL
="${OPTARG}";;
240 t
) CVS_TARGFILE
="${OPTARG}";;
244 shift `expr ${OPTIND} - 1`
246 # Handle the major modes.
247 while [ $# -ne 0 ]; do
250 checkout
) CHECKOUT
=1;;
260 # Check the arguments for sanity.
261 if [ ${CHECKOUT} -ne 0 ] && [ ${UPDATE} -ne 0 ]; then
262 error
"Cannot checkout and update simultaneously"
265 # Remove any old logfiles.
267 # Tell the user where to find the logfile.
268 echo "build-gcc.sh: The logfile for this run is ${LOGFILE}"
271 if [ ${CHECKOUT} -ne 0 ]; then
273 elif [ ${UPDATE} -ne 0 ]; then
277 # Build the compiler.
278 if [ ${BUILD} -ne 0 ]; then
283 if [ ${TEST} -ne 0 ]; then
287 # Install the compiler.
288 if [ ${INSTALL} -ne 0 ]; then
293 if [ ${EXPORT} -ne 0 ]; then
This page took 0.051308 seconds and 5 git commands to generate.