sit script and first sit class file for Open MPI
Install software package with > sit FILE
This commit is contained in:
parent
faffa75082
commit
1560cc6944
4 changed files with 301 additions and 0 deletions
15
etc/sit.conf
Normal file
15
etc/sit.conf
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Global sit configuration file
|
||||||
|
#
|
||||||
|
# Directory holding all the source tarballs
|
||||||
|
SRC_POOL=${SRC_POOL:="$HOME/src"}
|
||||||
|
|
||||||
|
# Working directory base path
|
||||||
|
WORKDIR_BASE=${WORKDIR_BASE:="$HOME/work"}
|
||||||
|
|
||||||
|
# Build class directory holing the sitclass
|
||||||
|
SCLASS_DIR=${SCLASS_DIR:="$SIT_PATH/packages"}
|
||||||
|
|
||||||
|
# basic installation directory
|
||||||
|
PREFIX_BASE=${PREFIX_BASE:="$HOME/bin"}
|
||||||
|
|
||||||
|
MAKEOPTS="-j2"
|
115
functions.sh
Normal file
115
functions.sh
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
sit_fail() {
|
||||||
|
msg=$0
|
||||||
|
echo "$msg"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
sit_info() {
|
||||||
|
msg=$0
|
||||||
|
echo $msg
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sit_countdown() {
|
||||||
|
local tt=$1
|
||||||
|
for i in $(seq $tt); do
|
||||||
|
echo -n "$i "
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unpack() {
|
||||||
|
if [ ! -e ${SRC_POOL}/${A} ] ; then
|
||||||
|
sit_fail "${SRC_POOL}/${A} doesn't exist"
|
||||||
|
fi
|
||||||
|
case "${A##*.}" in
|
||||||
|
bz2)
|
||||||
|
tar xfjv ${SRC_POOL}/${A} || sit_fail
|
||||||
|
;;
|
||||||
|
gz|tgz)
|
||||||
|
tar xfzv ${SRC_POOL}/${A} || sit_fail
|
||||||
|
;;
|
||||||
|
xz)
|
||||||
|
tar xfJv ${SRC_POOL}/${A} || sit_fail
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
sit_fail "Archive format not recogized"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
src_unpack() {
|
||||||
|
unpack
|
||||||
|
}
|
||||||
|
sit_unpack() {
|
||||||
|
sit_info "Unpacking sources ..."
|
||||||
|
cd ${WORKDIR}
|
||||||
|
src_unpack || sit_fail "Unpacking failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
src_configure() {
|
||||||
|
${SRCDIR}/configure --prefix=$PREFIX $CONFIGURE_OPTS
|
||||||
|
cp config.log $LOGDIR
|
||||||
|
}
|
||||||
|
sit_configure() {
|
||||||
|
sit_info "Configuring sources ..."
|
||||||
|
cd ${BUILDDIR}
|
||||||
|
src_configure || sit_fail "Configure failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
src_build() {
|
||||||
|
make $MAKEOPTS
|
||||||
|
}
|
||||||
|
sit_build() {
|
||||||
|
sit_info "Building sources ..."
|
||||||
|
cd ${BUILDDIR}
|
||||||
|
src_build || sit_fail "Build failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
src_pretest() {
|
||||||
|
/bin/true
|
||||||
|
}
|
||||||
|
sit_pretest() {
|
||||||
|
sit_info "Running pre installation tests ..."
|
||||||
|
cd ${BUILDDIR}
|
||||||
|
src_pretest || sit_fail "Pre installation tests failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
src_posttest() {
|
||||||
|
/bin/true
|
||||||
|
}
|
||||||
|
sit_posttest() {
|
||||||
|
sit_info "Running post installation tests ..."
|
||||||
|
cd ${BUILDDIR}
|
||||||
|
src_posttest || sit_fail "Post installation tests failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
make install
|
||||||
|
}
|
||||||
|
sit_install() {
|
||||||
|
sit_info "Installing package ..."
|
||||||
|
cd ${BUILDDIR}
|
||||||
|
src_install || sit_fail "Install failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
sit_copy_logs() {
|
||||||
|
cd $LOGDIR
|
||||||
|
bzip2 *.log
|
||||||
|
cp $LOGDIR/*.bz2 $PREFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
src_setperms() {
|
||||||
|
chmod -R g+rwX $PREFIX
|
||||||
|
chmod -R o+rX $PREFIX
|
||||||
|
}
|
||||||
|
sit_setperms() {
|
||||||
|
sit_info "Setting proper permissions"
|
||||||
|
src_setperms || sit_fail "Could not set permissions"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
27
packages/mpi/openmpi-1.5.1
Executable file
27
packages/mpi/openmpi-1.5.1
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Open MPI sit class file
|
||||||
|
#
|
||||||
|
# Christoph Niethammer <christoph.niethammer@web.de> (C) 2011
|
||||||
|
#
|
||||||
|
|
||||||
|
CATEGORY="mpi"
|
||||||
|
PACKAGE="openmpi"
|
||||||
|
VERSION="1.5.1"
|
||||||
|
URL="http://www.open-mpi.org"
|
||||||
|
INSTALLER="Christoph Niethammer <niethammer@hlrs.de>"
|
||||||
|
|
||||||
|
# Archive A and package name P
|
||||||
|
A=${PACKAGE}-${VERSION}.tar.bz2
|
||||||
|
P=${PACKAGE}-${VERSION}
|
||||||
|
|
||||||
|
CONFIGURE_OPTS="--with-devel-headers \
|
||||||
|
--enable-debug \
|
||||||
|
--enable-contrib-no-build=vt
|
||||||
|
--enable-shared \
|
||||||
|
--enable-static \
|
||||||
|
"
|
||||||
|
# Other interesting configure options:
|
||||||
|
# --enable-mpi-threads
|
||||||
|
# --enable-progress-threads
|
||||||
|
# --with-fca=DIR
|
||||||
|
|
144
sit
Executable file
144
sit
Executable file
|
@ -0,0 +1,144 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Install script inspired by the ebuild system of Gentoo Linux
|
||||||
|
#
|
||||||
|
# Christoph Niethammer <christoph.niethammer@web.de> (C) 2011
|
||||||
|
#
|
||||||
|
|
||||||
|
# exit on any error!
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SIT_PATH=$(dirname $(realpath $PWD/$0))
|
||||||
|
SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf
|
||||||
|
|
||||||
|
# Reading in global configuration file
|
||||||
|
if [[ -e $SIT_CONFIG_FILE ]] ; then
|
||||||
|
source $SIT_CONFIG_FILE
|
||||||
|
fi
|
||||||
|
source "$SIT_PATH/functions.sh"
|
||||||
|
|
||||||
|
# compiler to use
|
||||||
|
# (gnu|intel|pgi)
|
||||||
|
COMPILER=${COMPILER:=gnu}
|
||||||
|
# use specific compiler version
|
||||||
|
COMPILER_VERSION=${COMPILER_VERSION:=}
|
||||||
|
|
||||||
|
|
||||||
|
# add a descriptor at the end of the installation path e.g. for special config options etc.
|
||||||
|
PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler specifications
|
||||||
|
|
||||||
|
if [ -z "$COMPILER_VERSION" ] ; then
|
||||||
|
COMPILER_MODULE=compiler/${COMPILER}
|
||||||
|
else
|
||||||
|
COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION}
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Loading compiler module ${COMPILER_MODULE}"
|
||||||
|
module load ${COMPILER_MODULE}
|
||||||
|
|
||||||
|
case ${COMPILER} in
|
||||||
|
gnu)
|
||||||
|
COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran"
|
||||||
|
if [ "x${COMPILER_VERSION}" == "x" ] ; then
|
||||||
|
COMPILER_VERSION=$(gcc -dumpversion)
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
intel)
|
||||||
|
COMPILER_OPTS="CC=icc CXX=icpc FC=ifort F77=ifort"
|
||||||
|
if [ "x${COMPILER_VERSION}" == "x" ] ; then
|
||||||
|
COMPILER_VERSION=$(icc -dumpversion)
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
pgi)
|
||||||
|
COMPILER_OPTS="CC=pgcc CXX=pgCC FC=pgf95 F77=pgf77"
|
||||||
|
if [ "x${COMPILER_VERSION}" == "x" ] ; then
|
||||||
|
COMPILER_VERSION=$(pgcc -V | awk '/pgcc/{print $2}')
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown compiler ${COMPILER}."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# make the compiler variables CC, CXX, FC and F77 available
|
||||||
|
export ${COMPILER_OPTS}
|
||||||
|
|
||||||
|
if [ ! -z "$MPI" ] ; then
|
||||||
|
MPI_MODULE="mpi/$MPI"
|
||||||
|
if [ ! -z "$MPI_VERSION" ] ; then
|
||||||
|
MPI_MODULE=${MPI_MODULE}${MPI_VERSION:+"/${MPI_VERSION%%-*}-$COMPILER-$COMPILER_VERSION"}
|
||||||
|
fi
|
||||||
|
echo "Loading MPI module ${MPI_MODULE}"
|
||||||
|
module load $MPI_MODULE
|
||||||
|
MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which mpicc)))}
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
SCLASSFILE=$1
|
||||||
|
ACTION=$2
|
||||||
|
|
||||||
|
if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then
|
||||||
|
source $SCLASS_DIR/$SCLASSFILE
|
||||||
|
else
|
||||||
|
sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# construct the final installation directory path
|
||||||
|
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}"
|
||||||
|
PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION:+"-$MPI_VERSION"}
|
||||||
|
PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"}
|
||||||
|
PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR}
|
||||||
|
|
||||||
|
|
||||||
|
PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"}
|
||||||
|
echo "Installation PREFIX: $PREFIX"
|
||||||
|
|
||||||
|
# final working directory path
|
||||||
|
WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX
|
||||||
|
echo "Working dir: $WORKDIR"
|
||||||
|
|
||||||
|
# path to the source code directory
|
||||||
|
SRCDIR=${WORKDIR}/${P}
|
||||||
|
echo "Source dir: $SRCDIR"
|
||||||
|
|
||||||
|
# build directory (should be different from source directory):
|
||||||
|
BUILDDIR=${SRCDIR}/build
|
||||||
|
echo "Build dir: $BUILDDIR"
|
||||||
|
|
||||||
|
# logfile directory
|
||||||
|
LOGDIR=${WORKDIR}
|
||||||
|
echo "Logfile dir: $LOGDIR"
|
||||||
|
|
||||||
|
|
||||||
|
if [ -d ${WORKDIR} ] ; then
|
||||||
|
sit_info "Removing existing working directory ${WORKDIR}"
|
||||||
|
sit_countdown 5
|
||||||
|
rm -rf ${WORKDIR}
|
||||||
|
fi
|
||||||
|
mkdir -p ${WORKDIR}
|
||||||
|
mkdir -p ${BUILDDIR}
|
||||||
|
mkdir -p ${LOGDIR}
|
||||||
|
sit_unpack 2>&1 | tee "$LOGDIR/unpack.log"
|
||||||
|
sit_configure 2>&1 | tee "$LOGDIR/configure.log"
|
||||||
|
sit_build 2>&1 | tee "$LOGDIR/make.log"
|
||||||
|
sit_pretest 2>&1 | tee "$LOGDIR/pretest.log"
|
||||||
|
sit_install 2>&1 | tee "$LOGDIR/make_install.log"
|
||||||
|
sit_posttest 2>&1 | tee "$LOGDIR/posttest.log"
|
||||||
|
sit_copy_logs
|
||||||
|
sit_setperms
|
||||||
|
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
##############################################################################
|
||||||
|
# IMPORTANT!
|
||||||
|
##############################################################################
|
||||||
|
# Do not forget to provide a module file!
|
||||||
|
##############################################################################
|
||||||
|
EOF
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue