hypre/tools/mkdist
2012-03-19 18:15:21 +00:00

226 lines
6.1 KiB
Bash
Executable File

#!/bin/ksh
#BHEADER**********************************************************************
# Copyright (c) 2008, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# This file is part of HYPRE. See file COPYRIGHT for details.
#
# HYPRE is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License (as published by the Free
# Software Foundation) version 2.1 dated February 1999.
#
# $Revision$
#EHEADER**********************************************************************
#
# MaKe hypre DISTribution
# This script is used to create the hypre distribution tar files.
# Run on the CASC cluster from the users local directory space.
#
help ()
{
cat <<EOF
$0 [-help] | [-display] | VersionId
where:
-help Displays this message.
-display Reports the cvs rtag history.
VersionId Creates a distribution, where VersionId determines the
repository revision to use. VersionId can either have the
form VM-m-r to specify a release tag or Dyyyy-mm-dd to
specify a date. For example, V2-5-0a checks out source with
rtag 'V2-5-0a' and creates the tar file hypre-2.5.0a.tar.gz.
The option D2010-01-27 checks out the most recent source not
later than the date '2010-01-27' and creates the tar file
hypre-2010.01.27.tar.gz. The V option is used to create
official releases while the D option is useful for building
temporary releases for colleagues.
Example usage: $0 -display
$0 V2-5-0a
$0 D2010-01-27
EOF
}
display ()
{
printf "valid cvs rtags:\n"
cvs history -T -a | grep linear_solvers
}
#=============================================================================
# Parse arguments
#=============================================================================
case $1 in
-h|-help)
help
exit;;
-d|-disp|-display)
display
exit;;
esac
if [ $# -eq 1 ]
then
VersionId=$1
# determine version type and strip leading character from VersionId
VersionType=`echo ${VersionId}|cut -c1`
Version=`echo ${VersionId}|cut -c2-`
else
help
exit
fi
#===========================================================================
# Update the source
#===========================================================================
# create dist directory
HYPRE_DIR="hypre-${VersionId}"
HYPRE_DIST_INSTALL_DIR=`pwd`"/$HYPRE_DIR"
export HYPRE_DIST_INSTALL_DIR
mkdir -p $HYPRE_DIST_INSTALL_DIR
mkdir $HYPRE_DIST_INSTALL_DIR/src
# check the source code out of the repository
(
cd $HYPRE_DIST_INSTALL_DIR/src
if [ ! -d "$CVSROOT" ]
then
echo "Error: no CVS repository, CVSROOT = $CVSROOT"
exit
fi
if [ "$VersionType" = "V" ]
then
cvs export -r ${VersionId} linear_solvers
if [ $? -ne 0 ]
then
echo "Error: Rtag Version=${VersionId} not found in CVS repository"
display
exit
fi
elif [ "$VersionType" = "D" ]
then
cvs export -D ${Version} linear_solvers
else
echo "Error: Invalid leading character in VersionID=${VersionId}"
exit
fi
)
# replace dashes in version with dots and redefine directory names
Version=`echo ${Version}|sed 's/-/\./g'`
if [ $? -ne 0 ]
then
echo "Error: Invalid VersionID=${VersionId}"
exit
fi
mv $HYPRE_DIR "hypre-${Version}"
HYPRE_DIR="hypre-${Version}"
HYPRE_DIST_INSTALL_DIR=`pwd`"/$HYPRE_DIR"
# build documentation for examples sub-directory
(
cd $HYPRE_DIST_INSTALL_DIR/src/linear_solvers/examples/docs
make
)
# build documentation and install in the distribution directory
(
cd $HYPRE_DIST_INSTALL_DIR/src/linear_solvers
./configure --prefix=$HYPRE_DIST_INSTALL_DIR
(cd docs; make install; make distclean)
)
# store version info
(
cd $HYPRE_DIST_INSTALL_DIR
cp src/linear_solvers/COPYRIGHT .
cp src/linear_solvers/COPYING.LESSER .
cp src/linear_solvers/CHANGELOG .
cp src/linear_solvers/INSTALL .
cp src/linear_solvers/README .
)
# pop 'linear_solvers' directory to 'src'
mv $HYPRE_DIR/src/linear_solvers/* $HYPRE_DIR/src
rmdir $HYPRE_DIR/src/linear_solvers
# remove certain directories that should not appear in the release
rm -fr $HYPRE_DIR/src/AUTOTEST
rm -fr $HYPRE_DIR/src/test/AUTOTEST
rm -fr $HYPRE_DIR/src/babel/bHYPREClient-J
HYPRE_TARNAME=$HYPRE_DIR.tar
HYPRE_FILES="\
$HYPRE_DIR/CHANGELOG \
$HYPRE_DIR/COPYRIGHT \
$HYPRE_DIR/COPYING.LESSER \
$HYPRE_DIR/INSTALL \
$HYPRE_DIR/README \
$HYPRE_DIR/docs \
$HYPRE_DIR/src/CMakeLists.txt \
$HYPRE_DIR/src/FEI_mv \
$HYPRE_DIR/src/HYPRE.h \
$HYPRE_DIR/src/HYPREf.h \
$HYPRE_DIR/src/IJ_mv \
$HYPRE_DIR/src/Makefile \
$HYPRE_DIR/src/blas \
$HYPRE_DIR/src/config \
$HYPRE_DIR/src/configure \
$HYPRE_DIR/src/distributed_ls \
$HYPRE_DIR/src/distributed_matrix \
$HYPRE_DIR/src/docs \
$HYPRE_DIR/src/examples/ex* \
$HYPRE_DIR/src/examples/vis* \
$HYPRE_DIR/src/examples/Make* \
$HYPRE_DIR/src/examples/README.html \
$HYPRE_DIR/src/examples/README_files \
$HYPRE_DIR/src/krylov \
$HYPRE_DIR/src/lapack \
$HYPRE_DIR/src/lib \
$HYPRE_DIR/src/matrix_matrix \
$HYPRE_DIR/src/multivector \
$HYPRE_DIR/src/nopoe \
$HYPRE_DIR/src/parcsr_block_mv \
$HYPRE_DIR/src/parcsr_ls \
$HYPRE_DIR/src/parcsr_mv \
$HYPRE_DIR/src/seq_mv \
$HYPRE_DIR/src/seq_ls/pamg \
$HYPRE_DIR/src/sstruct_ls \
$HYPRE_DIR/src/sstruct_mv \
$HYPRE_DIR/src/struct_ls \
$HYPRE_DIR/src/struct_mv \
$HYPRE_DIR/src/tarch \
$HYPRE_DIR/src/test \
$HYPRE_DIR/src/utilities \
"
HYPRE_BABEL_DIR=$HYPRE_DIR-babel
HYPRE_BABEL_TARNAME=$HYPRE_BABEL_DIR.tar
HYPRE_BABEL_FILES="\
$HYPRE_FILES \
$HYPRE_DIR/src/babel \
$HYPRE_DIR/src/babel-runtime \
"
HYPRE_BABEL_FILES=`echo $HYPRE_BABEL_FILES | sed "s/$HYPRE_DIR/$HYPRE_BABEL_DIR/g"`
cp -fr $HYPRE_DIR $HYPRE_BABEL_DIR
# create the hypre tar file
echo "creating $HYPRE_TARNAME file ..."
tar cf $HYPRE_TARNAME $HYPRE_FILES
gzip $HYPRE_TARNAME
# create the hypre-babel tar file
echo "creating $HYPRE_BABEL_TARNAME file ..."
tar cf $HYPRE_BABEL_TARNAME $HYPRE_BABEL_FILES
gzip $HYPRE_BABEL_TARNAME