Add devcontainer definition

This commit is contained in:
dcvz 2024-05-19 13:53:34 +02:00
parent 466b766cfa
commit 912acbf96d
3 changed files with 70 additions and 0 deletions

12
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends ninja-build libsdl2-dev libgtk-3-dev lld llvm clang-15
ARG INSTALL_SDL2_VERSION_FROM_SOURCE="2.26.1"
COPY ./install-sdl2.sh /tmp/
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 \

View File

@ -0,0 +1,21 @@
{
"name": "Zelda64Recomp",
"build": {
"dockerfile": "Dockerfile",
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "gcc -v",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@ -0,0 +1,37 @@
#!/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