From 7f63d09f96336a7b2538928a52a065af2f73fa4c Mon Sep 17 00:00:00 2001 From: dcvz Date: Sun, 19 May 2024 14:35:00 +0200 Subject: [PATCH] install n64recomp tools --- .devcontainer/Dockerfile | 3 ++ .devcontainer/install-n64recomp.sh | 44 ++++++++++++++++++++++++++++++ .devcontainer/install-sdl2.sh | 17 ++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 .devcontainer/install-n64recomp.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index bd7a454..799d28e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,3 +10,6 @@ RUN if [ "${INSTALL_SDL2_VERSION_FROM_SOURCE}" != "none" ]; then \ chmod +x /tmp/install-sdl2.sh && /tmp/install-sdl2.sh ${INSTALL_SDL2_VERSION_FROM_SOURCE}; \ fi \ && rm -f /tmp/install-sdl2.sh + +RUN chmod +x /tmp/install-n64recomp.sh && /tmp/install-n64recomp.sh +RUN rm -f /tmp/install-n64recomp.sh diff --git a/.devcontainer/install-n64recomp.sh b/.devcontainer/install-n64recomp.sh new file mode 100644 index 0000000..6cb880c --- /dev/null +++ b/.devcontainer/install-n64recomp.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +set -e + +# 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 N64Recomp..." + +architecture=$(dpkg --print-architecture) +case "${architecture}" in + arm64) + ARCH=aarch64 ;; + amd64) + ARCH=x86_64 ;; + *) + echo "Unsupported architecture ${architecture}." + exit 1 + ;; +esac + +TMP_DIR=$(mktemp -d -t n64recomp-XXXXXXXXXX) + +echo "${TMP_DIR}" +cd "${TMP_DIR}" + +git clone https://github.com/Mr-Wiseguy/N64Recomp.git --recurse-submodules N64RecompSource +cd N64RecompSource + +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build +cmake --build cmake-build --config Release --target N64Recomp -j $(nproc) +cmake --build cmake-build --config Release --target RSPRecomp -j $(nproc) + +sudo cp -v cmake-build/N64Recomp /usr/local/bin/ +sudo cp -v cmake-build/RSPRecomp /usr/local/bin/ diff --git a/.devcontainer/install-sdl2.sh b/.devcontainer/install-sdl2.sh index 1609971..a693b1d 100644 --- a/.devcontainer/install-sdl2.sh +++ b/.devcontainer/install-sdl2.sh @@ -23,6 +23,23 @@ trap cleanup EXIT echo "Installing CMake..." +architecture=$(dpkg --print-architecture) +case "${architecture}" in + arm64) + ARCH=aarch64 ;; + amd64) + ARCH=x86_64 ;; + *) + echo "Unsupported architecture ${architecture}." + exit 1 + ;; +esac + +TMP_DIR=$(mktemp -d -t sdl2-XXXXXXXXXX) + +echo "${TMP_DIR}" +cd "${TMP_DIR}" + wget https://www.libsdl.org/release/SDL2-${SDL2_VERSION}.tar.gz tar -xzf SDL2-${SDL2_VERSION}.tar.gz cd SDL2-${SDL2_VERSION}