| 1 | #! /bin/sh
|
|---|
| 2 |
|
|---|
| 3 | ########################################################################
|
|---|
| 4 | #
|
|---|
| 5 | # File: gcc_release
|
|---|
| 6 | # Author: Jeffrey Law, Bernd Schmidt, Mark Mitchell
|
|---|
| 7 | # Date: 2001-05-25
|
|---|
| 8 | #
|
|---|
| 9 | # Contents:
|
|---|
| 10 | # Script to create a GCC release.
|
|---|
| 11 | #
|
|---|
| 12 | # Copyright (c) 2001, 2002 Free Software Foundation.
|
|---|
| 13 | #
|
|---|
| 14 | # This file is part of GNU CC.
|
|---|
| 15 | #
|
|---|
| 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)
|
|---|
| 19 | # any later version.
|
|---|
| 20 | #
|
|---|
| 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.
|
|---|
| 25 | #
|
|---|
| 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.
|
|---|
| 30 | #
|
|---|
| 31 | ########################################################################
|
|---|
| 32 |
|
|---|
| 33 | ########################################################################
|
|---|
| 34 | # Notes
|
|---|
| 35 | ########################################################################
|
|---|
| 36 |
|
|---|
| 37 | # Here is an example usage of this script, to create a GCC 3.0.2
|
|---|
| 38 | # prerelease:
|
|---|
| 39 | #
|
|---|
| 40 | # gcc_release -r 3.0.2
|
|---|
| 41 | #
|
|---|
| 42 | # This script will automatically use the head of the release branch
|
|---|
| 43 | # to generate the release.
|
|---|
| 44 |
|
|---|
| 45 | ########################################################################
|
|---|
| 46 | # Functions
|
|---|
| 47 | ########################################################################
|
|---|
| 48 |
|
|---|
| 49 | # Issue the error message given by $1 and exit with a non-zero
|
|---|
| 50 | # exit code.
|
|---|
| 51 |
|
|---|
| 52 | error() {
|
|---|
| 53 | echo "gcc_release: error: $1"
|
|---|
| 54 | exit 1
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | # Issue the informational message given by $1.
|
|---|
| 58 |
|
|---|
| 59 | inform() {
|
|---|
| 60 | echo "gcc_release: $1"
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|
| 63 | # Issue a usage message explaining how to use this script.
|
|---|
| 64 |
|
|---|
| 65 | usage() {
|
|---|
| 66 | cat <<EOF
|
|---|
| 67 | gcc_release [-d destination]
|
|---|
| 68 | [-u username]
|
|---|
| 69 | [-r release]
|
|---|
| 70 | [-t tag]
|
|---|
| 71 | [-p previous-tarball]
|
|---|
| 72 | [-s] [-f] [-l]
|
|---|
| 73 | EOF
|
|---|
| 74 | exit 1
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | # Change to the directory given by $1.
|
|---|
| 78 |
|
|---|
| 79 | changedir() {
|
|---|
| 80 | cd $1 || \
|
|---|
| 81 | error "Could not change directory to $1"
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | # Each of the arguments is a directory name, relative to the top
|
|---|
| 85 | # of the source tree. Return another name for that directory, relative
|
|---|
| 86 | # to the working directory.
|
|---|
| 87 |
|
|---|
| 88 | adjust_dirs() {
|
|---|
| 89 | for x in $@; do
|
|---|
| 90 | echo `basename ${SOURCE_DIRECTORY}`/$x
|
|---|
| 91 | done
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | # Build the source tree that will be the basis for the release
|
|---|
| 95 | # in ${WORKING_DIRECTORY}/gcc-${RELEASE}.
|
|---|
| 96 |
|
|---|
| 97 | build_sources() {
|
|---|
| 98 | # If the WORKING_DIRECTORY already exists, do not risk destroying it.
|
|---|
| 99 | if [ -r ${WORKING_DIRECTORY} ]; then
|
|---|
| 100 | error "\`${WORKING_DIRECTORY}' already exists"
|
|---|
| 101 | fi
|
|---|
| 102 | # Create the WORKING_DIRECTORY.
|
|---|
| 103 | mkdir "${WORKING_DIRECTORY}" \
|
|---|
| 104 | || error "Could not create \`${WORKING_DIRECTORY}'"
|
|---|
| 105 | changedir "${WORKING_DIRECTORY}"
|
|---|
| 106 |
|
|---|
| 107 | # If this is a final release, make sure that the ChangeLogs
|
|---|
| 108 | # and version strings are updated.
|
|---|
| 109 | if [ ${FINAL} -ne 0 ]; then
|
|---|
| 110 | inform "Updating ChangeLogs and version files"
|
|---|
| 111 |
|
|---|
| 112 | ${CVS} co -d "`basename ${SOURCE_DIRECTORY}`" \
|
|---|
| 113 | -r ${BRANCH} gcc || \
|
|---|
| 114 | error "Could not check out release sources"
|
|---|
| 115 | for x in `find ${SOURCE_DIRECTORY} -name ChangeLog`; do
|
|---|
| 116 | cat - ${x} > ${x}.new <<EOF
|
|---|
| 117 | ${LONG_DATE} Release Manager
|
|---|
| 118 |
|
|---|
| 119 | * GCC ${RELEASE} Released.
|
|---|
| 120 |
|
|---|
| 121 | EOF
|
|---|
| 122 | mv ${x}.new ${x} || \
|
|---|
| 123 | error "Could not update ${x}"
|
|---|
| 124 | (changedir `dirname ${x}` && \
|
|---|
| 125 | ${CVS} ci -m 'Mark ChangeLog' `basename ${x}`) || \
|
|---|
| 126 | error "Could not commit ${x}"
|
|---|
| 127 | done
|
|---|
| 128 |
|
|---|
| 129 | # Update `gcc/version.c'. There are other version files
|
|---|
| 130 | # as well, which should have release status updated.
|
|---|
| 131 | for x in gcc/version.c; do
|
|---|
| 132 | y=`basename ${x}`
|
|---|
| 133 | (changedir `dirname ${SOURCE_DIRECTORY}/${x}` && \
|
|---|
| 134 | sed -e 's|= \".*\"|= \"'${RELEASE}'\"|g' < ${y} > ${y}.new && \
|
|---|
| 135 | mv ${y}.new ${y} && \
|
|---|
| 136 | ${CVS} ci -m 'Update version' ${y}) || \
|
|---|
| 137 | error "Could not update ${x}"
|
|---|
| 138 | done
|
|---|
| 139 | for x in gcc/ada/gnatvsn.ads gcc/f/version.c libf2c/libF77/Version.c \
|
|---|
| 140 | libf2c/libI77/Version.c libf2c/libU77/Version.c; do
|
|---|
| 141 | y=`basename ${x}`
|
|---|
| 142 | (changedir `dirname ${SOURCE_DIRECTORY}/${x}` && \
|
|---|
| 143 | sed -e 's/experimental\|prerelease/release/g' < ${y} > ${y}.new && \
|
|---|
| 144 | mv ${y}.new ${y} && \
|
|---|
| 145 | ${CVS} ci -m 'Update version' ${y}) || \
|
|---|
| 146 | error "Could not update ${x}"
|
|---|
| 147 | done
|
|---|
| 148 |
|
|---|
| 149 | # Make sure we tag the sources for a final release.
|
|---|
| 150 | TAG="gcc_`echo ${RELEASE} | tr . _`_release"
|
|---|
|
|---|