286 lines
6.8 KiB
Bash
Executable File
286 lines
6.8 KiB
Bash
Executable File
#!/bin/sh
|
|
#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 LIBrarieS
|
|
# This script builds and installs the hypre distribution on the system
|
|
# on its host platform.
|
|
#
|
|
|
|
help ()
|
|
{
|
|
printf "$0: [-help] | [-n] {-g|-b|-a} HypreArchiveFile [install]\n"
|
|
printf " -n use preextracted archive\n"
|
|
printf " do NOT extract HypreArchiveFile from the repository\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) which is assumed to\n"
|
|
printf " exist in the current working directory.\n"
|
|
printf " install will replace the symbolic links.\n"
|
|
}
|
|
|
|
usage ()
|
|
{
|
|
printf "usage: $0 [-n] {-g|-b|-a} HypreArchiveFile [install]\n"
|
|
}
|
|
|
|
build_general ()
|
|
{
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/..
|
|
for i in debug docs include lib src
|
|
do
|
|
rm -fR $HYPRE_INSTALL_DIR/$i
|
|
ln -s $DIST_DIR/$i ../$i
|
|
done
|
|
for i in serial shared 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 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 serial shared 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
|
|
}
|
|
|
|
# Alpha releases are done ONLY on the CASC cluster
|
|
build_alpha ()
|
|
{
|
|
if [ "$PLATFORM_NAME" = "tux149" ]
|
|
then
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/../alpha
|
|
for i in 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 serial shared 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"
|
|
|
|
#=============================================================================
|
|
# Parse arguments
|
|
#=============================================================================
|
|
|
|
integer SKIPEXT=0
|
|
case $1 in
|
|
-n)
|
|
SKIPEXT=1
|
|
shift
|
|
;;
|
|
-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 [ "$SKIPEXT" != "1" ]
|
|
then
|
|
if [ -f $TAR_FILE ]
|
|
then
|
|
gzip -cd $TAR_FILE | tar xof -
|
|
else
|
|
echo "Error: HypreArchiveFile does not exist"
|
|
exit
|
|
fi
|
|
fi
|
|
|
|
DIST_DIR=`pwd`/${TAR_FILE%.tar.gz}
|
|
SYSTEMTYPE=`uname -s`
|
|
PLATFORM_NAME=`uname -n`
|
|
CONFIGURE="./configure"
|
|
MAKE="make -i"
|
|
|
|
#===========================================================================
|
|
# Build in the DIST_DIR 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
|
|
rm -f config.log config.status
|
|
$CONFIGURE --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/debug
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --enable-debug --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
fi
|
|
|
|
# serial version. (Do this only once)
|
|
if [ ! -d serial/lib ]
|
|
then
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/serial
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --without-MPI --with-COMM_SIMPLE --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/serial/debug
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --without-MPI --with-COMM_SIMPLE --enable-debug --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
fi
|
|
|
|
# MPI + threads version. (Do this only once)
|
|
if [ ! -d threads/lib ]
|
|
then
|
|
if [[ "$SYSTEMTYPE" != "SunOS" &&
|
|
"$SYSTEMTYPE" != "Linux" &&
|
|
"$SYSTEMTYPE" != "IRIX64" ]]
|
|
then
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/threads
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --with-openmp --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/threads/debug
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --with-openmp --enable-debug --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
fi
|
|
fi
|
|
|
|
# shared library version. (Do this only once)
|
|
if [ ! -d shared/lib ]
|
|
then
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/shared
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --enable-shared --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
(
|
|
HYPRE_INSTALL_DIR=$DIST_DIR/shared/debug
|
|
export HYPRE_INSTALL_DIR
|
|
mkdir -p $HYPRE_INSTALL_DIR
|
|
|
|
cd src
|
|
rm -f config.log config.status
|
|
$CONFIGURE --enable-shared --enable-debug --prefix=$HYPRE_INSTALL_DIR
|
|
$MAKE install
|
|
$MAKE distclean
|
|
)
|
|
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 -R $HYPRE_INSTALL_PERMISSIONS $DIST_DIR
|
|
chgrp -fR hyprelib $DIST_DIR
|