# Quick build setup script 1/3.
# - Should match with 'steps_linux_ubuntu24.rst' for setting up a user system.
# - This setup script is to create a build system, which can also apply to users.
#
# From bash shell:
#   sudo bash OS_notes.linux_ubuntu_24_64_a_admin.txt 2>&1 | tee o.ubu_24_a.txt
# From tcsh shell:
#   sudo bash OS_notes.linux_ubuntu_24_64_a_admin.txt |& tee o.ubu_24_a.txt


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


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-tweaks       \
                        libjpeg62 xvfb xterm vim curl     \
                        gedit evince eog                  \
                        libglu1-mesa-dev libglw1-mesa-dev \
                        libxm4 build-essential            \
                        libcurl4-openssl-dev libxml2-dev  \
                        libgfortran-14-dev libgomp1       \
                        gnome-terminal nautilus           \
                        firefox xfonts-100dpi             \
                        r-base-dev cmake bc git           \
                        libxext-dev libxmu-dev libxpm-dev \
                        libgsl-dev libglut-dev libxi-dev  \
                        libglib2.0-dev 
      

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


echo "++ Fix GLwDrawA.h"
cd /usr/include/GL
sudo mv GLwDrawA.h GLwDrawA.h.orig
sed 's/^GLAPI WidgetClass/extern GLAPI WidgetClass/' GLwDrawA.h.orig > /tmp/GLwDrawA.h
sudo mv /tmp/GLwDrawA.h GLwDrawA.h


echo "++ Done with sudo-required part"
