56 lines
1.8 KiB
Bash
56 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Installing depedencies
|
|
sudo apt update
|
|
sudo apt install libsdl2-dev libsdl2-image-dev git pkg-config automake make autoconf libtool -y
|
|
|
|
# Downloading and building GL4D
|
|
git clone https://github.com/noalien/GL4Dummies.git
|
|
cd GL4Dummies || exit
|
|
make -f Makefile.autotools
|
|
./configure
|
|
make
|
|
|
|
# Installing GL4D
|
|
sudo make install
|
|
|
|
# Removing sourcecode
|
|
cd ..
|
|
rm -rf GL4Dummies
|
|
|
|
# Fix for shared libraries (https://stackoverflow.com/a/9395355)
|
|
sudo ldconfig
|
|
|
|
# Changing env variables path and ld_library_path
|
|
# To correct locations to all the shell installed
|
|
|
|
# To .bashrc if exists
|
|
if [ -f "$HOME"/.bashrc ] ; then
|
|
echo "" >> "$HOME"/.bashrc
|
|
echo "# GL4Dummies" >> "$HOME"/.bashrc
|
|
echo "export PATH=\$PATH:\$HOME/local/bin" >> "$HOME"/.bashrc
|
|
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> "$HOME"/.bashrc
|
|
echo "" >> "$HOME"/.bashrc
|
|
fi
|
|
|
|
# To .zshrc if exists
|
|
if [ -f "$HOME"/.zshrc ] ; then
|
|
echo "" >> "$HOME"/.zshrc
|
|
echo "# GL4Dummies" >> "$HOME"/.zshrc
|
|
echo "export PATH=\$PATH:\$HOME/local/bin" >> "$HOME"/.zshrc
|
|
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> "$HOME"/.zshrc
|
|
echo "" >> "$HOME"/.zshrc
|
|
fi
|
|
|
|
# If config.fish exists
|
|
if [ -f "$HOME"/.config/fish/config.fish ] ; then
|
|
echo "" >> "$HOME"/.config/fish/config.fish
|
|
echo "# GL4Dummies" >> "$HOME"/.config/fish/config.fish
|
|
echo "set -gx PATH \$HOME/local/bin \$PATH" >> "$HOME"/.config/fish/config.fish
|
|
echo "set -gx LD_LIBRARY_PATH \$HOME/local/lib $LD_LIBRARY_PATH" >> "$HOME"/.config/fish/config.fish
|
|
echo "" >> "$HOME"/.config/fish/config.fish
|
|
fi
|
|
|
|
echo -e "\nGL4D library installed! 🎉"
|
|
echo "You may need to restart your shell to apply changes."
|
|
echo "When using <SDL2/SDL_image.h>, add -lSDL2_image flag with gcc."
|