Commit c3c99b3c authored by Matthieu Boileau's avatar Matthieu Boileau

Add cmake

parent 88ef9586
#!/bin/bash
set -x
LIB_NAME="cmake"
LIB_VERSION=3.9.2
GCC_VERSION=6.4.0
LIB_FULLNAME=${LIB_NAME}-${LIB_VERSION}
LIB_VERSION_SHORT="${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}
ARCHIVE=${SRC_DIR}.tar.gz
URL="https://cmake.org/files/v${LIB_VERSION_SHORT}/${LIB_FULLNAME}.tar.gz"
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/tools/${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
${SRC_DIR}/configure \
--prefix=${INSTALL_DIR} || exit 1
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 }} module
###
proc ModulesHelp { } {
global version prefix
puts stderr "\ttools/{{ LIB_NAME }}/{{ LIB_VERSION }} - loads {{ LIB_NAME }} {{ LIB_VERSION }} and its environment"
}
module-whatis "Loads {{ LIB_NAME }} {{ LIB_VERSION }} and its environment"
# for Tcl script use only
set prefix {{ INSTALL_DIR }}
prepend-path CMAKE_PREFIX_PATH $prefix
prepend-path PATH $prefix/bin
#!/bin/bash
# source module configuration
FILE_TO_SOURCE=/etc/profile.d/modules.sh
if [[ -f "${FILE_TO_SOURCE}" ]]; then
source ${FILE_TO_SOURCE}
else
echo "File to source (${FILE_TO_SOURCE}) does not exist"
fi
# source atlas configuration for modules
PREVPATH=`pwd`
cd /data/software/config/etc
FILE_TO_SOURCE=feelpprc.sh
if [[ -f "${FILE_TO_SOURCE}" ]]; then
source ${FILE_TO_SOURCE}
else
echo "File to source (${FILE_TO_SOURCE}) does not exist"
fi
cd ${PREVPATH}
module purge
module load compilers/gcc/6.1.0
gcc --version
if [[ -z $CEMRACS_INSTALL_DIR ]]; then
export CEMRACS_INSTALL_DIR=/data/software/install
fi
if [[ ! -f ./cmake-3.6.1.tar.gz ]]; then
wget https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz
fi
if [[ ! -d ./cmake-3.6.1 ]]; then
tar zxvf cmake-3.6.1.tar.gz
fi
if [[ ! -d ./cmake-3.6.1-build ]]; then
mkdir cmake-3.6.1-build
cd cmake-3.6.1-build
../cmake-3.6.1/configure --prefix=${CEMRACS_INSTALL_DIR}/CMake/3.6.1/gcc-6.1.0
cd ..
fi
cd cmake-3.6.1-build
make -j 24
make install
cd ..
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