Zelda64Recomp/.devcontainer/install-sdl2.sh

38 lines
820 B
Bash
Raw Normal View History

2024-05-19 11:53:34 +00:00
#!/usr/bin/env bash
set -e
SDL2_VERSION=${1:-"none"}
if [ "${SDL2_VERSION}" = "none" ]; then
echo "No SDL2 version specified, skipping SDL2 installation"
exit 0
fi
# Cleanup temporary directory and associated files when exiting the script.
cleanup() {
EXIT_CODE=$?
set +e
if [[ -n "${TMP_DIR}" ]]; then
echo "Executing cleanup of tmp files"
rm -Rf "${TMP_DIR}"
fi
exit $EXIT_CODE
}
trap cleanup EXIT
echo "Installing CMake..."
wget https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz
tar -xzf SDL2-${SDL2_VERSION}.tar.gz
cd SDL2-${SDL2_VERSION}
./configure
make -j 10
sudo make install
if [ "$(uname -m)" == "x86_64" ]; then
sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/
else
sudo cp -av /usr/local/lib/libSDL* /usr/lib/aarch64-linux-gnu/
fi