From eb68ecbc58e616cd9c1fecd543e5358ff7e0bb9a Mon Sep 17 00:00:00 2001 From: mracsys Date: Sun, 10 Nov 2024 15:27:40 -0500 Subject: [PATCH] support apple silicon macs --- ASM/Dockerfile | 44 +++++++++++++++++++++++++++++++++++++++--- ASM/docker-compose.yml | 3 +++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/ASM/Dockerfile b/ASM/Dockerfile index bec957af6..c06904278 100644 --- a/ASM/Dockerfile +++ b/ASM/Dockerfile @@ -6,8 +6,9 @@ ARG USER_GID=$USER_UID # Create the user RUN groupadd --gid $USER_GID $USERNAME \ - && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash +# Install build tools RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes curl gnupg ca-certificates \ && curl https://practicerom.com/public/packages/debian/pgp.pub | apt-key add - \ @@ -15,12 +16,48 @@ RUN apt-get update \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \ build-essential \ - n64-ultra \ nodejs \ npm \ git \ - cmake + cmake \ + gdb-multiarch +# Install toolchain. Compile from source if not on Intel/AMD. +RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes n64-ultra; \ + else \ + DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --assume-yes \ + wget \ + tar \ + make \ + diffutils \ + texinfo \ + gcc \ + g++ \ + lua5.3 \ + libjansson4 \ + libusb-1.0-0 \ + libgmp10 \ + liblua5.3-dev \ + libjansson-dev \ + libusb-1.0-0-dev \ + libgmp-dev \ + libmpfr-dev \ + zlib1g-dev; \ + fi +RUN if [ "$(dpkg --print-architecture)" != "amd64" ]; then \ + mkdir -p build \ + && cd build \ + && git clone --recursive https://github.com/glankk/n64.git \ + && cd n64 \ + && ./configure --enable-vc --prefix=/opt/n64 \ + && make install-toolchain \ + && make && make install \ + && make install-sys \ + && echo 'export PATH="/opt/n64/bin:$PATH"' >> /etc/profile; \ + fi + +# Build armips WORKDIR /build RUN git clone --recursive https://github.com/Kingcom/armips.git WORKDIR /build/armips @@ -31,4 +68,5 @@ RUN cmake -DCMAKE_BUILD_TYPE=Release .. \ && mv ./armips /usr/local/bin/ \ && chmod a+rx /usr/local/bin/armips +# Run as non-root user USER $USERNAME diff --git a/ASM/docker-compose.yml b/ASM/docker-compose.yml index 33c14079e..68b05759a 100644 --- a/ASM/docker-compose.yml +++ b/ASM/docker-compose.yml @@ -16,6 +16,9 @@ services: - ../Output:/app/OoT-Randomizer/Output:consistent - ../data/generated:/app/OoT-Randomizer/data/generated:consistent - ../Logs:/app/OoT-Randomizer/Logs:consistent + network_mode: host + extra_hosts: + - host.docker.internal:host-gateway # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. cap_add: