#!/bin/bash -x

if [ "x${GROUP_DIR}" = "x" ];then
    export GROUP_DIR=`pwd`/idea
    echo "$GROUP_DIR not set. Installing here."
else
    export GROUP_DIR
fi

if [ "x${LEGACY}" = "x" ]; then
    export LEGACY=""
fi

# get the code from git
cd $GROUP_DIR
if [ ! -e $GROUP_DIR/idea ] ; then
    git clone https://:@gitlab.cern.ch:8443/delphi/idea.git
    rm -rf idea/.git
fi

cd idea/pro
./build.csh