aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-06-18 19:46:59 +0200
committerAstatin <[email protected]>2025-06-18 19:46:59 +0200
commita82b9ba9e92a188fd2bf2be85384414a4121d119 (patch)
treeff34c98f6d08014036c785eb54f8e0ee234033d7
parent27617209a324f03a11faecc74392b048f08b45ae (diff)
Add build script for building a self containing linux executable
-rw-r--r--.github/workflows/game.yml40
-rw-r--r--Makefile26
-rw-r--r--dialogues/text.gbasm1
-rw-r--r--scripts/makeself-start.sh2
-rw-r--r--text.gbasm1
5 files changed, 67 insertions, 3 deletions
diff --git a/.github/workflows/game.yml b/.github/workflows/game.yml
new file mode 100644
index 0000000..b0bc5df
--- /dev/null
+++ b/.github/workflows/game.yml
@@ -0,0 +1,40 @@
+name: Game
+
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Download makeself
+ run: wget https://github.com/megastep/makeself/releases/download/release-2.5.0/makeself-2.5.0.run
+ - name: Extract makeself
+ run: sh ./makeself-2.5.0.run
+
+ - name: Download assembler
+ run: wget https://github.com/AstatinChan/gameboy-asm/releases/download/latest/gbasm_linux-x86_64
+ - name: Make assembler executable
+ run: chmod +x gbasm_linux-x86_64
+
+ - name: Build ROM
+ run: make GBASM=./gbasm_linux-x86_64 build/main.rom && cp build/main.rom main.gb
+ - name: Build Linux Makeself Executable
+ run: make GBASM=./gbasm_linux-x86_64 MAKESELF=./makeself-2.5.0/makeself.sh build/game_linux_x86-64 && cp build/game_linux_x86-64 .
+
+ - uses: "marvinpinto/action-automatic-releases@latest"
+ with:
+ repo_token: "${{ secrets.GITHUB_TOKEN }}"
+ automatic_release_tag: "latest"
+ prerelease: true
+ title: "Development Build"
+ files: |
+ game_linux_x86-64
+ main.gb
diff --git a/Makefile b/Makefile
index 2c502c5..e4330c9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,6 @@
+GBASM=gbasm
+MAKESELF=makeself
+
all: run
.PHONY: clean sclean
@@ -24,11 +27,11 @@ build/main.rom: build/main.rom.unsigned
build/main.rom.unsigned: main.gbasm tileset.gbasm text.gbasm dialogues/text.gbasm map/maps.gbasm $(wildcard ./*.gbasm) $(wildcard ./**/*.gbasm) $(wildcard ./**/**/*.gbasm)
mkdir -p build
- gbasm $< $@ > build/main.sym
+ $(GBASM) $< $@ > build/main.sym
build/tileset-dump.rom: scripts/tileset-dump.gbasm
mkdir -p build
- gbasm $< $@ > /dev/null
+ $(GBASM) $< $@ > /dev/null
build/tileset-dump.rom.vram.dump: build/tileset-dump.rom
gb --skip-bootrom --stop-dump-state $<
@@ -36,6 +39,23 @@ build/tileset-dump.rom.vram.dump: build/tileset-dump.rom
build/tileset.png: build/tileset-dump.rom.vram.dump scripts/extract-vram-tileset.py
python scripts/extract-vram-tileset.py $< $@
+build/makeself/gb_linux-x86_64:
+ mkdir -p build/makeself
+ wget https://github.com/AstatinChan/gameboy-emulator/releases/download/latest/gb_linux-x86_64 -O $@
+ chmod +x $@
+
+build/makeself/main.rom: build/main.rom
+ mkdir -p build/makeself
+ cp $< $@
+
+build/makeself/start.sh: ./scripts/makeself-start.sh
+ mkdir -p build/makeself
+ cp $< $@
+ chmod +x $@
+
+build/game_linux_x86-64: build/makeself/start.sh build/makeself/main.rom build/makeself/gb_linux-x86_64
+ $(MAKESELF) ./build/makeself $@ "Astatin's Bunny Game" ./start.sh
+
run: build/main.rom
mkdir -p recordings
gb $< --record-input "./recordings/$(shell date -Iseconds).record"
@@ -51,5 +71,5 @@ clean:
sclean: clean
rm tileset.gbasm
- find . -name "*.gbtxt" | sed 's/\.gbtxt$/.gbasm/' | xargs rm
+ find . -name "*.gbtxt" | sed 's/\.gbtxt$$/.gbasm/' | xargs rm
rm map/maps/*.map.gbasm map/maps.gbasm
diff --git a/dialogues/text.gbasm b/dialogues/text.gbasm
index 4bb2b8e..c952b74 100644
--- a/dialogues/text.gbasm
+++ b/dialogues/text.gbasm
@@ -1,3 +1,4 @@
+; THIS FILE IS GENERATED AUTOMATICALLY, DO NOT CHANGE
Empty:
.DB , 0xff
Bunny_Header_Text:
diff --git a/scripts/makeself-start.sh b/scripts/makeself-start.sh
new file mode 100644
index 0000000..8388ad6
--- /dev/null
+++ b/scripts/makeself-start.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./gb_linux-x86_64 main.rom --title "Astatin's Bunny Game" $*
diff --git a/text.gbasm b/text.gbasm
index 358dbf9..f31d6a1 100644
--- a/text.gbasm
+++ b/text.gbasm
@@ -1,3 +1,4 @@
+; THIS FILE IS GENERATED AUTOMATICALLY, DO NOT CHANGE
Hop_Attack_Menu_Txt:
.DB 0x91, 0x98, 0x99, 0xff
Heal_Attack_Menu_Txt: