building uxngba with docker
The uxngba project uses DevKitPro, which can be a pain to install on systems that aren't ArchLinux. Luckily, there is a Docker image for DevKitPro which can ease the process.
In a freshly cloned uxngba repo, add a Dockerfile
:
FROM devkitpro/devkitarm RUN apt-get update && apt install -y gcc binutils python3 RUN mkdir -p /usr/src/uxngba WORKDIR /usr/src/uxngba COPY . /usr/src/uxngba # if you want to play with heavier duty C code/libraries # in the uxngba source get this linker script: # https://github.com/AnthonyCalandra/gba-js/blob/master/gba_cart.ld # and uncomment the following line # COPY ./gba_cart.ld /opt/devkitpro/devkitARM/arm-none-eabi/lib/gba_cart.ld # we add a sleep command to keep the container running # so we can copy the GBA ROM CMD make clean; make ROM_SRC=./roms/${UXN_ROM}.rom && sleep 20
And this build.sh
script:
#!/bin/sh # so we can change ownership of the GBA ROM after copying it ogusr=$(whoami) # delete the volume to ensure our data copies cleanly docker volume rm uxngba # so we can enter our password now and not race against the clock # while the container is running; delete the ROM from last time sudo rm uxngba.gba docker build -t uxngba ./ docker run --rm -v uxngba:/usr/src/uxngba -e UXN_ROM=$1 --name uxngba uxngba & sleep 7; # here is where we actually move the GBA ROM from the container sudo su root -c "cp /var/lib/docker/volumes/uxngba/_data/build/uxngba.gba ./ ; chown ${ogusr}:${ogusr} uxngba.gba" # kill the container to clean up after ourselves docker kill uxngba
Then run like so:
$ ./build.sh ROMNAME
Where ROMNAME
is the name of the ROM you want to build inside of the roms/
directory, minus its .rom
extension. You will then have a uxngba.gba
file in the base directory of the repo that you can run in an emluator or load on a GBA flash cartridge!