Skip to content

Commit

Permalink
actions: build action
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain Gadrat committed Sep 22, 2023
1 parent 446ae78 commit ec11dcf
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 6 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/compile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build

on:
push:
branches: [ "build-deps" ]
pull_request:
branches: [ "build-deps" ]
workflow_dispatch: {}

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: build-dep-cc65
run: deps/build-deps.d/00-cc65.sh
- name: build-dep-huffmunch
run: deps/build-deps.d/00-huffmunch.sh
- name: build-dep-python
run: FORCE_INSTALLS=1 deps/build-deps.d/00-python.sh
- name: build-dep-xa65
run: deps/build-deps.d/00-xa65.sh
- name: build-dep-gcc
run: FORCE_INSTALLS=1 CC65_PATH=$(pwd)/deps/cc65/bin deps/build-deps.d/01-gcc.sh
- name: build-stb
run: XA_BIN=$(pwd)/deps/xa65-stb/xa/xa CC_BIN=$(pwd)/deps/gcc-6502-bits/prefix/bin/6502-gcc HUFFMUNCH_BIN=$(pwd)/deps/huffmunch/huffmunch XA_LST=1 ./build.sh
- uses: actions/upload-artifact@v3
with:
name: build-log
if-no-files-found: ignore
path: |
build.log
build.log.err
- uses: actions/upload-artifact@v3
with:
name: roms
path: |
*.nes
/tmp/*.lst
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,25 @@ Build dependencies
- Actually a fork of it, with increased memory limits. You can find it [here](https://github.com/sgadrat/xa65-stb).
- 6502-gcc
- [Build it from](https://github.com/itszor/gcc-6502-bits)
- Huffmunch
- [Build it from](https://github.com/bbbradsmith/huffmunch)
- python >= 3.2
- pillow library for python

A script to get all dependencies built and setup is in `deps/`.

(You may still want to install python and pillow by yourself, the script will install it only it it has root privilege.)

```
$ deps/build-deps.sh
```

Building
--------

From the source repository run
If you built dependencies in `deps/`, from the source repository run
```
XA_BIN=/path/to/xa CC_BIN=/path/to/6502-gcc ./build.sh
$ XA_BIN=$(pwd)/deps/xa65-stb/xa/xa CC_BIN=$(pwd)/deps/gcc-6502-bits/prefix/bin/6502-gcc HUFFMUNCH_BIN=$(pwd)/deps/huffmunch/huffmunch ./build.sh
```

It will generate the game as `Super_Tilt_Bro_(E).nes`. If any problem occurs you may find clues in the `build.log` file.
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ log "==================="

tools/c_constants_files.py

for c_source in `find . -name '*.c'`; do
for c_source in `find game/ rainbow-boot/ -name '*.c'`; do
asm_source="`dirname "$c_source"`/`basename "$c_source" .c`.built.asm"

if [ -f "$asm_source" ]; then
Expand Down
19 changes: 19 additions & 0 deletions deps/build-deps.d/00-python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -x
set -e

out_dir=$(readlink -f "$(dirname "$0")/..")

if [ "$UID" -eq 0 -o ! -z "$FORCE_INSTALLS" ]; then
sudo apt install -y python3 python3-pip python-is-python3
pip3 install -U pip

if which pip > /dev/null 2>&1 ; then
pip_cmd=pip
else
pip_cmd=pip3
fi

$pip_cmd install --upgrade pillow
fi
12 changes: 9 additions & 3 deletions deps/build-deps.d/01-gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ set -e
out_dir=$(readlink -f "$(dirname "$0")/..")

install_gcc_build_dependencies() {
if [ "$UID" eq 0 ]; then
apt install -y flex build-essential gcc git libboost-dev libboost-regex-dev
local dependencies="flex build-essential gcc git libboost-dev libboost-regex-dev libgmp-dev libmpfr-dev libmpc-dev"

if [ "$UID" -eq 0 ]; then
apt install -y $dependencies
else
echo "Skipped GCC build dependency installation: no root privilege"
if [ -z "$FORCE_INSTALLS" ] ; then
echo "Skipped GCC build dependency installation: no root privilege"
else
sudo apt install -y $dependencies
fi
fi
}

Expand Down

0 comments on commit ec11dcf

Please sign in to comment.