diff --git a/Dockerfile b/Dockerfile index f36f10e3..d91320b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,9 @@ -FROM ubuntu:18.04 as build - -RUN apt-get update && \ - apt-get install -y \ - binutils-mips-linux-gnu \ - bsdmainutils \ - build-essential \ - libcapstone-dev \ - pkgconf \ - python3 +FROM devkitpro/devkitarm:latest as build +RUN apt update +RUN apt -y install build-essential bsdmainutils RUN mkdir /sm64 WORKDIR /sm64 -ENV PATH="/sm64/tools:${PATH}" -CMD echo 'usage: docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64 make VERSION=us -j4\n' \ - 'see https://github.com/n64decomp/sm64/blob/master/README.md for advanced usage' +CMD echo 'usage: docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64dsi make VERSION=us COMPILER=gcc -j4\n' \ + 'see https://github.com/Hydr8gon/sm64/blob/nds/README.md for advanced usage' diff --git a/Makefile b/Makefile index 2e676e20..3b49224a 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,9 @@ endif ifeq ($(TARGET_NDS),1) OPT_FLAGS := -O2 GRUCODE := f3dex2 + COMPILER := gcc + DEVKITPRO ?= /opt/devkitpro + DEVKITARM ?= $(DEVKITPRO)/devkitARM endif TARGET := sm64.$(VERSION) diff --git a/README.md b/README.md index 2e37b45c..c94fb712 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,19 @@ This repo does not include all assets necessary for compiling the ROMs. A prior copy of the game is required to extract the assets. -## Installation +## Windows installation + * Download the latest source from [here](https://github.com/Hydr8gon/sm64/archive/nds.zip), extract it somewhere + * Install Docker Desktop from [the Docker website](https://www.docker.com/get-started), and reboot when the installer prompts you + * Place a Super Mario 64 ROM as baserom.us.z64 in the directory you extracted the zip to + * Run `build_docker.bat` + * Once the build is complete, the game will be in `build/us_nds/`. + +## Linux installation * First follow [the guide for installing devkitPro packages](https://devkitpro.org/wiki/Getting_Started), also installing the `nds-dev` group as mentioned * Install the needed tools * Debian/Ubuntu: `sudo apt install -y build-essential git python` - * Fedora: `sudo dnf install make git python` + * Fedora: `sudo dnf install gcc make git python` * Arch/derivatives like Manjaro: `sudo pacman -S base-devel git python` - * Windows with MSYS2: `pacman -S make git python` * Clone this repository and change to its directory ``` git clone https://github.com/Hydr8gon/sm64.git @@ -22,6 +28,32 @@ A prior copy of the game is required to extract the assets. * Run `make -j$(nproc)` to build the game * If the build succeeded, the game will be in `build/us_nds`, named `sm64.us.nds` +## Docker Installation + +### Create Docker image + +After installing and starting Docker, create the docker image. This only needs to be done once. +``` +docker build -t sm64dsi . +``` + +#### Build + +To build, mount the local filesystem into the Docker container and build the ROM with `docker run sm64 make`. + +##### macOS example for (U): +``` +docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 sm64dsi make VERSION=us -j4 +``` + +##### Linux example for (U): +For a Linux host, Docker needs to be instructed which user should own the output files: +``` +docker run --rm --mount type=bind,source="$(pwd)",destination=/sm64 --user $UID:$GID sm64dsi make VERSION=us -j4 +``` + +Resulting artifacts can be found in the `build` directory. + ## Project Structure sm64 diff --git a/build_docker.bat b/build_docker.bat new file mode 100755 index 00000000..1f1e2c87 --- /dev/null +++ b/build_docker.bat @@ -0,0 +1,22 @@ +@echo off +where docker 1>nul 2>nul || ( + echo Docker is not installed. + echo Please go to https://www.docker.com/get-started and install it first. + pause + exit +) + +if not exist baserom.??.z64 ( + echo A Super Mario 64 ROM is required to extract the assets and build the game. + echo Please place one in the same directory as this script, it should be named: + echo - baserom.us.z64 for the USA version - recommended + echo - baserom.eu.z64 for the European version + echo - baserom.jp.z64 for the Japanese version + echo - baserom.sh.z64 for the Japanese rumble pak edition + pause + exit +) + +docker build -t sm64dsi . +docker run --rm --mount type=bind,source="%cd%",destination=/sm64 sm64dsi make VERSION=us COMPILER=gcc -j4 +pause \ No newline at end of file