diff options
-rw-r--r-- | INSTALL.md | 12 | ||||
-rw-r--r-- | contrib/docker/Dockerfile.ubuntu | 13 | ||||
-rwxr-xr-x | contrib/docker/build_docker.sh | 30 |
3 files changed, 49 insertions, 6 deletions
@@ -80,6 +80,18 @@ To build Pokemon Pearl, run `make pearl`. You do not need to clean your working 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 an Alpine-based 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 +$ ./contrib/docker/build_docker.sh # build pokediamond +$ ./contrib/docker/build_docker.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). + #### macOS To avoid issues run the build as shown below. This avoids issues with missing features (i.e. "introduced in macOS 10.15" errors) and Apple's make not following standards. diff --git a/contrib/docker/Dockerfile.ubuntu b/contrib/docker/Dockerfile.ubuntu new file mode 100644 index 00000000..d06b15f2 --- /dev/null +++ b/contrib/docker/Dockerfile.ubuntu @@ -0,0 +1,13 @@ +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 + +WORKDIR /app + +# 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/contrib/docker/build_docker.sh b/contrib/docker/build_docker.sh index b59e2158..dafacbe7 100755 --- a/contrib/docker/build_docker.sh +++ b/contrib/docker/build_docker.sh @@ -1,11 +1,29 @@ #!/bin/sh -ver="0.1" +PROJECT_PATH="$(git rev-parse --show-toplevel)" +PROJECT_NAME="pokediamond" +PROJECT_VER="0.1" -docker inspect pokediamond:$ver > /dev/null -if [ $? = 0 ]; then - echo "Not rebuilding image since image exists"; +# Build container image +IMAGE_NAME="$PROJECT_NAME:$PROJECT_VER" +IMAGE_PATH="$PROJECT_PATH/contrib/docker" +if docker inspect $IMAGE_NAME > /dev/null; then + echo "Not rebuilding image since it already exists"; +elif [ "x$USE_UBUNTU" != "x" ]; then + docker build -t $IMAGE_NAME -f $IMAGE_PATH/Dockerfile.ubuntu $IMAGE_PATH else - docker build -t pokediamond:$ver $(git rev-parse --show-toplevel)/contrib/docker + docker build -t $IMAGE_NAME $IMAGE_PATH fi -docker run --network=none -it -v $(git rev-parse --show-toplevel):/app pokediamond:$ver + +# Start container and wine server +CONTAINER_NAME="$PROJECT_NAME-build" +docker run -d --name $CONTAINER_NAME --network=none -it --rm -v $PROJECT_PATH:/app $IMAGE_NAME + +# Build selected project, always exit successfully to ensure container stops +EXIT_CODE="0" +docker exec -i -t $CONTAINER_NAME make $@ || EXIT_CODE="$?" + +# Exit and remove the container +docker stop $CONTAINER_NAME + +exit $EXIT_CODE |