From 1e92b5193108b665041d4ab8d30026b2851a1c87 Mon Sep 17 00:00:00 2001 From: Jamie Kerber Date: Sat, 7 Sep 2024 16:56:21 +0200 Subject: [PATCH] Fixed Docker builds --- .dockerignore | 18 +++++++++ Dockerfile | 22 +++++++---- README.md | 102 ++++++++++++++++++++++++++++++++++++++++++++------ packages.txt | 1 + 4 files changed, 124 insertions(+), 19 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..589cfcd0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +.dockerignore +.gitlab-ci.yml +Dockerfile +README.md +LICENSE + +asm/ +assets/ +include/ +ido/ +build/ +bin/ +src/ + +baserom* +*.z64 + +Makefile diff --git a/Dockerfile b/Dockerfile index 797a089c..469dc11f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,22 @@ -FROM ubuntu:20.04 as build - +FROM ubuntu:20.04 AS build ENV DEBIAN_FRONTEND=noninteractive -COPY packages.txt / -RUN apt-get update && apt-get install -y $(cat packages.txt) +# (for debug purposes) +RUN echo "System arch: $(uname -a)\nDPKG arch: $(dpkg --print-architecture)" -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +# Install package dependencies +COPY packages.txt ./ +RUN apt-get update && apt-get install -y $(cat packages.txt) && rm packages.txt -COPY requirements.txt / +# Install Rust/Cargo +# NOTE: We replace /proc/self/exe with /bin/sh in the script to avoid issues with Docker +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sed 's#/proc/self/exe#\/bin\/sh#g' | CARGO_HOME=/opt/cargo sh -s -- -y +ENV PATH=/opt/cargo/bin:$PATH + +# Install Python dependencies +COPY requirements.txt ./ +COPY tools/n64splat/requirements.txt ./tools/n64splat/requirements.txt RUN python3 -m pip install -r requirements.txt -RUN mkdir /banjo WORKDIR /banjo +ENTRYPOINT ["/bin/bash", "-c"] diff --git a/README.md b/README.md index 49bc063e..5a60c20f 100644 --- a/README.md +++ b/README.md @@ -2,23 +2,68 @@ +### Baserom checksums + +- `baserom.us.v10.z64`: `1fe1632098865f639e22c11b9a81ee8f29c75d7a` +- `baserom.us.v11.z64`: TODO +- `baserom.jp.z64`: TODO +- `baserom.pal.z64`: TODO + ## Building -Grab tools +The following instructions should work on the following platforms: +- Ubuntu 18.04 or higher (x86_64) +- Docker only + - Linux (x86_64, ARM) + - macOS (x86_64, ARM) + +### Local (Linux) + +Works with Ubuntu 18.04 or higher. + +#### 1. Install dependencies + +```sh +sudo apt-get update && sudo apt-get install -y $(cat packages.txt) +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +python3 -m pip install -r requirements.txt +``` + +#### 2. Grab tools ```sh git submodule update --init --recursive +cd tools/n64splat +python3 -m pip install -r requirements.txt ``` -Drop in `US v1.0` as `baserom.us.v10.z64` (sha1sum: `1fe1632098865f639e22c11b9a81ee8f29c75d7a`) +#### 3. Add baserom -To extract and build everything +Add the file for `US v1.0` as `baserom.us.v10.z64` in the project folder. + +(optional): Check the baserom checksum + +```sh +sha1sum baserom.us.v10.z64 +``` + +The output should match the checksum specified above. + +#### 4. Build + +To extract and build everything simply run: ```sh make ``` -where the following are supported values of `` +If you want to build a specific module, instead do: + +```sh +make +``` + +...where the following are supported values of `` - `core1` - `core2` - `MM` @@ -35,19 +80,52 @@ where the following are supported values of `` - `fight` - `cutscenes` -### Prerequisites +### Local (Docker - Linux/macOS) -Ubuntu 18.04 or higher. +#### 1. Get the Docker image + +(if available) you can pull it from GitLab (but you need to be logged in): ```sh -sudo apt-get update && sudo apt-get install -y $(cat packages.txt) - -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - -python3 -m pip install -r requirements.txt +docker login registry.gitlab.com +docker pull registry.gitlab.com/banjo.decomp/banjo-kazooie:latest ``` -### Other versions +(otherwise) you can build it yourself: + +```sh +docker build -t banjo-kazooie . +``` + +**NOTE for ARM users** (Windows ARM, Raspberry Pi and similar, or Apple Silicon): Use this command instead: + +```sh +docker build --platform linux/amd64 -t banjo-kazooie . +``` + +#### 2. Add baserom + +Follow the same instructions as Step 3 above in "Local (Linux)". + +#### 3. Run the Docker container + +```sh +docker run -it --rm -v $(pwd):/banjo banjo-kazooie +``` + +**NOTE for ARM users**: Use this command instead: + +```sh +docker run --platform linux/amd64 -it --rm -v $(pwd):/banjo banjo-kazooie +``` + +#### 4. Build + +Follow the same instructions as Step 4 above in "Local (Linux)". + +To exit Docker, simply type `exit`. + +## Other versions Drop in `us.v11`, `jp`, or `pal` as `baserom..z64` e.g. `baserom.us.v11.z64` diff --git a/packages.txt b/packages.txt index cd64f4fb..d96c3d07 100644 --- a/packages.txt +++ b/packages.txt @@ -10,3 +10,4 @@ python3 python3-pip unzip wget +openssl