BootStrap: library
From: centos:7


%help
    Development environment for CentOS 7


%post
    yum -y update
    yum -y install epel-release centos-release-scl
    yum -y install \
        redhat-lsb-core \
        bc man-db vim emacs tcsh which bash-completion screen tmux \
        "@Development Tools" \
        gcc gcc-c++ gcc-gfortran glibc-static libstdc++-static clang cppcheck \
        autoconf automake cvs git git-cvs cvsps subversion mercurial \
        rh-git227 devtoolset-{7..11} llvm-toolset-7 cmake3 ccache ninja-build \
        doxygen \
        Lmod openmpi-devel fftw-devel tcl-devel \
        python-{devel,virtualenv} numpy scipy tkinter \
        python3-{devel,tkinter} python36-{virtualenv,numpy,scipy} \
        rh-python38-python-{devel,tkinter,numpy,scipy} \
        boost169-devel \
        ncurses-devel \
        rlwrap \
        tk-devel fltk-devel \
        sqlite-devel netcdf-devel expat-devel hdf5-devel tng-devel \
        mesa-dri-drivers mesa-libGL-devel libglvnd-devel \
        libXi-devel libXinerama-devel libpng-devel \
        xfce4-terminal \
        texlive-latex texlive-epstopdf texlive-pdftex latex2html \
        texlive-graphics texlive-metafont \
        texlive-collection-latexrecommended texlive-collection-fontsrecommended

    # Build Charm++
    umask 022
    source /etc/profile
    module load mpi
    git clone --single-branch --depth=1 -b v7.0.0 https://github.com/UIUC-PPL/charm.git /opt/charm
    cd /opt/charm
    export CCACHE_DIR=/tmp
    ./build charm++ mpi-linux-x86_64 -j16 --with-production && \
    ./build charm++ multicore-linux-x86_64 -j16 --with-production && \
    ./build charm++ netlrts-linux-x86_64 -j16 --with-production

    # Load Git 2.27
    cat > /etc/profile.d/git.sh <<EOF
if [ \$(id -u) != 0 ] && [ -d /opt/rh/rh-git227 ] ; then
    source /opt/rh/rh-git227/enable
fi
EOF

    # Build and install spiff
    rm -fr /tmp/spiff
    git clone https://github.com/jhenin/spiff /tmp/spiff && \
        make -C /tmp/spiff && \
        install /tmp/spiff/spiff /usr/local/bin/

    # Install Tcl 8.6 to support newer NAMD versions
    cd /tmp && \
        rm -f tcl8.6.13-linux-x86_64-threaded.tar.gz && \
        curl -O https://www.ks.uiuc.edu/Research/namd/libraries/tcl8.6.13-linux-x86_64-threaded.tar.gz && \
        tar xzf tcl8.6.13-linux-x86_64-threaded.tar.gz && \
        cd tcl8.6.13-linux-x86_64-threaded && \
        find . -type f -exec install -v -D "{}" "/opt/tcl/8.6/{}" \; && \
        cd && \
        rm -fr /tmp/tcl8.6.13-linux-x86_64-threaded /tmp/tcl8.6.13-linux-x86_64-threaded.tar.gz
