Add devcontainer

This commit is contained in:
UsernameFodder 2023-12-26 23:44:45 -06:00
parent 9327eef8bd
commit e11c5181db
4 changed files with 104 additions and 0 deletions

53
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,53 @@
FROM ubuntu:22.04
# Link python -> python3 convenience
RUN ln -s python3 /usr/bin/python
# Basic utils
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
bash-completion \
build-essential \
curl \
git \
gnupg \
groff \
make \
pkg-config \
unzip \
software-properties-common \
sudo \
vim \
wget \
xvfb
# Decomp tools
RUN dpkg --add-architecture i386
RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
RUN add-apt-repository ppa:cybermax-dexter/sdl2-backport
RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/$(lsb_release -cs)/winehq-$(lsb_release -cs).sources
# We don't need Mono/Gecko
ENV WINEDLLOVERRIDES="mscoree=d;mshtml=d"
# Hide the annoying wine-internal "fixme" messages
ENV WINEDEBUG="fixme-all"
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-downgrades --install-recommends \
g++-10-multilib \
linux-libc-dev \
binutils-arm-none-eabi \
p7zip-full \
libpng-dev \
libpugixml-dev \
winehq-stable
RUN apt-get clean
RUN useradd -m -s /bin/bash -g sudo muttski
# Passwordless sudo for convenience
RUN echo "muttski ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/muttski
USER muttski
ENV CC=gcc-10
ENV CXX=g++-10
COPY onCreate.sh /opt/devcontainer/

View File

@ -0,0 +1,16 @@
{
"build": {
"dockerfile": "Dockerfile"
},
"runArgs": ["--init"],
"onCreateCommand": "/opt/devcontainer/onCreate.sh ${containerWorkspaceFolder}",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"dan-c-underwood.arm",
"ms-python.python"
]
}
}
}

31
.devcontainer/onCreate.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
set -e
WORKSPACE="$1"
cd /tmp
if [ ! -d "$WORKSPACE/tools/mwccarm" ]; then
wget https://cdn.discordapp.com/attachments/698589325620936736/845499146982129684/mwccarm.zip
unzip mwccarm.zip
mv -v mwccarm "$WORKSPACE/tools"
fi
if [ ! -d "$WORKSPACE/tools/bin" \
-o ! -f "$WORKSPACE/sub/ARM7-TS.lcf.template" \
-o ! -f "$WORKSPACE/ARM9-TS.lcf.template" \
-o ! -f "$WORKSPACE/mwldarm.response.template" ]; then
wget https://cdn.discordapp.com/attachments/698589325620936736/722822401963851797/NitroSDK-3_2-060901.7z
7z x NitroSDK-3_2-060901.7z
rm -rf "$WORKSPACE/tools/bin"
mv -v NitroSDK-3_2-060901/tools/bin "$WORKSPACE/tools"
mv -v NitroSDK-3_2-060901/include/nitro/specfiles/ARM7-TS.lcf.template "$WORKSPACE/sub/"
mv -v NitroSDK-3_2-060901/include/nitro/specfiles/ARM9-TS.lcf.template "$WORKSPACE/"
mv -v NitroSDK-3_2-060901/include/nitro/specfiles/mwldarm.response.template "$WORKSPACE/"
fi
# Set up wine under a virtual X11 server to hide the annoying GUI popup.
# Setting this up here means wine won't need to do setup on first build.
# Note that this doesn't work if done in the Dockerfile directly, it
# needs to be done in the running devcontainer.
xvfb-run wineboot

View File

@ -92,6 +92,10 @@ $ brew install coreutils make gnu-sed llvm arm-gcc-bin libpng git pkg-config
$ brew install wine-crossover
```
### Docker
This repository has a [devcontainer](https://containers.dev/) containing all the necessary dependencies, which can be used if you prefer not to install the dependencies manually.
## 3. Build ROM
Run `make` to build the ROM. This will build the North American ROM at `build/pmdsky.us/pmdsky.us.nds`. If you want the European ROM, run `make eu` to build the ROM at `build/pmdsky.eu/pmdsky.eu.nds`.