Commit a11da280 authored by Vincent Chabannes's avatar Vincent Chabannes

add gmsh script

parent 55734456
#!/bin/bash
set -x
LIB_NAME="gmsh"
LIB_VERSION=2.16.0
GCC_VERSION=6.4.0
LIB_FULLNAME=${LIB_NAME}-${LIB_VERSION}
GCC_FULL=gcc-$GCC_VERSION
GCC_SHORT="gcc${GCC_VERSION//.}"
SUB_DIR=${LIB_NAME}/${LIB_VERSION}/${GCC_FULL}
WORK_DIR=/data/software/sources/${SUB_DIR}
SRC_DIR=${WORK_DIR}/${LIB_FULLNAME}-source
ARCHIVE=${WORK_DIR}/${LIB_FULLNAME}.tgz
URL="http://gmsh.info/src/gmsh-${LIB_VERSION}-source.tgz"
BUILD_DIR=${WORK_DIR}/${LIB_FULLNAME}-build
INSTALL_DIR=/data/software/install/${SUB_DIR}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MODULE_DIR=/data/software/modules/libs/${LIB_NAME}
MODULE_PATH=${MODULE_DIR}/${LIB_VERSION}_${GCC_SHORT}
install_lib()
{
module purge
module load gcc/${GCC_VERSION}
gcc --version |head -n 1
sleep 2
if [[ ! -f $ARCHIVE ]]; then
mkdir -p $WORK_DIR
wget $URL -O $ARCHIVE
fi
if [[ ! -d $SRC_DIR ]]; then
tar zxf $ARCHIVE --directory $WORK_DIR
fi
if [[ ! -d $BUILD_DIR ]]; then
mkdir $BUILD_DIR
cd $BUILD_DIR
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DENABLE_MPI=OFF \
-DENABLE_BUILD_LIB=ON \
-DENABLE_BUILD_SHARED=ON \
-DCMAKE_BUILD_TYPE=release \
-DENABLE_PETSC=OFF \
${SRC_DIR}
fi
cd $BUILD_DIR
make -j || exit 1
make -j install || exit 1
}
install_module()
{
cd $SCRIPT_DIR
mkdir -p ${MODULE_DIR}
export LIB_NAME
export LIB_VERSION
export INSTALL_DIR
envtpl --keep-template -o $MODULE_PATH module.tmpl
}
if [[ $1 == "module" ]]
then
install_module
else
install_lib
install_module
fi
#%Module1.0#####################################################################
###
### {{ LIB_NAME }} {{ LIB_VERSION }}
###
proc ModulesHelp { } {
global version prefix
puts stderr "\tlibs//{{ LIB_NAME }}/{{ LIB_VERSION }} - loads {{ LIB_NAME }} {{ LIB_VERSION }}"
}
module-whatis "Loads {{ LIB_NAME }} {{ LIB_VERSION }}"
# for Tcl script use only
set prefix {{ INSTALL_DIR }}
prepend-path PATH $prefix/bin
prepend-path LD_LIBRARY_PATH $prefix/lib
prepend-path LIBRARY_PATH $prefix/lib
setenv GMSH_DIR $prefix
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment