From 563b14a97f6208e790843931afc54981f8e8f4b3 Mon Sep 17 00:00:00 2001 From: Dsaster <78389441+dsastr@users.noreply.github.com> Date: Sat, 6 Feb 2021 01:44:52 +0100 Subject: document building with Docker --- INSTALL.md | 14 +++++++++++++- docker/Dockerfile | 11 +++++++++++ docker/build.sh | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile create mode 100755 docker/build.sh diff --git a/INSTALL.md b/INSTALL.md index 35eb054d..6cbe5111 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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). diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..3bc11235 --- /dev/null +++ b/docker/Dockerfile @@ -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 diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 00000000..1ce28543 --- /dev/null +++ b/docker/build.sh @@ -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 -- cgit v1.2.3