RUN cd$INSTALLDIR/dysco && git clone https://github.com/aroffringa/dysco.git src &&cd src
RUN if["$DYSCO_VERSION"!="latest"];then cd$INSTALLDIR/dysco/src && git checkout $DYSCO_VERSION;fi
RUN cd$INSTALLDIR/dysco/src && git checkout $DYSCO_VERSION
RUN cd$INSTALLDIR/dysco/build && cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/dysco -DCASACORE_ROOT_DIR=$INSTALLDIR/casacore -DPORTABLE=True ../src && make -s-j$J&& make install
RUN cd$INSTALLDIR&&rm-rf$INSTALLDIR/dysco/build &&rm-rf$INSTALLDIR/dysco/src
#
#=============================
# Install AOFlagger
#
#=============================
RUN mkdir-p${INSTALLDIR}/aoflagger/build &&cd${INSTALLDIR}/aoflagger && git clone git://git.code.sf.net/p/aoflagger/code aoflagger &&cd${INSTALLDIR}/aoflagger/aoflagger
RUN if["${AOFLAGGER_VERSION}"!="latest"];then cd${INSTALLDIR}/aoflagger/aoflagger && git checkout tags/${AOFLAGGER_VERSION};fi
RUN cd${INSTALLDIR}/aoflagger/aoflagger && git checkout tags/${AOFLAGGER_VERSION}
RUN source$INSTALLDIR/pyenv-py2/bin/activate &&cd${INSTALLDIR}/aoflagger/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/aoflagger/ -DCASACORE_ROOT_DIR=${INSTALLDIR}/casacore -DBUILD_SHARED_LIBS=ON -DPORTABLE=True ../aoflagger
RUN source$INSTALLDIR/pyenv-py2/bin/activate &&cd${INSTALLDIR}/aoflagger/build && make -s-j${J}&& make install
RUN cd$INSTALLDIR&&rm-rf$INSTALLDIR/aoflagger/aoflagger &&rm-rf$INSTALLDIR/aoflagger/build &&rm-rf$INSTALLDIR/aoflagger/src
#
#=============================
# Install LOFAR
#
#=============================
RUN mkdir-p${INSTALLDIR}/lofar/build/gnucxx11_opt
RUN if["${LOFAR_VERSION}"="latest"];then cd${INSTALLDIR}/lofar && svn checkout https://svn.astron.nl/LOFAR/trunk src;fi
RUN if["${LOFAR_VERSION}"!="latest"];then cd${INSTALLDIR}/lofar && svn checkout https://svn.astron.nl/LOFAR/tags/LOFAR-Release-${LOFAR_VERSION} src;fi
RUN cd${INSTALLDIR}/lofar && svn checkout https://svn.astron.nl/LOFAR/trunk src
RUN cd${INSTALLDIR}/lofar && svn checkout https://svn.astron.nl/LOFAR/tags/LOFAR-Release-${LOFAR_VERSION} src
RUN cd$INSTALLDIR/lofar && svn update --depth=infinity $INSTALLDIR/lofar/src/CMake
RUN cd$INSTALLDIR/lofar/ && wget https://raw.githubusercontent.com/tikk3r/lofar-grid-hpccloud/master/patches/lofar.patch &&\
RUN cd$INSTALLDIR/lofar/ && wget https://raw.githubusercontent.com/tikk3r/lofar-grid-hpccloud/cd33001869d8318ca1ee14e838ac40122c405260/patches/lofar.patch &&\
# Install the standalone StationResponse libraries.
#
#=============================
# Install the standalone
# StationResponse libraries.
#=============================
RUN mkdir-p$INSTALLDIR/LOFARBeam/build &&cd$INSTALLDIR/LOFARBeam && git clone https://github.com/lofar-astron/LOFARBeam.git src
RUN cd$INSTALLDIR/LOFARBeam && git checkout 5b5d80ff308784adbf00985293257b16afff86b2
RUN source$INSTALLDIR/pyenv-py2/bin/activate &&cd$INSTALLDIR/LOFARBeam/build && cmake -DCMAKE_INSTALL_PREFIX=$INSTALLDIR/lofar ../src && make -j$J&& make install
RUN touch /opt/lofar/lofar/lib64/python2.7/site-packages/lofar/__init__.py
RUN cd$INSTALLDIR&&rm-rf$INSTALLDIR/LOFARBeam/build &&rm-rf$INSTALLDIR/LOFARBeam/src
#
#=============================
# Install EveryBeam library
#
#=============================
RUN mkdir-p$INSTALLDIR/EveryBeam/build &&cd$INSTALLDIR/EveryBeam && git clone https://git.astron.nl/RD/EveryBeam.git src &&\
RUN wget -O /opt/hdf5/hdf5-${HDF5_VERSION}.tar.gz https://www.ict.inaf.it/gitlab/lofarit/container-data/-/raw/master/software-packages/hdf5-${HDF5_VERSION}.tar.gz?inline=false
RUN wget -O /tmp/ds9.fedora30.8.2.tar.gz https://www.ict.inaf.it/gitlab/lofarit/container-data/-/raw/master/software-packages/ds9.fedora30.8.2.tar.gz?inline=false