Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
Switch to libdragon toolchain generation. (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
networkfusion authored Jan 13, 2023
1 parent c4a85bd commit 22b7aad
Show file tree
Hide file tree
Showing 12 changed files with 402 additions and 1,009 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (c) NetworkFusion 2023
# See LICENSE file in the project root for full license information.

name: Build Docker Container

env:
GCR_FILE: Dockerfile

on:
push:
branches:
- master
paths:
- '**Dockerfile'

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.CONTAINER_BUILD_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v3
with:
file: ${{ env.GCR_FILE }}
push: true # Will only build if this is not here
tags: |
# ${{ env.GCR_IMAGE }}:${{ env.GCR_VERSION }}
${{ env.GCR_IMAGE }}:latest
365 changes: 262 additions & 103 deletions .github/workflows/build-toolchain.yml

Large diffs are not rendered by default.

57 changes: 6 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,54 +1,9 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
# Generated debug files
*.zip
*.bin
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
*.tar.*
*.deb
*.rpm

.vs/
67 changes: 67 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# syntax=docker/dockerfile:1
# V0 - Use this comment to force a re-build without changing the contents

# Stage 1 - Build the toolchain
FROM debian:stable-slim AS toolchain-builder
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# Install required dependencies
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils \
&& apt-get install -y \
curl \
bzip2 \
make \
file \
libmpfr-dev \
libmpc-dev \
zlib1g-dev \
texinfo \
git \
gcc \
g++

ARG N64_INST=/n64_toolchain
ENV N64_INST=${N64_INST}

# Build
ADD https://raw.githubusercontent.com/DragonMinded/libdragon/trunk/tools/build-toolchain.sh /tmp/tools/build-toolchain.sh
WORKDIR /tmp/tools
RUN chmod 755 "./build-toolchain.sh" && ./build-toolchain.sh

# Remove locale strings which are not so important in our use case
RUN rm -rf ${N64_INST}/share/locale/*

# Stage 2 - Prepare minimal image
FROM debian:stable-slim
# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Setup paths for the libgragon toolchain
ARG N64_INST=/n64_toolchain
ENV N64_INST=${N64_INST}
ENV PATH="${N64_INST}/bin:$PATH"

# Install dependencies for building libdragon tools and ROMS (using makefiles and CMake)
# and (commented out) ability to use it as a vs-code devcontainer.
RUN apt-get update && \
apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 &&\
apt-get install -yq \
gcc \
g++ \
make \
libpng-dev \
git \
curl \
cmake \
ninja-build

COPY --from=toolchain-builder ${N64_INST} ${N64_INST}

# Clean up downloaded files
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog
18 changes: 18 additions & 0 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Installing packages

## Operating System


### Debian
Download and install the debian (.deb) package:
`$ sudo dpkg -i <packagename>.deb`

### RPM
Download and install the RPM (.rpm) package.
`rpm -i <packagename>.rpm`

### Windows
Download the .zip file and extract it.
Move the folder.
Add the file path to an environment variable
Enjoy!
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
NOTE: This repo will be updated or deprecated in the near future as the libDragon toolchain now supports the ability to do the same thing using:
```
sudo apt-get install -y mingw-w64
cd ./tools/
sudo N64_INST=/usr/local/n64/ HOST=x86_64-w64-mingw32 ./build-toolchain.sh
```
**NOTE:** This repo uses the [official libDragon](dragonminded/libdragon) toolchain build script to generate its artifacts. However, it may also include features or abilities that have not yet been added.

# Windows mips64-gcc-toolchain for the N64
# mips64-gcc-toolchain for the N64

This repo automatically generates the MIPS64 GCC toolchain to allow cross compilation for the N64.
The binaries can be downloaded and used as part of other build scripts/components which saves time (at least 30 minutes) when setting up a developer environment in order to build N64 libraries such as libdragon in a `Windows` environment.

[![Azure Pipeline CI](https://dev.azure.com/n64-tools/N64-Tools/_apis/build/status/N64-tools.mips64-gcc-toolchain)](https://dev.azure.com/n64-tools/N64-Tools/_build/latest?definitionId=1)
The binaries can be downloaded (from releases) and used as part of other build scripts/components which saves time (at least 30 minutes) when setting up a developer environment in order to build N64 libraries such as libdragon in a `Windows` environment (without using docker).

[![Github Action CI](https://github.com/n64-tools/mips64-gcc-toolchain/actions/workflows/build-toolchain.yml/badge.svg)](https://github.com/n64-tools/mips64-gcc-toolchain/actions/workflows/build-toolchain.yml)

Architecture | Download Links
--- | ---
Windows x64 | [Latest](https://github.com/n64-tools/mips64-gcc-toolchain/releases/latest/download/gcc-toolchain-mips64-win64.zip)
Windows i386 | none currently available!
Windows x86_x64 | [Latest](https://github.com/n64-tools/mips64-gcc-toolchain/releases/latest/download/gcc-toolchain-mips64-win64.zip)
Debian | [Latest](https://github.com/n64-tools/mips64-gcc-toolchain/releases/latest/download/gcc-toolchain-mips64-linux64.deb)
Redhat | [Latest](https://github.com/n64-tools/mips64-gcc-toolchain/releases/latest/download/gcc-toolchain-mips64-linux64.rpm)
92 changes: 0 additions & 92 deletions azure-pipelines.yml

This file was deleted.

39 changes: 0 additions & 39 deletions build.sh

This file was deleted.

Loading

0 comments on commit 22b7aad

Please sign in to comment.