Add Dockerfile and make it buildable as-is

This commit is contained in:
Travis Burtrum 2021-08-27 20:12:35 -04:00
parent aa1af6a8cc
commit 86785bcd72
4 changed files with 130 additions and 52 deletions

View File

@ -19,8 +19,8 @@ OBJDIR = ./obj
BINDIR = ./bin BINDIR = ./bin
TOOLSDIR = ./tools TOOLSDIR = ./tools
LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64.ld LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64ld.x
PROG_NAME = OS64 PROG_NAME = OS64P
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I$(INCDIR) -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG) CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I$(INCDIR) -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG)
ASFLAGS = -mtune=vr4300 -march=vr4300 ASFLAGS = -mtune=vr4300 -march=vr4300
CC = $(GCCN64PREFIX)gcc CC = $(GCCN64PREFIX)gcc

View File

@ -2,76 +2,35 @@
Alternative Everdrive64 menu Alternative Everdrive64 menu
`Altra64` is an open source menu for [Everdrive64](http://krikzz.com/) and ed64+ and is based on a fork of alt64 which was
`Altra64` is an open source menu for [Everdrive64](http://krikzz.com/) and is based on a fork of alt64 which was
originally written by saturnu, and released on the originally written by saturnu, and released on the
[Everdrive64 forum](http://krikzz.com/forum/index.php?topic=816.0). [Everdrive64 forum](http://krikzz.com/forum/index.php?topic=816.0).
## Building ## Building
If you want to build the menu, you need an n64 toolchain. When using windows 10 or Ubuntu, installation is totally automated through a script. If you want to build the menu, you need an n64 toolchain. This is terrible to build, I ended up creating a Dockerfile in the docker folder, instructions included in it.
### Dependencies (installed automatically) Or if you trust me, you can use the one I built and pushed to docker hub, [moparisthebest/altra64-dev](https://hub.docker.com/r/moparisthebest/altra64-dev)
* Windows 10 (Aniversary Update or above) / Ubuntu 16.04 (or above)
* [libdragon](https://github.com/DragonMinded/libdragon)
* [libmikmod (with n64 driver)](https://github.com/networkfusion/libmikmod)
* [libmad-n64](https://github.com/networkfusion/libmad-n64)
* [libyaml](http://pyyaml.org/wiki/LibYAML)
### Build the Toolchain
*You may skip this step if it's already installed.*
Clone this `Altra64` repo to a directory of your choice.
On Windows 10:
* Ensure that ["Windows Subsystem For Linux (Ubuntu)"](https://msdn.microsoft.com/en-gb/commandline/wsl/install_guide) is installed.
* browse to the tools directory and double click on ```setup-wsfl.cmd```.
On Ubuntu, browse to the tools directory and run the command ```$ chmod +x ./setup-linux.sh;source ./setup-linux.sh```
### Build `Altra64` ### Build `Altra64`
To build the Rom To build the Rom
from the projects root directory, from the projects root directory, with docker installed
On Windows 10 run
``` ```
> build $ docker run --rm -v "$(pwd):/build" moparisthebest/altra64-dev make
``` ```
on linux If it all worked, you will find `OS64.v64` in the `bin` directory.
```
$ make
```
If it all worked, you will find `OS64.v64` in the `Altra64` bin directory.
### Debug Build `Altra64`
To build the debug version of the Rom
from the projects root directory,
On Windows 10 run
```
> build debug
```
on linux
```
$ make debug
```
If it all worked, you will find `OS64.v64` in the `Altra64` bin directory.
### Clean `Altra64` ### Clean `Altra64`
Finally, we can clean the build objects from the project Finally, we can clean the build objects from the project
from the projects root directory, from the projects root directory
On Windows 10 run
``` ```
> build clean $ docker run --rm -v "$(pwd):/build" moparisthebest/altra64-dev make clean
```
on linux
```
$ make clean
``` ```
Enjoy! Enjoy!

25
docker/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
# to build and test:
# docker build -t altra64-dev . && docker run --rm -v "$(pwd):/build" -it altra64-dev
# to use to compile altra64 (or other n64 stuff I guess)
# docker run --rm -v "$(pwd):/build" altra64-dev make
#FROM ubuntu:18.04
FROM ubuntu:16.04
RUN mkdir /build
COPY setup-linux.sh /usr/bin/setup-linux.sh
# run it then delete all build artifacts
RUN /usr/bin/setup-linux.sh && rm -rf /root/*
ENV N64_INST=/usr/local/libdragon
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/libdragon/bin
VOLUME [ "/build" ]
WORKDIR /build
CMD ["bash"]

94
docker/setup-linux.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
#
# Copyright (c) 2017 The Altra64 project contributors
# See LICENSE file in the project root for full license information.
#
set -euxo pipefail
# Download and install latest updates for the system [sudo req.]
apt-get update
apt-get -y upgrade
# Install essential packages [sudo req.]
apt-get -y install wget build-essential git texinfo libc6 libgmp-dev libmpfr-dev libmpc-dev libpng-dev zlib1g-dev libtool autoconf
# change to the users root directory
cd ~/
# add a system variable and make it perminent
# echo 'N64_INST=/usr/local/libdragon' >> /etc/environment
# echo 'export N64_INST=/usr/local/libdragon' >> ~/.bashrc
export N64_INST=/usr/local/libdragon
# source ~/.bashrc
# Pull the latest libdragon source code and make a build directory
git clone https://github.com/dragonminded/libdragon.git
# set to correct commit
cd libdragon && git checkout b26fce6 && cd ..
# fix issues with the build scripts
sed -i -- 's|${N64_INST:-/usr/local}|/usr/local/libdragon|g' libdragon/tools/build
sed -i -- 's|--with-newlib|--with-newlib --with-system-zlib|g' libdragon/tools/build
sed -i -- 's| -lpng|\nLDLIBS = -lpng|g' libdragon/tools/mksprite/Makefile
sed -i -- 's| -Werror| -w|g' libdragon/tools/mksprite/Makefile
# make a build folder for libdragon
mkdir libdragon/build_gcc
cp libdragon/tools/build libdragon/build_gcc
# run the build script (this will take a while! and if not sudo, will ask for password mid flow!)
cd libdragon/build_gcc
./build
cd ..
# run the install script [sudo req]
make
make install
make tools
make tools-install
cd ..
# install libmikmod (custom version)
git clone https://github.com/n64-tools/libmikmod
cd libmikmod/n64
make
make install
cd .. # we have are in a subfolder, this is not a duplicate...
cd ..
# install libyaml
git clone https://github.com/yaml/libyaml
cd libyaml
./bootstrap
#$(N64_INST) converterd to $N64_INST below otherwise it will not run on WSFL
export PATH=$PATH:$N64_INST/bin
CFLAGS="-std=gnu99 -march=vr4300 -mtune=vr4300" \
LDFLAGS="-L$N64_INST/lib -Tn64ld.x" \
LIBS="-ldragon -lc -ldragonsys -lnosys" \
./configure --host=mips64-elf --prefix=$N64_INST
make
make install
cd ..
# install libmad (custom version)
git clone https://github.com/n64-tools/libmad
cd libmad
export PATH=$PATH:$N64_INST/bin
CFLAGS="-std=gnu99 -march=vr4300 -mtune=vr4300" \
LDFLAGS="-L$N64_INST/lib -Tn64ld.x" \
LIBS="-ldragon -lc -ldragonsys -lnosys" \
./configure --host=mips64-elf --prefix=$N64_INST
make
make install
cd ..
# Perform cleanup
apt-get -y autoremove
apt-get autoclean
echo 'export N64_INST=/usr/local/libdragon' >> ~/.bashrc
echo 'export PATH="$PATH:$N64_INST/bin"' >> ~/.bashrc