# Quick build setup script 1/3.  Should match with 'steps_linux_ubuntu20.rst'
# From bash shell:
#   sudo bash OS_notes.linux_ubuntu_20_64_a_admin.txt 2>&1 | tee o.ubu_20_a.txt
# From tcsh shell:
#   sudo bash OS_notes.linux_ubuntu_20_64_a_admin.txt |& tee o.ubu_20_a.txt


echo "++ Add universe repo"
sudo add-apt-repository universe


echo "++ Add PPAs for R programs"
sudo add-apt-repository -y "ppa:marutter/rrutter4.0"
sudo add-apt-repository -y "ppa:c2d4u.team/c2d4u4.0+"


echo "++ Update package manager info"
sudo apt-get update


echo "++ Get main dependencies"
sudo apt-get install -y tcsh xfonts-base libssl-dev       \
                        python-is-python3                 \
                        python3-matplotlib python3-numpy  \
                        python3-flask python3-flask-cors  \
                        python3-pil                       \
                        gsl-bin netpbm gnome-tweak-tool   \
                        libjpeg62 xvfb xterm vim curl     \
                        gedit evince eog                  \
                        libglu1-mesa-dev libglw1-mesa     \
                        libxm4 build-essential            \
                        libcurl4-openssl-dev libxml2-dev  \
                        libgfortran-8-dev libgomp1        \
                        gnome-terminal nautilus           \
                        gnome-icon-theme-symbolic         \
                        firefox xfonts-100dpi             \
                        r-base-dev cmake bc git


echo "++ Get more dependencies for R-package brms"
sudo apt-get install -y libgdal-dev libopenblas-dev       \
                        libnode-dev libudunits2-dev       \
                        libgfortran4

echo "++ Update matplotlib beyond 3.1.2 (has jpg error)"
sudo apt-get install -y pip
sudo apt-get remove  -y python3-matplotlib
# ... and pip is used to install new matplotlib in part 'b', without sudo

echo "++ Make symlink for package GSL"
sudo ln -s \
        /usr/lib/x86_64-linux-gnu/libgsl.so.23            \
        /usr/lib/x86_64-linux-gnu/libgsl.so.19


echo "++ Done with sudo-required part"
