Skip to content

Instantly share code, notes, and snippets.

@transientlunatic
Last active January 25, 2018 11:50
Show Gist options
  • Save transientlunatic/82cd52594c3cc8bcf529 to your computer and use it in GitHub Desktop.
Save transientlunatic/82cd52594c3cc8bcf529 to your computer and use it in GitHub Desktop.
LAL Install script
#! /bin/bash
LIBFRAME_VER=v8r26
# CHECK IF WE'RE INSTALLING INTO A VIRTUALENV
if [ -n "$VIRTUAL_ENV" ]; then
echo "This installation appears to be within a virtual environment."
echo "LALSuite will be installed to $VIRTUAL_ENV."
LOCATION=$VIRTUAL_ENV
pip install numpy scipy
else
echo "This installation does not appear to be within a virtual environment."
echo "Will attempt to install to a folder in your home directory."
LOCATION=$HOME/.local;
fi
# DEFINE THE DIRECTORIES
LALSUITE_PREFIX=${LOCATION} # install directory: change as appropriate
LIBFRAME_PREFIX=${LOCATION}
METAIO_PREFIX=${LOCATION}
if [[ $1 = 'GRID' ]]; then
echo $GRID
echo "Installing on the LIGO Data Grid".
LALSUITE_SRCDIR=/usr1/${USER}/repositories; # uncomment for LDG
elif [[ $1 = 'UWM' ]]; then
LALSUITE_SRCDIR=/people/${USER}/repositories; # uncomment for Nemo, UWM
else
LALSUITE_SRCDIR=${HOME}/repositories;
fi
# MAKE ALL OF THE REQUIRED DIRECTORIES
mkdir -p ${LALSUITE_SRCDIR}
mkdir -p ${LALSUITE_PREFIX}
mkdir -p ${LIBFRAME_PREFIX}
#
# LIBFRAME
#
# echo "***********************************************"
# echo "* Installing LibFrame *"
# echo "***********************************************"
# FETCH LIBFRAME
cd ${LALSUITE_SRCDIR}
if [ ! -f $LIBFRAME_VER.tar.gz ]; then
echo " * The tarball for the frame library was not found."
echo " Attempting to download it from IN2P3."
wget http://lappweb.in2p3.fr/virgo/FrameL/$LIBFRAME_VER.tar.gz # For the 2015-05-17 release
tar -xf $LIBFRAME_VER.tar.gz
fi
cd $LIBFRAME_VER
# CONFIG BUILD INSTALL LIBFRAME
autoreconf --install
./configure --silent --enable-silent-rules --prefix=${LIBFRAME_PREFIX} --enable-swig-python
make -s -j || make --silent # (build results are stored on the src directory)
make install --silent
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIBFRAME_PREFIX} # to update the libraries paths
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${LIBFRAME_PREFIX}/lib/pkgconfig
export CPATH=$CPATH:${VIRTUAL_ENV}/include
# #
# # MetaIO
# #
# Clone the git repo
cd ${LALSUITE_SRCDIR}
# if [ ! -d "metaio" ]; then
# git clone https://git.ligo.org/lscsoft/metaio.git
# cd metaio
# else
# cd metaio
# git pull
# fi
# The MetaIO repository is apparently no longer publically available
# so we'll fetch the tarball and extract it.
if [ ! -d "metaio-8.4.0" ]; then
echo "Can't find a directory containing metaIO"
echo "Downloading the tarball."
wget http://software.ligo.org/lscsoft/source/metaio-8.4.0.tar.gz -O - \ | tar xzf -
cd metaio-8.4.0
else
cd metaio
fi
./00boot
LDFLAGS=-L${VIRTUAL_ENV}/lib ./configure --enable-silent-rules --prefix=${METAIO_PREFIX} --enable-swig-python
make -s -j --silent || exit 1
make install --silent || exit 1
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${METAIO_PREFIX}/lib
# #
# # LALSUITE
# #
# Clone the repo
cd ${LALSUITE_SRCDIR}
git clone https://github.com/lscsoft/lalsuite.git # replace as appropriate
# Configure make and install
cd ${LALSUITE_SRCDIR}/lalsuite
# Checkout a specific branch of lalsuite if required
if [ -n "$LALBRANCH" ]; then
git checkout $LALBRANCH;
fi
./00boot
LDFLAGS=-L${VIRTUAL_ENV}/lib ./configure --enable-silent-rules --prefix=${LALSUITE_PREFIX} --enable-swig-python
make -j --silent || exit 1
make install --silent || exit 1
# Now ready the environment (this line needs to be run every time a shell session is started, so add it to the ~/.bashrc file
source ${LALSUITE_PREFIX}/etc/lalsuiterc
#
# PyLAL
#
cd ${LALSUITE_SRCDIR}/lalsuite/pylal
rm -rf build
LDFLAGS=-L${VIRTUAL_ENV}/lib python setup.py install --prefix=${LALSUITE_PREFIX}
#
# Glue
#
cd ${LALSUITE_SRCDIR}/lalsuite/glue
rm -rf build
python setup.py install --prefix=${LALSUITE_PREFIX}
LDFLAGS=-L${VIRTUAL_ENV}/lib source ${LALSUITE_PREFIX}/etc/glue-user-env.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment