OSDN Git Service

* libmath/stubs.c (hypot, hypotf, hypotl): Don't divide by
[pf3gnuchains/gcc-fork.git] / maintainer-scripts / gcc_release
index 59d4711..9f22b83 100755 (executable)
@@ -9,22 +9,22 @@
 # Contents:
 #   Script to create a GCC release.
 #
-# Copyright (c) 2001 Free Software Foundation.
+# Copyright (c) 2001, 2002 Free Software Foundation.
 #
-# This file is part of GNU CC.
+# This file is part of GCC.
 #
-# GNU CC is free software; you can redistribute it and/or modify
+# GCC is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2, or (at your option)
 # any later version.
 #
-# GNU CC is distributed in the hope that it will be useful,
+# GCC is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU CC; see the file COPYING.  If not, write to
+# along with GCC; see the file COPYING.  If not, write to
 # the Free Software Foundation, 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 #
@@ -64,12 +64,21 @@ inform() {
 
 usage() {
 cat <<EOF
-gcc_release     [-d destination]
-                [-u username]
-               [-r release]
-               [-t tag]
-               [-p previous-tarball]
-               [-s] [-f] [-l]
+gcc_release -r release [further options]
+gcc_release -s [further options]
+
+Options:
+
+  -r release           Version of the form X.Y or X.Y.Z.
+  -s                   Create a snapshot, not a real release.
+
+  -d destination       Local working directory where we will build the release
+                       (default=${HOME}).
+  -f                   Create a final release (and update ChangeLogs,...).
+  -l                   Indicate that we are running on gcc.gnu.org.
+  -p previous-tarball  Location of a previous tarball (to generate diff files).
+  -t tag               Tag to mark the release in CVS.
+  -u username          Username for upload operations.
 EOF
     exit 1
 }
@@ -126,8 +135,7 @@ EOF
         error "Could not commit ${x}"
     done
 
-    # Update `gcc/version.c'.  There are other version files
-    # as well, which should have release status updated.
+    # Update `gcc/version.c'.
     for x in gcc/version.c; do 
       y=`basename ${x}`
       (changedir `dirname ${SOURCE_DIRECTORY}/${x}` && \
@@ -136,15 +144,6 @@ EOF
           ${CVS} ci -m 'Update version' ${y}) || \
          error "Could not update ${x}"
     done
-    for x in gcc/f/version.c libf2c/libF77/Version.c \
-             libf2c/libI77/Version.c libf2c/libU77/Version.c; do
-      y=`basename ${x}`
-      (changedir `dirname ${SOURCE_DIRECTORY}/${x}` && \
-          sed -e 's/experimental\|prerelease/release/g' < ${y} > ${y}.new && \
-         mv ${y}.new ${y} && \
-          ${CVS} ci -m 'Update version' ${y}) || \
-         error "Could not update ${x}"
-    done
 
     # Make sure we tag the sources for a final release.
     TAG="gcc_`echo ${RELEASE} | tr . _`_release"
@@ -267,6 +266,7 @@ build_tarfiles() {
   build_tarfile gcc-${RELEASE} `basename ${SOURCE_DIRECTORY}`
 
   # Now, build one for each of the languages.
+  build_tarfile gcc-ada-${RELEASE} ${ADA_DIRS}
   build_tarfile gcc-g++-${RELEASE} ${CPLUSPLUS_DIRS}
   build_tarfile gcc-g77-${RELEASE} ${FORTRAN_DIRS}
   build_tarfile gcc-java-${RELEASE} ${JAVA_DIRS}
@@ -275,25 +275,19 @@ build_tarfiles() {
    
   # The core is everything else.
   EXCLUDES=""
-  for x in ${CPLUSPLUS_DIRS} ${FORTRAN_DIRS} ${JAVA_DIRS} \
-           ${OBJECTIVEC_DIRS} ${TESTSUITE_DIRS}; do
+  for x in ${ADA_DIRS} ${CPLUSPLUS_DIRS} ${FORTRAN_DIRS} \
+          ${JAVA_DIRS} ${OBJECTIVEC_DIRS} ${TESTSUITE_DIRS}; do
     EXCLUDES="${EXCLUDES} --exclude $x"
   done
   build_tarfile gcc-core-${RELEASE} ${EXCLUDES} \
     `basename ${SOURCE_DIRECTORY}`
+}
 
-  # Possibly build diffs.
-  if [ -n "$OLD_TARS" ]; then
-    for old_tar in $OLD_TARS; do
-      build_diffs $old_tar
-    done
-  fi
-
-  # Build .bz2 files.
+# Build .bz2 files.
+build_bzip2() {
   for f in ${FILE_LIST}; do
     bzfile=${f%.gz}.bz2
-    zcat $f | ${BZIP2} > ${bzfile}
-    FILE_LIST="${FILE_LIST} ${bzfile}"
+    (zcat $f | ${BZIP2} > ${bzfile}) || error "Could not create ${bzfile}"
   done
 }
 
@@ -304,7 +298,7 @@ build_diffs() {
   old_vers=${old_file%.tar.gz}
   old_vers=${old_vers#gcc-}
   inform "Building diffs against version $old_vers"
-  for f in gcc gcc-g++ gcc-g77 gcc-java gcc-objc gcc-testsuite gcc-core; do
+  for f in gcc gcc-ada gcc-g++ gcc-g77 gcc-java gcc-objc gcc-testsuite gcc-core; do
     old_tar=${old_dir}/${f}-${old_vers}.tar.gz
     new_tar=${WORKING_DIRECTORY}/${f}-${RELEASE}.tar.gz
     if [ -e $old_tar ] && [ -e $new_tar ]; then
@@ -322,10 +316,11 @@ build_diff() {
   changedir $tmpdir
   tar xfz $1 || error "Could not unpack $1 for diffs"
   tar xfz $3 || error "Could not unpack $3 for diffs"
-  ${DIFF} $2 $4 | ${GZIP} > ../$5
+  ${DIFF} $2 $4 > ../${5%.gz}
   if [ $? -eq 2 ]; then
     error "Trouble making diffs from $1 to $3"
   fi
+  ${GZIP} ../${5%.gz} || error "Could not gzip ../${5%.gz}"
   changedir ..
   rm -rf $tmpdir
   FILE_LIST="${FILE_LIST} $5"
@@ -338,19 +333,32 @@ upload_files() {
 
   changedir "${WORKING_DIRECTORY}"
 
-  if [ $LOCAL -ne 0 ]; then
-    mkdir -p "${FTP_PATH}" \
+  # Make sure the directory exists on the server.
+  if [ $LOCAL -eq 0 ]; then
+    ${SSH} -l ${GCC_USERNAME} ${GCC_HOSTNAME} \
+      mkdir -p "${FTP_PATH}/diffs"
+    UPLOAD_PATH="${GCC_USERNAME}@${GCC_HOSTNAME}:${FTP_PATH}"
+  else
+    mkdir -p "${FTP_PATH}/diffs" \
       || error "Could not create \`${FTP_PATH}'"
+    UPLOAD_PATH=${FTP_PATH}
   fi
 
-  # Copy the tar files to the FTP server.
+  # Then copy files to their respective (sub)directories.
   for x in gcc*.gz gcc*.bz2; do
     if [ -e ${x} ]; then
       # Make sure the file will be readable on the server.
       chmod a+r ${x}
       # Copy it.
-      ${SCP} ${x} ${FTP_PATH} || \
-        error "Could not upload ${x}"
+      case ${x} in
+        *.diff.*)
+          SUBDIR="diffs/";
+          ;;
+        *)
+          SUBDIR="";
+      esac
+      ${SCP} ${x} ${UPLOAD_PATH}/${SUBDIR} \
+        || error "Could not upload ${x}"
     fi
   done
 }
@@ -372,8 +380,12 @@ CVS_PROTOCOL="ext"
 # The username to use when connecting to the server.
 CVS_USERNAME="${USER}"
 
-# The path to the directory where the files are uploaded for FTP.
-FTP_PATH="gccadmin@gcc.gnu.org:~ftp/pub/gcc"
+# The machine to which files will be uploaded.
+GCC_HOSTNAME="gcc.gnu.org"
+# The name of the account on the machine to which files are uploaded.
+GCC_USERNAME="gccadmin"
+# The directory in which the files will be placed.
+FTP_PATH="~ftp/pub/gcc"
 
 # The major number for the release.  For release `3.0.2' this would be 
 # `3'
@@ -406,6 +418,7 @@ SOURCE_DIRECTORY=""
 
 # The directories that should be part of the various language-specific
 # tar files.  These are all relative to the top of the source tree.
+ADA_DIRS="gcc/ada"
 CPLUSPLUS_DIRS="gcc/cp libstdc++-v3"
 FORTRAN_DIRS="gcc/f libf2c"
 JAVA_DIRS="gcc/java libjava libffi fastjar zlib boehm-gc"
@@ -424,11 +437,13 @@ SNAPSHOT=0
 LOCAL=0
 
 # Major operation modes.
+MODE_BZIP2=0
+MODE_DIFFS=0
 MODE_SOURCES=0
 MODE_TARFILES=0
 MODE_UPLOAD=0
 
-# Files generated to upload.
+# .gz files generated to create .bz2 files from.
 FILE_LIST=""
 
 # Programs we use.
@@ -439,6 +454,7 @@ DIFF="${DIFF:-diff -Nrc3pad}"
 ENV="${ENV:-env}"
 GZIP="${GZIP:-gzip --best}"
 SCP="${SCP:-scp -p}"
+SSH="${SSH:-ssh}"
 TAR="${TAR:-tar}"
 
 ########################################################################
@@ -457,15 +473,18 @@ while getopts "d:fr:u:t:p:sl" ARG; do
     l)    LOCAL=1
          SCP=cp
          FTP_PATH=~ftp/pub/gcc
-         PATH=~:$PATH;;
-    p)    OLD_TARS="${OLD_TARS} ${OPTARG}";;
+         PATH=~:/usr/local/bin:$PATH;;
+    p)    OLD_TARS="${OLD_TARS} ${OPTARG}"
+          if [ -d ${OPTARG} ]; then
+           error "-p argument must name a tarball"
+         fi;;
     \?)   usage;;
     esac
 done
 shift `expr ${OPTIND} - 1`
 
 # Perform consistency checking.
-if [ -z ${CVS_USERNAME} ]; then
+if [ ${LOCAL} -eq 0 ] && [ -z ${CVS_USERNAME} ]; then
   error "No username specified"
 fi
 
@@ -501,14 +520,14 @@ if [ $SNAPSHOT -eq 0 ]; then
   # If this is not a final release, set various parameters acordingly.
   if [ ${FINAL} -ne 1 ]; then
     RELEASE="${RELEASE}-${DATE}"
-    FTP_PATH="${FTP_PATH}/snapshots"
+    FTP_PATH="${FTP_PATH}/snapshots/"
   else
-    FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}"
+    FTP_PATH="${FTP_PATH}/releases/gcc-${RELEASE}/"
   fi
 else
   RELEASE=$DATE
-  # For now snapshots come from the 3.0 branch.
-  BRANCH=gcc-3_0-branch
+  # For now snapshots come from the 3.3 branch.
+  BRANCH=gcc-3_3-branch
   FTP_PATH="${FTP_PATH}/snapshots/${LONG_DATE}"
   TAG=gcc_ss_${DATE}
 
@@ -516,7 +535,6 @@ else
   # was.
   if [ $LOCAL -ne 0 ]; then
     LAST_DATE=`cat ~/.snapshot_date`
-    PREV_LAST_DATE=`cat ~/.prev_snapshot_date`
     LAST_LONG_DATE=`date --date=$LAST_DATE +%Y-%m-%d`
     LAST_DIR=~ftp/pub/gcc/snapshots/${LAST_LONG_DATE}
     OLD_TARS=${LAST_DIR}/gcc-${LAST_DATE}.tar.gz
@@ -529,6 +547,7 @@ SOURCE_DIRECTORY="${WORKING_DIRECTORY}/gcc-${RELEASE}"
 
 # Recompute the names of all the language-specific directories,
 # relative to the WORKING_DIRECTORY.
+ADA_DIRS=`adjust_dirs ${ADA_DIRS}`
 CPLUSPLUS_DIRS=`adjust_dirs ${CPLUSPLUS_DIRS}`
 FORTRAN_DIRS=`adjust_dirs ${FORTRAN_DIRS}`
 JAVA_DIRS=`adjust_dirs ${JAVA_DIRS}`
@@ -548,13 +567,19 @@ export CVSROOT
 # Main Program
 ########################################################################
 
+# Set the timezone to UTC
+TZ="UTC0"
+export TZ
+
 # Handle the major modes.
 while [ $# -ne 0 ]; do
     case $1 in
+    bzip2)    MODE_BZIP2=1;;
+    diffs)    MODE_DIFFS=1;;
     sources)  MODE_SOURCES=1;;
     tarfiles) MODE_TARFILES=1;;
     upload)   MODE_UPLOAD=1;;
-    all)      MODE_SOURCES=1; MODE_TARFILES=1; MODE_UPLOAD=1;;
+    all)      MODE_SOURCES=1; MODE_TARFILES=1; MODE_DIFFS=1; MODE_BZIP2=1; MODE_UPLOAD=1;;
     *)        error "Unknown mode $1";;
     esac
     shift
@@ -572,6 +597,22 @@ if [ $MODE_TARFILES -ne 0 ]; then
   build_tarfiles
 fi
 
+# Build diffs
+
+if [ $MODE_DIFFS -ne 0 ]; then
+  # Possibly build diffs.
+  if [ -n "$OLD_TARS" ]; then
+    for old_tar in $OLD_TARS; do
+      build_diffs $old_tar
+    done
+  fi
+fi
+
+# Build bzip2 files
+if [ $MODE_BZIP2 -ne 0 ]; then
+  build_bzip2
+fi
+
 # Upload them to the FTP server.
 
 if [ $MODE_UPLOAD -ne 0 ]; then
@@ -581,15 +622,14 @@ if [ $MODE_UPLOAD -ne 0 ]; then
   if [ $SNAPSHOT -ne 0 ] && [ $LOCAL -ne 0 ]; then
     # Update links on the FTP server.
     TEXT_DATE=`date --date=$DATE +%B\ %d,\ %Y`
-    LAST_TEXT_DATE=`date --date=$LAST_DATE +%B\ %d,\ %Y`
     cd ~ftp/pub/gcc/snapshots
-    sed -e "s%$LAST_DATE%$DATE%g" -e "s%$PREV_LAST_DATE%$LAST_DATE%g" \
-      -e "s%$LAST_LONG_DATE%$LONG_DATE%g" \
-      -e "s%$LAST_TEXT_DATE%$TEXT_DATE%g" < README > $$
+    sed -e "s%@DATE@%$DATE%g" -e "s%@LAST_DATE@%$LAST_DATE%g" \
+      -e "s%@LONG_DATE@%$LONG_DATE%g" \
+      -e "s%@TEXT_DATE@%$TEXT_DATE%g" < ~/scripts/snapshot-README > $$
     mv $$ README
-    sed -e "s%$LAST_DATE%$DATE%g" -e "s%$PREV_LAST_DATE%$LAST_DATE%g" \
-      -e "s%$LAST_LONG_DATE%$LONG_DATE%g" \
-      -e "s%$LAST_TEXT_DATE%$TEXT_DATE%g" < index.html > $$
+    sed -e "s%@DATE@%$DATE%g" -e "s%@LAST_DATE@%$LAST_DATE%g" \
+      -e "s%@LONG_DATE@%$LONG_DATE%g" \
+      -e "s%@TEXT_DATE@%$TEXT_DATE%g" < ~/scripts/snapshot-index.html > $$
     mv $$ index.html
 
     touch LATEST-IS-$LONG_DATE
@@ -597,7 +637,6 @@ if [ $MODE_UPLOAD -ne 0 ]; then
 
     # Update snapshot date file.
     changedir ~
-    mv .snapshot_date .prev_snapshot_date
     echo $DATE >.snapshot_date
 
     # Update gcc_latest_snapshot tag.
@@ -605,6 +644,7 @@ if [ $MODE_UPLOAD -ne 0 ]; then
     ${CVS} rtag -rgcc_ss_${DATE} gcc_latest_snapshot gcc
 
     # Announce the snapshot.
+    export QMAILHOST=gcc.gnu.org
     mail -s "gcc-ss-$DATE is now available" gcc@gcc.gnu.org < ~ftp/pub/gcc/snapshots/README
 
     # Remove working directory