hypre/mklibs

214 lines
4.7 KiB
Bash
Executable File

#!/bin/ksh
#BHEADER***********************************************************************
# (c) 2000 The Regents of the University of California
#
# See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
# notice, contact person, and disclaimer.
#
# $Revision$
#EHEADER***********************************************************************
help ()
{
printf "$0: [-help] | {-g|-b|-a} HypreArchiveFile [install]\n"
printf " -g general release\n"
printf " -b beta release\n"
printf " -a alpha release\n"
printf " HypreArchiveFile, the name of the tar file produced by\n"
printf " mkdist (e.g., hypre-1.3.0.tar.gz) assumed to exist in\n"
printf " the current working directory.\n"
printf " install will replace the symbolic links.\n"
}
usage ()
{
printf "usage: $0 {-g|-b|-a} HypreArchiveFile [install]\n"
}
build_general ()
{
HYPRE_INSTALL_DIR=$DIST_DIR/..
for i in bin debug docs include lib src
do
rm -fR $HYPRE_INSTALL_DIR/$i
ln -s $DIST_DIR/$i ../$i
done
for i in threads
do
if [ -d $DIST_DIR/$i ]
then
rm -fR $HYPRE_INSTALL_DIR/$i
ln -s $DIST_DIR/$i $HYPRE_INSTALL_DIR/$i
fi
done
}
build_beta ()
{
HYPRE_INSTALL_DIR=$DIST_DIR/../beta
for i in bin debug docs include lib src
do
rm -fR $HYPRE_INSTALL_DIR/$i
ln -s $DIST_DIR/$i $HYPRE_INSTALL_DIR/$i
done
for i in threads
do
if [ -d $DIST_DIR/$i ]
then
rm -fR $HYPRE_INSTALL_DIR/$i
ln -s $DIST_DIR/$i $HYPRE_INSTALL_DIR/$i
fi
done
}
build_alpha ()
{
if [ "$SYS_TYPE" = "SunOS" ]
then
HYPRE_INSTALL_DIR=$DIST_DIR/../alpha
for i in bin debug docs include lib src
do
rm -fR $HYPRE_INSTALL_DIR/$i
ln -s $DIST_DIR/$i $HYPRE_INSTALL_DIR/$i
done
for i in threads
do
if [ -d $DIST_DIR/$i ]
then
rm -fR $HYPRE_INSTALL_DIR/$i
ln -s $DIST_DIR/$i $HYPRE_INSTALL_DIR/$i
fi
done
fi
}
# Define install permissions:
# - give everybody read/execute permission
# - give user/group write permission
#=============================================================================
HYPRE_INSTALL_PERMISSIONS="a+rX,ug+w"
#=============================================================================
# Set install directories:
#=============================================================================
HYPRE_CASC_INSTALL_DIR="/home/casc/software/hypre"
HYPRE_DEC_INSTALL_DIR="/usr/apps/hypre"
HYPRE_BLUE_INSTALL_DIR="/usr/apps/hypre"
HYPRE_RED_INSTALL_DIR="/usr/apps/hypre"
#=============================================================================
# Parse arguments
#=============================================================================
case $1 in
-h|-help)
help
exit;;
esac
if [ $# -gt 1 ]
then
case "$1"
in
-g|-b|-a) OPTION=$1
TAR_FILE=$2 ;;
*) echo "Error: Invalid argument = $1, expecting -g, -b or -a"
exit ;;
esac
else
usage
exit
fi
#===========================================================================
# Update the source
#===========================================================================
if [ -f $TAR_FILE ]
then
gzip -cd $TAR_FILE | tar xof -
else
echo "Error: HypreArchiveFile does not exist"
exit
fi
DIST_DIR=`pwd`/${TAR_FILE%.tar.gz}
SYS_TYPE=`uname -s`
#===========================================================================
# Build and do a temporary install in the UPDATE subdirectory
#===========================================================================
cd $DIST_DIR
# MPI version. (Do this only once)
if [ ! -d lib ]
then
(
HYPRE_INSTALL_DIR=$DIST_DIR
export HYPRE_INSTALL_DIR
cd src
./configure
make install
make veryclean
)
(
HYPRE_INSTALL_DIR=$DIST_DIR/debug
export HYPRE_INSTALL_DIR
mkdir -p $HYPRE_INSTALL_DIR
cd src
./configure --enable-debug
make install
make veryclean
)
fi
# MPI + threads version. (Do this only once)
if [ ! -d threads/lib ]
then
if [ "$SYS_TYPE" != "SunOS" ]
then
(
HYPRE_INSTALL_DIR=$DIST_DIR/threads
export HYPRE_INSTALL_DIR
mkdir -p $HYPRE_INSTALL_DIR
cd src
./configure --with-openmp
make install
make veryclean
)
(
HYPRE_INSTALL_DIR=$DIST_DIR/threads/debug
export HYPRE_INSTALL_DIR
mkdir -p $HYPRE_INSTALL_DIR
cd src
./configure --with-openmp --enable-debug
make install
make veryclean
)
fi
fi
if [ "$3" = "install" ]
then
case "$OPTION"
in
-g) build_general
build_beta
build_alpha ;;
-b) build_beta
build_alpha ;;
-a) build_alpha ;;
esac
fi
chmod -fR $HYPRE_INSTALL_PERMISSIONS $DIST_DIR
chgrp -fR hypre $DIST_DIR