document building with Docker

This commit is contained in:
Dsaster 2021-02-06 01:44:52 +01:00
parent 572eddf489
commit 563b14a97f
3 changed files with 44 additions and 1 deletions

View File

@ -54,6 +54,18 @@ Run `make` to build the ROM. The ROM will be output as `build/diamond.us/pokedia
To build Pokemon Pearl, run `make pearl`. You do not need to clean your working tree in between compiling. Pokemon Pearl will be built as `build/pearl.us/pokepearl.us.nds`.
Windows Users:
#### Windows
If you get an error in saving configuration settings when specifying the license file, you need to add a system environment variable called LM_LICENSE_FILE and point it to the license.dat file. Alternatively, run mwccarm.exe from an Administrator command prompt, PowerShell, or WSL session.
#### Docker
If you find issues building the ROMs with the above methods, you can try the Docker-specific build script. It will build a Docker image with the system requirements above, and run the `make` scripts (any specified parameter will be passed to the `make` command):
```console
$ make clean
$ ./docker/build.sh # build pokediamond
$ ./docker/build.sh pearl # build pokepearl
```
Note: Docker may not run at a full performance if its underlying Linux kernel is being virtualized (mainly Windows and macOS hosts).

11
docker/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM ubuntu:20.04
RUN dpkg --add-architecture i386 && \
apt update && \
DEBIAN_FRONTEND=noninteractive apt install -y --no-install-recommends binutils-arm-none-eabi build-essential git libpng-dev wine wine32 && \
rm -r /var/cache/apt/archives /var/lib/apt/lists
# Run a persistent wineserver to avoid errors like
# wine: a wine server seems to be running, but I cannot connect to it.
RUN mkdir -p /root/.wine
CMD /usr/lib/wine/wineserver32 -f -p

20
docker/build.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
set -eou pipefail
PROJECT_NAME=${PROJECT_NAME:-pokediamond}
PROJECT_PATH=${PROJECT_PATH:-$(dirname $(pwd))}
# Build container image
IMAGE_NAME=${IMAGE_NAME:-$PROJECT_NAME-image}
docker build -t $IMAGE_NAME .
# Start container and wine server
CONTAINER_NAME=${CONTAINER_NAME:-$PROJECT_NAME}
docker run -d -i --name $CONTAINER_NAME --rm -t -v $PROJECT_PATH:/$PROJECT_NAME -w /$PROJECT_NAME $IMAGE_NAME
# Build selected project, always exit successfully to ensure container stops
docker exec -i -t $CONTAINER_NAME make $@ || true
# Exit the container and remove
docker stop $CONTAINER_NAME