Fix some unusual build conditions, and require RGBDS 0.5.1

- RGBASM version being mid-development or undefined:
  Use the `__RGBDS_MAJOR/MINOR/PATCH__` constants to get
  the version instead of the `--version` flag

- Bash not being `/bin/bash`: Use `/usr/bin/env bash`
  (and `set` for the flags to pass to Bash)

- RGBDS 0.5.1 is requred, not 0.5.0, for `CHARLEN` and
  `CHARSUB` support
This commit is contained in:
Rangi42 2023-12-07 14:36:11 -05:00
parent af8bb4139b
commit 2e28141a5b
6 changed files with 39 additions and 10 deletions

View File

@ -8,7 +8,7 @@ RUN apt-get install -y git curl ssh tar gzip ca-certificates
RUN apt-get install -y build-essential bison pkg-config libpng-dev
# Retrieve rgbds
RUN git clone https://github.com/rednex/rgbds.git && \
RUN git clone https://github.com/gbdev/rgbds.git && \
cd rgbds && \
git fetch --tags && git checkout v0.6.0

View File

@ -18,17 +18,24 @@ ASFLAGS := \
--preserve-ld
# Get assembler version
ASMVER := $(shell $(ASM) --version | cut -f2 -dv)
ASMVERMAJ := $(shell echo $(ASMVER) | cut -f1 -d.)
ASMVERMIN := $(shell echo $(ASMVER) | cut -f2 -d.)
ASMVERMAJ := $(shell $(ASM) tools/rgbasm_version.asm -DMAJOR)
ASMVERMIN := $(shell $(ASM) tools/rgbasm_version.asm -DMINOR)
ASMVERPAT := $(shell $(ASM) tools/rgbasm_version.asm -DPATCH)
# Abort if RGBDS version is too low and 'clean' is not the only target
ifneq ($(MAKECMDGOALS), "clean")
ifeq ($(shell expr \
\( $(ASMVERMAJ) = 0 \) \&\
\( $(ASMVERMIN) \< 5 \)\
\(\
\( $(ASMVERMAJ) = 0 \) \&\
\( $(ASMVERMIN) \< 5 \)\
\) \|\
\(\
\( $(ASMVERMAJ) = 0 \) \&\
\( $(ASMVERMIN) = 5 \) \&\
\( $(ASMVERPAT) \< 1 \)\
\)\
), 1)
$(error Requires RGBDS version >= 0.5.0)
$(error Requires RGBDS version >= 0.5.1)
endif
endif

View File

@ -29,7 +29,7 @@ Additionally, a wiki includes a [high-level overview of the game engine](https:/
## Usage
1. Install Python 3 and [rgbds](https://github.com/rednex/rgbds#1-installing-rgbds) (version >= 0.5.0 required);
1. Install Python 3 and [rgbds](https://github.com/gbdev/rgbds#1-installing-rgbds) (version >= 0.5.1 required);
2. `make all`.
This will build both the games and their debug symbols. Once built, use [BGB](https://github.com/zladx/LADX-Disassembly/wiki/Tooling-for-reverse-engineering#bgb) to load the debug symbols into the debugger.

View File

@ -1,4 +1,4 @@
#!/bin/bash -eu
#!/usr/bin/env bash
#
# Compare the given files to their reference md5 checksum.
# The SUMFILE is expected to be in the `checksum` format.
@ -6,6 +6,8 @@
# Usage:
# md5sum.sh SUMFILE FILE [, FILE…]
set -eu
# Parse arguments
if [[ "$#" -lt 2 ]]; then
echo "Invalid number of arguments."

18
tools/rgbasm_version.asm Normal file
View File

@ -0,0 +1,18 @@
IF (DEF(__RGBDS_MAJOR__) && DEF(__RGBDS_MINOR__) && DEF(__RGBDS_PATCH__))
IF (__RGBDS_MAJOR__ > 0 || __RGBDS_MINOR__ >= 5)
; Distinguish RGBDS >= 0.5.0
IF (DEF(MAJOR))
PRINT "{d:__RGBDS_MAJOR__}"
ELIF (DEF(MINOR))
PRINT "{d:__RGBDS_MINOR__}"
ELIF (DEF(PATCH))
PRINT "{d:__RGBDS_PATCH__}"
ENDC
ELSE
; RGBDS < 0.5.0 did not support all of 'PRINT', 'd:', and 'ELIF'
PRINTT "0"
ENDC
ELSE
; RGBDS < 0.3.3 had no defined version
PRINTT "0"
ENDC

View File

@ -1,9 +1,11 @@
#!/bin/bash -e
#!/usr/bin/env bash
#
# Output statistics about the project progression.
# Usage:
# tools/stats [--verbose]
set -e
VERBOSE=${1:-"disabled"}
SOURCE_DIR="src/code"
SYM_FILE="azle.sym"