Merge pull request #318 from dsastr/docker-support

Add support for building with Docker
This commit is contained in:
red031000
2021-02-20 16:20:30 +00:00
committed by GitHub
3 changed files with 49 additions and 6 deletions
+12
View File
@@ -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.
+13
View File
@@ -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
+24 -6
View File
@@ -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