Code:
#!/usr/bin/env bash
#
# Dev environment setup � safe to re-run.
# Re-running updates the git repos to their latest version and refreshes apt packages.
# --- helper: clone a repo if it's missing, otherwise update it to the latest version ---
clone_or_update() {
url="$1"
dir="$2"
if [ -d "$dir/.git" ]; then
echo "Updating $dir (pulling latest)"
git -C "$dir" pull --ff-only
else
echo "Cloning $dir"
git clone "$url" "$dir"
fi
}
echo installing
echo installing cmake
cd "$HOME"
sudo apt update # refresh the package index so re-runs get the latest apt versions
sudo apt install cmake -y
echo
# stb
echo installing STB
clone_or_update https://github.com/nothings/stb.git "$HOME/stb"
echo STB install done
# GLM
echo installing GLM
clone_or_update https://github.com/g-truc/glm.git "$HOME/glm"
echo GLM Install done
echo "Installing Jeremiah Audio"
clone_or_update https://github.com/3dgep/Audio.git "$HOME/Audio"
cd "$HOME/Audio"
rm -rf build # start clean so Debug AND Release rebuild correctly every run
mkdir -p build
cd build
# ---- Debug ----
cmake -DCMAKE_BUILD_TYPE=Debug ../
cmake --build .
mkdir -p ../lib/Debug
mv ../lib/*.a ../lib/Debug/
echo "debug audio files added"
# ---- Release ----
cmake -DCMAKE_BUILD_TYPE=Release ../
cmake --build .
mkdir -p ../lib/Release
mv ../lib/*.a ../lib/Release/
echo "release audio files added"
cd "$HOME"
# Bullet installation:
sudo apt install libbullet-dev -y
echo Bullet installed.
# XrandR
echo installing XrandR for Resolution changes
sudo apt install libxrandr-dev -y
echo Xrandr installed
echo installing libopenAL and sound libs, these are largely replaced now, but kept for compatibility
sudo apt install libopenal-dev -y
sudo apt install pulseaudio -y
sudo apt install libalut-dev -y
sudo apt install libogg-dev -y
sudo apt install libvorbis-dev -y
sudo apt install vorbis-tools -y
echo we have installed OpenAL and companion audio
echo get latest mesa libs
sudo apt install libgles2-mesa-dev -y
echo libmesa is Done
# Install FreeType
echo Installing freetype...
sudo apt install libfreetype6 libfreetype6-dev -y
echo FreeType installed
echo installing Assimp
cd "$HOME"
sudo apt install libassimp-dev -y
echo Assimp installed
echo installing VLC
sudo apt install libvlc-dev -y
echo VLC Installed
echo enhancing GPU debug output NOTE- not all will install
sudo apt install libglx-mesa0-dbgsym libglapi-mesa-dbgsym libgl1-mesa-dri-dbgsym -y
echo Done!
echo
echo Scroll up to make sure there were no errors, warnings are ok
echo Take note of the errors and check the web/support sites for fixes
read -s -p "Press Enter when you're ready!"
echo ...