PR tree-optimization/48611
[official-gcc.git] / maintainer-scripts / gcc_release
blob233c15901988fa5bd8deff882f7615df7f809687
1 #! /bin/sh
3 ########################################################################
5 # File: gcc_release
6 # Author: Jeffrey Law, Bernd Schmidt, Mark Mitchell
7 # Date: 2001-05-25
9 # Contents:
10 # Script to create a GCC release.
12 # Copyright (c) 2001, 2002, 2006, 2009, 2010 Free Software Foundation.
14 # This file is part of GCC.
16 # GCC 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 3, or (at your option)
19 # any later version.
21 # GCC 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 GCC; see the file COPYING3. If not see
28 # <http://www.gnu.org/licenses/>.
30 ########################################################################
32 ########################################################################
33 # Notes
34 ########################################################################
36 # Here is an example usage of this script, to create a GCC 3.0.2
37 # prerelease:
39 # gcc_release -r 3.0.2
41 # This script will automatically use the head of the release branch
42 # to generate the release.
44 ########################################################################
45 # Functions
46 ########################################################################
48 # Issue the error message given by $1 and exit with a non-zero
49 # exit code.
51 error() {
52 echo "gcc_release: error: $1"
53 exit 1
56 # Issue the informational message given by $1.
58 inform() {
59 echo "gcc_release: $1"
62 # Issue a usage message explaining how to use this script.
64 usage() {
65 cat <<EOF
66 gcc_release -r release [-f] [further options]
67 gcc_release -s name:svnbranch [further options]
69 Options:
71 -r release Version of the form X.Y or X.Y.Z.
72 -s name:svnbranch Create a snapshot, not a real release.
74 -d destination Local working directory where we will build the release
75 (default=${HOME}).
76 -f Create a final release (and update ChangeLogs,...).
77 -l Indicate that we are running on gcc.gnu.org.
78 -p previous-tarball Location of a previous tarball (to generate diff files).
79 -t tag Tag to mark the release in SVN.
80 -u username Username for upload operations.
81 EOF
82 exit 1
85 # Change to the directory given by $1.
87 changedir() {
88 cd $1 || \
89 error "Could not change directory to $1"
92 # Each of the arguments is a directory name, relative to the top
93 # of the source tree. Return another name for that directory, relative
94 # to the working directory.
96 adjust_dirs() {
97 for x in $@; do
98 echo `basename ${SOURCE_DIRECTORY}`/$x
99 done
102 # Build the source tree that will be the basis for the release
103 # in ${WORKING_DIRECTORY}/gcc-${RELEASE}.
105 build_sources() {
106 # If the WORKING_DIRECTORY already exists, do not risk destroying it.
107 if [ -r ${WORKING_DIRECTORY} ]; then
108 error "\`${WORKING_DIRECTORY}' already exists"
110 # Create the WORKING_DIRECTORY.
111 mkdir "${WORKING_DIRECTORY}" \
112 || error "Could not create \`${WORKING_DIRECTORY}'"
113 changedir "${WORKING_DIRECTORY}"
115 # If this is a final release, make sure that the ChangeLogs
116 # and version strings are updated.
117 if [ ${FINAL} -ne 0 ]; then
118 inform "Updating ChangeLogs and version files"
120 ${SVN} -q co "${SVNROOT}/${SVNBRANCH}" "`basename ${SOURCE_DIRECTORY}`" ||\
121 error "Could not check out release sources"
122 for x in `find ${SOURCE_DIRECTORY} -name ChangeLog`; do
123 # Update this ChangeLog file only if it does not yet contain the
124 # entry we are going to add. (This is a safety net for repeated
125 # runs of this script for the same release.)
126 if ! grep "GCC ${RELEASE} released." ${x} > /dev/null ; then
127 cat - ${x} > ${x}.new <<EOF
128 ${LONG_DATE} Release Manager
130 * GCC ${RELEASE} released.
133 mv ${x}.new ${x} || \
134 error "Could not update ${x}"
135 (changedir `dirname ${x}` && \
136 ${SVN} -q ci -m 'Mark ChangeLog' `basename ${x}`) || \
137 error "Could not commit ${x}"
139 done
141 # Update gcc/DEV-PHASE.
143 [ `cat ${SOURCE_DIRECTORY}/gcc/BASE-VER` = ${RELEASE} ] || \
144 error "Release number ${RELEASE} does not match BASE-VER"
145 (changedir ${SOURCE_DIRECTORY}/gcc && \
146 : > DEV-PHASE && \
147 ${SVN} -q ci -m 'Mark as release' DEV-PHASE) || \
148 error "Could not update DEV-PHASE"
150 # Make sure we tag the sources for a final release.
151 TAG="tags/gcc_`echo ${RELEASE} | tr . _`_release"
153 rm -rf ${SOURCE_DIRECTORY}
156 # Tag the sources.
157 if [ -n "${TAG}" ]; then
158 inform "Tagging sources as ${TAG}"
159 # We don't want to overwrite an existing tag. So, if the tag
160 # already exists, issue an error message; the release manager can
161 # manually remove the tag if appropriate.
162 echo "${SVN} ls ${SVNROOT}/${TAG}/ChangeLog"
163 if ${SVN} ls "${SVNROOT}/${TAG}/ChangeLog"; then
164 error "Tag ${TAG} already exists"
166 ${SVN} -m "Tagging source as ${TAG}" cp "${SVNROOT}/${SVNBRANCH}" "${SVNROOT}/${TAG}" || \
167 error "Could not tag sources"
168 SVNBRANCH=${TAG}
170 SVNREV=`${SVN} info "${SVNROOT}/${SVNBRANCH}"|awk '/Revision:/ {print $2}'`
172 # Export the current sources.
173 inform "Retrieving sources (svn export -r ${SVNREV} ${SVNROOT}/${SVNBRANCH})"
175 ${SVN} -q export -r${SVNREV} "${SVNROOT}/${SVNBRANCH}" "`basename ${SOURCE_DIRECTORY}`" ||\
176 error "Could not retrieve sources"
178 # Run gcc_update on them to set up the timestamps nicely, and (re)write
179 # the LAST_UPDATED file containing the SVN tag/revision used.
180 changedir "gcc-${RELEASE}"
181 contrib/gcc_update --touch
182 echo "Obtained from SVN: ${SVNBRANCH} revision ${SVNREV}" > LAST_UPDATED
184 # For a prerelease or real release, we need to generate additional
185 # files not present in SVN.
186 changedir "${SOURCE_DIRECTORY}"
187 if [ $SNAPSHOT -ne 1 ]; then
188 # Generate the documentation.
189 inform "Building install docs"
190 SOURCEDIR=${SOURCE_DIRECTORY}/gcc/doc
191 DESTDIR=${SOURCE_DIRECTORY}/INSTALL
192 export SOURCEDIR
193 export DESTDIR
194 ${SOURCE_DIRECTORY}/gcc/doc/install.texi2html
196 # Regenerate the NEWS file.
197 contrib/gennews > NEWS || \
198 error "Could not regenerate NEWS files"
200 # Now, we must build the compiler in order to create any generated
201 # files that are supposed to go in the source directory. This is
202 # also a good sanity check to make sure that the release builds
203 # on at least one platform.
204 inform "Building compiler"
205 OBJECT_DIRECTORY=../objdir
206 contrib/gcc_build -d ${SOURCE_DIRECTORY} -o ${OBJECT_DIRECTORY} \
207 -c "--enable-generated-files-in-srcdir --disable-multilib" build || \
208 error "Could not rebuild GCC"
211 # Move message catalogs to source directory.
212 mv ../objdir/gcc/po/*.gmo gcc/po/
213 [ -f libcpp/po/cpplib.pot ] && mv ../objdir/libcpp/po/*.gmo libcpp/po/
215 # Create a "MD5SUMS" file to use for checking the validity of the release.
216 echo \
217 "# This file contains the MD5 checksums of the files in the
218 # gcc-"${RELEASE}".tar.bz2 tarball.
220 # Besides verifying that all files in the tarball were correctly expanded,
221 # it also can be used to determine if any files have changed since the
222 # tarball was expanded or to verify that a patchfile was correctly applied.
224 # Suggested usage:
225 # md5sum -c MD5SUMS | grep -v \"OK$\"
226 " > MD5SUMS
228 find . -type f |
229 sed -e 's:^\./::' -e '/MD5SUMS/d' |
230 sort |
231 xargs md5sum >>MD5SUMS
234 # Build a single tarfile. The first argument is the name of the tarfile
235 # to build, without any suffixes. They will be added automatically. The
236 # rest of the arguments are files or directories to include, and possibly
237 # other arguments to tar.
239 build_tarfile() {
240 # Get the name of the destination tar file.
241 TARFILE="$1.tar.bz2"
242 shift
244 # Build the tar file itself.
245 (${TAR} cf - "$@" | ${BZIP2} > ${TARFILE}) || \
246 error "Could not build tarfile"
247 FILE_LIST="${FILE_LIST} ${TARFILE}"
250 # Build a single tarfile if any of the directories listed exist,
251 # but not if none of them do (because that component doesn't exist
252 # on this branch).
253 maybe_build_tarfile() {
254 dest=$1
255 shift
256 if [ $# != 0 -a -d "$1" ]; then
257 build_tarfile "$dest" "$@"
258 else
259 echo "Not building $dest tarfile"
263 # Build the various tar files for the release.
265 build_tarfiles() {
266 inform "Building tarfiles"
268 changedir "${WORKING_DIRECTORY}"
270 # The GNU Coding Standards specify that all files should
271 # world readable.
272 chmod -R a+r ${SOURCE_DIRECTORY}
273 # And that all directories have mode 755.
274 find ${SOURCE_DIRECTORY} -type d -exec chmod 755 {} \;
276 # Build one huge tarfile for the entire distribution.
277 build_tarfile gcc-${RELEASE} `basename ${SOURCE_DIRECTORY}`
279 # Now, build one for each of the languages.
280 maybe_build_tarfile gcc-ada-${RELEASE} ${ADA_DIRS}
281 maybe_build_tarfile gcc-g++-${RELEASE} ${CPLUSPLUS_DIRS}
282 maybe_build_tarfile gcc-fortran-${RELEASE} ${FORTRAN95_DIRS}
283 maybe_build_tarfile gcc-go-${RELEASE} ${GO_DIRS}
284 maybe_build_tarfile gcc-java-${RELEASE} ${JAVA_DIRS}
285 maybe_build_tarfile gcc-objc-${RELEASE} ${OBJECTIVEC_DIRS}
286 maybe_build_tarfile gcc-testsuite-${RELEASE} ${TESTSUITE_DIRS}
288 # The core is everything else.
289 EXCLUDES=""
290 for x in ${ADA_DIRS} ${CPLUSPLUS_DIRS} ${FORTRAN95_DIRS}\
291 ${GO_DIRS} ${JAVA_DIRS} ${OBJECTIVEC_DIRS} ${TESTSUITE_DIRS}; do
292 EXCLUDES="${EXCLUDES} --exclude $x"
293 done
294 build_tarfile gcc-core-${RELEASE} ${EXCLUDES} \
295 `basename ${SOURCE_DIRECTORY}`
298 # Build .gz files.
299 build_gzip() {
300 for f in ${FILE_LIST}; do
301 target=${f%.bz2}.gz
302 (${BZIP2} -d -c $f | ${GZIP} > ${target}) || error "Could not create ${target}"
303 done
306 # Build diffs against an old release.
307 build_diffs() {
308 old_dir=${1%/*}
309 old_file=${1##*/}
310 old_vers=${old_file%.tar.bz2}
311 old_vers=${old_vers#gcc-}
312 inform "Building diffs against version $old_vers"
313 for f in gcc gcc-ada gcc-g++ gcc-fortran gcc-go gcc-java gcc-objc gcc-testsuite gcc-core; do
314 old_tar=${old_dir}/${f}-${old_vers}.tar.bz2
315 new_tar=${WORKING_DIRECTORY}/${f}-${RELEASE}.tar.bz2
316 if [ ! -e $old_tar ]; then
317 inform "$old_tar not found; not generating diff file"
318 elif [ ! -e $new_tar ]; then
319 inform "$new_tar not found; not generating diff file"
320 else
321 build_diff $old_tar gcc-${old_vers} $new_tar gcc-${RELEASE} \
322 ${f}-${old_vers}-${RELEASE}.diff.bz2
324 done
327 # Build an individual diff.
328 build_diff() {
329 changedir "${WORKING_DIRECTORY}"
330 tmpdir=gccdiff.$$
331 mkdir $tmpdir || error "Could not create directory $tmpdir"
332 changedir $tmpdir
333 (${BZIP2} -d -c $1 | ${TAR} xf - ) || error "Could not unpack $1 for diffs"
334 (${BZIP2} -d -c $3 | ${TAR} xf - ) || error "Could not unpack $3 for diffs"
335 ${DIFF} $2 $4 > ../${5%.bz2}
336 if [ $? -eq 2 ]; then
337 error "Trouble making diffs from $1 to $3"
339 ${BZIP2} ../${5%.bz2} || error "Could not generate ../$5"
340 changedir ..
341 rm -rf $tmpdir
342 FILE_LIST="${FILE_LIST} $5"
345 # Upload the files to the FTP server.
346 upload_files() {
347 inform "Uploading files"
349 changedir "${WORKING_DIRECTORY}"
351 # Make sure the directory exists on the server.
352 if [ $LOCAL -eq 0 ]; then
353 ${SSH} -l ${GCC_USERNAME} ${GCC_HOSTNAME} \
354 mkdir -p "${FTP_PATH}/diffs"
355 UPLOAD_PATH="${GCC_USERNAME}@${GCC_HOSTNAME}:${FTP_PATH}"
356 else
357 mkdir -p "${FTP_PATH}/diffs" \
358 || error "Could not create \`${FTP_PATH}'"
359 UPLOAD_PATH=${FTP_PATH}
362 # Then copy files to their respective (sub)directories.
363 for x in gcc*.gz gcc*.bz2; do
364 if [ -e ${x} ]; then
365 # Make sure the file will be readable on the server.
366 chmod a+r ${x}
367 # Copy it.
368 case ${x} in
369 *.diff.*)
370 SUBDIR="diffs/";
373 SUBDIR="";
374 esac
375 ${SCP} ${x} ${UPLOAD_PATH}/${SUBDIR} \
376 || error "Could not upload ${x}"
378 done
381 # Print description if snapshot exists.
382 snapshot_print() {
383 if [ -e ${RELEASE}/$1 ]; then
384 hash=`openssl md5 ${RELEASE}/$1 | sed -e 's#(.*)##' -e 's# *= *#=#'`
385 hash2=`openssl sha1 ${RELEASE}/$1 | sed -e 's#(.*)##' -e 's# *= *#=#'`
387 printf " %-37s%s\n\n %s\n %s\n\n" "$1" "$2" "$hash" "$hash2" \
388 >> ${SNAPSHOT_README}
390 echo " <tr><td><a href=\"$1\">$1</a></td>" >> ${SNAPSHOT_INDEX}
391 echo " <td>$2</td></tr>" >> ${SNAPSHOT_INDEX}
395 # Announce a snapshot, both on the web and via mail.
396 announce_snapshot() {
397 inform "Updating links and READMEs on the FTP server"
399 TEXT_DATE=`date --date=$DATE +%B\ %d,\ %Y`
400 SNAPSHOT_README=${RELEASE}/README
401 SNAPSHOT_INDEX=${RELEASE}/index.html
403 changedir "${SNAPSHOTS_DIR}"
404 echo \
405 "Snapshot gcc-"${RELEASE}" is now available on
406 ftp://gcc.gnu.org/pub/gcc/snapshots/"${RELEASE}"/
407 and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.
409 This snapshot has been generated from the GCC "${BRANCH}" SVN branch
410 with the following options: "svn://gcc.gnu.org/svn/gcc/${SVNBRANCH} revision ${SVNREV}"
412 You'll find:
413 " > ${SNAPSHOT_README}
415 echo \
416 "<html>
418 <head>
419 <title>GCC "${RELEASE}" Snapshot</title>
420 </head>
422 <body>
423 <h1>GCC "${RELEASE}" Snapshot</h1>
425 <p>The <a href =\"http://gcc.gnu.org/\">GCC Project</a> makes
426 periodic snapshots of the GCC source tree available to the public
427 for testing purposes.</p>
429 <p>If you are planning to download and use one of our snapshots, then
430 we highly recommend you join the GCC developers list. Details for
431 how to sign up can be found on the GCC project home page.</p>
433 <p>This snapshot has been generated from the GCC "${BRANCH}" SVN branch
434 with the following options: <code>"svn://gcc.gnu.org/svn/gcc/${SVNBRANCH} revision ${SVNREV}"</code></p>
436 <table>" > ${SNAPSHOT_INDEX}
438 snapshot_print gcc-${RELEASE}.tar.bz2 "Complete GCC (includes all of below)"
439 snapshot_print gcc-core-${RELEASE}.tar.bz2 "C front end and core compiler"
440 snapshot_print gcc-ada-${RELEASE}.tar.bz2 "Ada front end and runtime"
441 snapshot_print gcc-fortran-${RELEASE}.tar.bz2 "Fortran front end and runtime"
442 snapshot_print gcc-g++-${RELEASE}.tar.bz2 "C++ front end and runtime"
443 snapshot_print gcc-go-${RELEASE}.tar.bz2 "Go front end and runtime"
444 snapshot_print gcc-java-${RELEASE}.tar.bz2 "Java front end and runtime"
445 snapshot_print gcc-objc-${RELEASE}.tar.bz2 "Objective-C front end and runtime"
446 snapshot_print gcc-testsuite-${RELEASE}.tar.bz2 "The GCC testsuite"
448 echo \
449 "Diffs from "${BRANCH}"-"${LAST_DATE}" are available in the diffs/ subdirectory.
451 When a particular snapshot is ready for public consumption the LATEST-"${BRANCH}"
452 link is updated and a message is sent to the gcc list. Please do not use
453 a snapshot before it has been announced that way." >> ${SNAPSHOT_README}
455 echo \
456 "</table>
457 <p>Diffs from "${BRANCH}"-"${LAST_DATE}" are available in the
458 <a href=\"diffs/\">diffs/ subdirectory</a>.</p>
460 <p>When a particular snapshot is ready for public consumption the LATEST-"${BRANCH}"
461 link is updated and a message is sent to the gcc list. Please do not use
462 a snapshot before it has been announced that way.</p>
464 <hr />
466 <address>
467 <a href=\"mailto:gcc@gcc.gnu.org\">gcc@gcc.gnu.org</a>
468 <br />
469 Last modified "${TEXT_DATE}"
470 </address>
471 </body>
473 </html>" >> ${SNAPSHOT_INDEX}
475 rm -f LATEST-${BRANCH}
476 ln -s ${RELEASE} LATEST-${BRANCH}
478 inform "Sending mail"
480 export QMAILHOST=gcc.gnu.org
481 mail -s "gcc-${RELEASE} is now available" gcc@gcc.gnu.org < ${SNAPSHOT_README}
484 ########################################################################
485 # Initialization
486 ########################################################################
488 LC_ALL=C
489 export LC_ALL
491 # Today's date.
492 DATE=`date "+%Y%m%d"`
493 LONG_DATE=`date "+%Y-%m-%d"`
495 SVN=${SVN:-svn}
496 # The CVS server containing the GCC repository.
497 SVN_SERVER="gcc.gnu.org"
498 # The path to the repository on that server.
499 SVN_REPOSITORY="/svn/gcc"
500 # The username to use when connecting to the server.
501 SVN_USERNAME="${USER}"
503 # The machine to which files will be uploaded.
504 GCC_HOSTNAME="gcc.gnu.org"
505 # The name of the account on the machine to which files are uploaded.
506 GCC_USERNAME="gccadmin"
507 # The directory in which the files will be placed (do not use ~user syntax).
508 FTP_PATH=/var/ftp/pub/gcc
509 # The directory in which snapshots will be placed.
510 SNAPSHOTS_DIR=${FTP_PATH}/snapshots
512 # The major number for the release. For release `3.0.2' this would be
513 # `3'
514 RELEASE_MAJOR=""
515 # The minor number for the release. For release `3.0.2' this would be
516 # `0'.
517 RELEASE_MINOR=""
518 # The revision number for the release. For release `3.0.2' this would
519 # be `2'.
520 RELEASE_REVISION=""
521 # The complete name of the release.
522 RELEASE=""
524 # The name of the branch from which the release should be made, in a
525 # user-friendly form.
526 BRANCH=""
528 # The name of the branch from which the release should be made, as used
529 # for our version control system.
530 SVNBRANCH=""
532 # The tag to apply to the sources used for the release.
533 TAG=""
535 # The old tarballs from which to generate diffs.
536 OLD_TARS=""
538 # The directory that will be used to construct the release. The
539 # release itself will be placed in a subdirectory of this directory.
540 DESTINATION=${HOME}
541 # The subdirectory.
542 WORKING_DIRECTORY=""
543 # The directory that will contain the GCC sources.
544 SOURCE_DIRECTORY=""
546 # The directories that should be part of the various language-specific
547 # tar files. These are all relative to the top of the source tree.
548 ADA_DIRS="gcc/ada libada gnattools"
549 CPLUSPLUS_DIRS="gcc/cp libstdc++-v3"
550 FORTRAN95_DIRS="gcc/fortran libgfortran"
551 GO_DIRS="gcc/go libgo libffi"
552 JAVA_DIRS="gcc/java libjava libffi boehm-gc"
553 OBJECTIVEC_DIRS="gcc/objc gcc/objcp libobjc"
554 TESTSUITE_DIRS="gcc/testsuite"
556 # Non-zero if this is the final release, rather than a prerelease.
557 FINAL=0
559 # Non-zero if we are building a snapshot, and don't build gcc or
560 # include generated files.
561 SNAPSHOT=0
563 # Non-zero if we are running locally on gcc.gnu.org, and use local CVS
564 # and copy directly to the FTP directory.
565 LOCAL=0
567 # Major operation modes.
568 MODE_GZIP=0
569 MODE_DIFFS=0
570 MODE_SOURCES=0
571 MODE_TARFILES=0
572 MODE_UPLOAD=0
574 # List of archive files generated; used to create .gz files from .bz2.
575 FILE_LIST=""
577 # Programs we use.
579 BZIP2="${BZIP2:-bzip2}"
580 CVS="${CVS:-cvs -f -Q -z9}"
581 DIFF="${DIFF:-diff -Nrcpad}"
582 ENV="${ENV:-env}"
583 GZIP="${GZIP:-gzip --best}"
584 SCP="${SCP:-scp -p}"
585 SSH="${SSH:-ssh}"
586 TAR="${TAR:-tar}"
588 ########################################################################
589 # Command Line Processing
590 ########################################################################
592 # Parse the options.
593 while getopts "d:fr:u:t:p:s:l" ARG; do
594 case $ARG in
595 d) DESTINATION="${OPTARG}";;
596 r) RELEASE="${OPTARG}";;
597 t) TAG="${OPTARG}";;
598 u) SVN_USERNAME="${OPTARG}";;
599 f) FINAL=1;;
600 s) SNAPSHOT=1
601 BRANCH=${OPTARG%:*}
602 SVNBRANCH=${OPTARG#*:}
604 l) LOCAL=1
605 SCP=cp
606 PATH=~:/usr/local/bin:$PATH;;
607 p) OLD_TARS="${OLD_TARS} ${OPTARG}"
608 if [ ! -f ${OPTARG} ]; then
609 error "-p argument must name a tarball"
610 fi;;
611 \?) usage;;
612 esac
613 done
614 shift `expr ${OPTIND} - 1`
616 # Handle the major modes.
617 while [ $# -ne 0 ]; do
618 case $1 in
619 diffs) MODE_DIFFS=1;;
620 gzip) MODE_GZIP=1;;
621 sources) MODE_SOURCES=1;;
622 tarfiles) MODE_TARFILES=1;;
623 upload) MODE_UPLOAD=1;;
624 all) MODE_SOURCES=1; MODE_TARFILES=1; MODE_DIFFS=1; MODE_UPLOAD=1;
625 if [ $SNAPSHOT -ne 1 ]; then
626 # Only for releases and pre-releases.
627 MODE_GZIP=1;
630 *) error "Unknown mode $1";;
631 esac
632 shift
633 done
635 # Perform consistency checking.
636 if [ ${LOCAL} -eq 0 ] && [ -z ${SVN_USERNAME} ]; then
637 error "No username specified"
640 if [ ! -d ${DESTINATION} ]; then
641 error "\`${DESTINATION}' is not a directory"
644 if [ $SNAPSHOT -eq 0 ]; then
645 if [ -z ${RELEASE} ]; then
646 error "No release number specified"
649 # Compute the major and minor release numbers.
650 RELEASE_MAJOR=`echo $RELEASE | awk --assign FS=. '{ print $1; }'`
651 RELEASE_MINOR=`echo $RELEASE | awk --assign FS=. '{ print $2; }'`
652 RELEASE_REVISION=`echo $RELEASE | awk --assign FS=. '{ print $3; }'`
654 if [ -z "${RELEASE_MAJOR}" ] || [ -z "${RELEASE_MINOR}" ]; then
655 error "Release number \`${RELEASE}' is invalid"
658 # Compute the full name of the release.
659 if [ -z "${RELEASE_REVISION}" ]; then
660 RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}"
661 else
662 RELEASE="${RELEASE_MAJOR}.${RELEASE_MINOR}.${RELEASE_REVISION}"
665 # Compute the name of the branch, which is based solely on the major
666 # and minor release numbers.
667 SVNBRANCH="branches/gcc-${RELEASE_MAJOR}_${RELEASE_MINOR}-branch"
669 # If this is not a final release, set various parameters accordingly.
670 if [ ${FINAL} -ne 1 ]; then
671 RELEASE="${RELEASE}-RC-${DATE}"
672 FTP_PATH="${SNAPSHOTS_DIR}/${RELEASE}"
673 else
674 FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/"
676 else
677 RELEASE=${BRANCH}-${DATE}
678 FTP_PATH="${FTP_PATH}/snapshots/${RELEASE}"
680 # If diffs are requested when building locally on gcc.gnu.org, we (usually)
681 # know what the last snapshot date was and take the corresponding tarballs,
682 # unless the user specified tarballs explicitly.
683 if [ $MODE_DIFFS -ne 0 ] && [ $LOCAL -ne 0 ] && [ -z "${OLD_TARS}" ]; then
684 LAST_DATE=`cat ~/.snapshot_date-${BRANCH}`
685 OLD_TARS=${SNAPSHOTS_DIR}/${BRANCH}-${LAST_DATE}/gcc-${BRANCH}-${LAST_DATE}.tar.bz2
689 # Compute the name of the WORKING_DIRECTORY and the SOURCE_DIRECTORY.
690 WORKING_DIRECTORY="${DESTINATION}/gcc-${RELEASE}"
691 SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}"
693 # Recompute the names of all the language-specific directories,
694 # relative to the WORKING_DIRECTORY.
695 ADA_DIRS=`adjust_dirs ${ADA_DIRS}`
696 CPLUSPLUS_DIRS=`adjust_dirs ${CPLUSPLUS_DIRS}`
697 FORTRAN95_DIRS=`adjust_dirs ${FORTRAN95_DIRS}`
698 GO_DIRS=`adjust_dirs ${GO_DIRS}`
699 JAVA_DIRS=`adjust_dirs ${JAVA_DIRS}`
700 OBJECTIVEC_DIRS=`adjust_dirs ${OBJECTIVEC_DIRS}`
701 TESTSUITE_DIRS=`adjust_dirs ${TESTSUITE_DIRS}`
703 # Set up SVNROOT.
704 if [ $LOCAL -eq 0 ]; then
705 SVNROOT="svn+ssh://${SVN_USERNAME}@${SVN_SERVER}${SVN_REPOSITORY}"
706 else
707 SVNROOT="file:///svn/gcc"
709 export SVNROOT
711 ########################################################################
712 # Main Program
713 ########################################################################
715 # Set the timezone to UTC
716 TZ="UTC0"
717 export TZ
719 # Build the source directory.
721 if [ $MODE_SOURCES -ne 0 ]; then
722 build_sources
725 # Build the tar files.
727 if [ $MODE_TARFILES -ne 0 ]; then
728 build_tarfiles
731 # Build diffs
733 if [ $MODE_DIFFS -ne 0 ]; then
734 # Possibly build diffs.
735 if [ -n "$OLD_TARS" ]; then
736 for old_tar in $OLD_TARS; do
737 build_diffs $old_tar
738 done
742 # Build gzip files
743 if [ $MODE_GZIP -ne 0 ]; then
744 build_gzip
747 # Upload them to the FTP server.
748 if [ $MODE_UPLOAD -ne 0 ]; then
749 upload_files
751 # For snapshots, make some further updates.
752 if [ $SNAPSHOT -ne 0 ] && [ $LOCAL -ne 0 ]; then
753 announce_snapshot
755 # Update snapshot date file.
756 changedir ~
757 echo $DATE > .snapshot_date-${BRANCH}
759 # Remove working directory
760 rm -rf ${WORKING_DIRECTORY}