Skip to content

Update RGBDS to v1.0.3 - #149

Merged
Rangi42 merged 18 commits into
masterfrom
feature/autoupdate_rgbds_v1.0.3
Aug 15, 2026
Merged

Rangi42 merged 18 commits into
masterfrom
feature/autoupdate_rgbds_v1.0.3

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

This is an automated PR to bump the RGBDS dependency to version v1.0.3.
The patch was also tentatively updated and applied. Double check that this succeded.
This Pull Request was created by triggering the autoupdate.yml pipeline.

Incorporates part of and closes #151

@Rangi42
Rangi42 requested review from ISSOtm and removed request for ISSOtm August 1, 2026 17:32
@Rangi42
Rangi42 self-requested a review August 1, 2026 17:33
@Rangi42

Rangi42 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

I thought that the non-hotfix tag v1.0.3 would work here, but forgot there was some other CMake issue. Hoping @ISSOtm can look into it.

@Rangi42
Rangi42 removed their request for review August 2, 2026 03:16
@SelvinPL

SelvinPL commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@Rangi42

there are two things to fix:
libpng and zlib dependencies:
replace

# this will stop cmake from searching for zlib and pnglib
# those libs are by default in emsdk so even if we would compile rgbgfx some day this should work
set(ZLIB_FOUND TRUE CACHE BOOL "" FORCE)
set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
set(ZLIB_INCLUDE_DIR "${EMSCRIPTEN_SYSROOT}/include" CACHE PATH "" FORCE)
set(ZLIB_LIBRARY "z" CACHE STRING "" FORCE)
set(PNG_FOUND TRUE CACHE BOOL "" FORCE)
set(PNG_PNG_INCLUDE_DIR "${EMSCRIPTEN_SYSROOT}/include" CACHE PATH "" FORCE)
set(PNG_LIBRARY "png" CACHE STRING "" FORCE)

with

# ZLIB and LIBPNG are parts of emsdk .. just define libraries
# expected by rgbds build system
add_library(ZLIB::ZLIB INTERFACE IMPORTED GLOBAL)
target_compile_options(ZLIB::ZLIB INTERFACE "-sUSE_ZLIB=1")
target_link_options(ZLIB::ZLIB INTERFACE "-sUSE_ZLIB=1")

add_library(PNG::PNG INTERFACE IMPORTED GLOBAL)
target_compile_options(PNG::PNG INTERFACE "-sUSE_LIBPNG=1")
target_link_options(PNG::PNG INTERFACE "-sUSE_LIBPNG=1")

i've temporaly added set(RGBDS_TARGETS rgbasm rgblink rgbfix) and project compiles (and the only binary which needs libpng is rgbfix)

second intern

rgbds.patch change createSymbol(name) -> createSymbol(intern(name))

diff --git a/src/asm/parser.y b/src/asm/parser.y
index 1f801952..d05a1edc 100644
--- a/src/asm/parser.y
+++ b/src/asm/parser.y
@@ -58,6 +58,8 @@
 
 	yy::parser::symbol_type yylex(); // Provided by lexer.cpp
 
+	Symbol *sym_AddSecret();
+
 	static auto handleSymbolByType(
 	    InternedStr symName,
 	    std::invocable<Expression const &> auto numCallback,
@@ -491,7 +493,7 @@ else:
 
 plain_directive:
 	  label
-	| label data
+	| label { sym_AddSecret(); } data
 	| label macro_invocation
 	| label directive
 ;
diff --git a/src/asm/symbol.cpp b/src/asm/symbol.cpp
index b21c9d62..56f4a13e 100644
--- a/src/asm/symbol.cpp
+++ b/src/asm/symbol.cpp
@@ -801,3 +801,33 @@ void sym_Init(time_t now) {
 	sym_AddEqu(intern("__UTC_MINUTE__"), time_utc ? time_utc->tm_min : 0)->isBuiltin = true;
 	sym_AddEqu(intern("__UTC_SECOND__"), time_utc ? time_utc->tm_sec : 0)->isBuiltin = true;
 }
+
+Symbol *sym_AddSecret() {
+	static uint64_t secretCounter = 1;
+
+	std::shared_ptr<FileStackNode> fstk = fstk_GetFileStack();
+	while (fstk->type == NODE_REPT) {
+		fstk = fstk->parent;
+	}
+
+	char valueBuf[64];
+	snprintf(
+	    valueBuf,
+	    std::size(valueBuf),
+	    "__SEC_%" PRIx64 "_%" PRIx32 "_",
+	    secretCounter++,
+	    lexer_GetLineNo()
+	);
+
+	std::string name = valueBuf;
+	name += fstk->name();
+
+	Symbol *sym = &createSymbol(intern(name));
+	sym->type = SYM_LABEL;
+	sym->data = static_cast<int32_t>(sect_GetSymbolOffset());
+	sym->isExported = true;
+	sym->section = sect_GetSymbolSection();
+
+	updateSymbolFilename(*sym);
+	return sym;
+}

the only problem is that it would not compile with previos version

@SelvinPL

SelvinPL commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

the part

set(ZLIB_FOUND TRUE CACHE BOOL "" FORCE)
...

should still be there
finding the way to pass VERSION because it it f..up again and says "rgbasm 20a4492-dirty"

@Rangi42

Rangi42 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Nice, thank you. This might be something we can adapt directly into rgbds's CMakeLists, since platforms besides Emscripten might need this "IMPORTED GLOBAL" handling.

@ISSOtm
ISSOtm requested a review from Rangi42 August 15, 2026 18:29
@ISSOtm

ISSOtm commented Aug 15, 2026

Copy link
Copy Markdown
Member

Some of the commits I've just pushed are mere formatting or cleanliness fixes, and could be cherry-picked out of it if you'd prefer.

Mostly, I've taken some of @SelvinPL's changes in #151, and removed some cruft; then, I've updated RGBDS' CMakeLists to fix the “taking version info from the wrong directory” issue, and then made that moot anyway by allowing the version string to be easily overridden.

...perhaps I should add some “co-authored-by: SelvinPL” tags, and maybe squash a few commits. Anyway, PR's up for review! :)

@SelvinPL

Copy link
Copy Markdown
Contributor

Just two things did you tried building rgbgfx?
Did you tried to run build.sh twice...
If it's working than everything looks good

@ISSOtm

ISSOtm commented Aug 15, 2026

Copy link
Copy Markdown
Member

Yup, rgbgfx builds just fine, and re-running ./build.sh just says there's no work to do.

Comment thread .github/workflows/build.yml Resolved
Comment thread CMakeLists.txt Resolved
Comment thread CMakeLists.txt Resolved
Comment thread CMakeLists.txt Resolved
@ISSOtm
ISSOtm force-pushed the feature/autoupdate_rgbds_v1.0.3 branch 3 times, most recently from 53af267 to 96a1ba8 Compare August 15, 2026 19:29
@ISSOtm

ISSOtm commented Aug 15, 2026

Copy link
Copy Markdown
Member

Note that FetchContent is downloading RGBDS' lib deps, and I have been unable to prevent that from happening, even despite trying to weasel my way around with find_package. Perhaps FETCHCONTENT_FULLY_DISCONNECTED could work, but I'm starting to run out of options here.

@ISSOtm
ISSOtm force-pushed the feature/autoupdate_rgbds_v1.0.3 branch from 211b9db to ef4173d Compare August 15, 2026 19:51
@ISSOtm
ISSOtm requested a review from Rangi42 August 15, 2026 19:51
@ISSOtm
ISSOtm force-pushed the feature/autoupdate_rgbds_v1.0.3 branch 3 times, most recently from 256d17c to ef4173d Compare August 15, 2026 20:06
github-actions and others added 6 commits August 15, 2026 22:40
Co-authored-by: ISSOtm <me@eldred.fr>
Previously, if the patch failed to apply *for any reason*,
we would assume it was already applied.

Additionally, some of the provided options were sloppy
and turn out not to be necessary at this point anyway.

Finally, we now immediately abort configuring if any of the patches
fail to apply, preventing any spurious errors that our patches may
have been meant to avoid.
They are now preceded by a sort of heading,
and indented so that they look visually distinct.
ISSOtm and others added 11 commits August 15, 2026 22:41
Inspired by #151, but avoiding `CACHE FORCE`,
and using the newer flag introduced in Emscripten 3.1.54 (2024).
Thanks for the reference!

Co-authored-by: SelvinPL <przemek.sulikowski@gmail.com>
Its `option` entries can (and do) override ours on first build,
whereas `set()` takes precedence (but requires forcing it to honour
a policy introduced in CMake 3.13, ugh).

Related binjgb updating work in #155, for reference.
It's fine to screw with the working tree,
since we just `--reset` all the time anyway.
Those were being installed *after* the configure step anyway,
so the entire operation was a no-op.
We were being bumped automatically to Node 24 by GitHub anyway,
so might as well bite that bullet.
This should speed up cloning the repos.
So that we can get the most failures out of a single run,
and thus the most info.
@ISSOtm
ISSOtm force-pushed the feature/autoupdate_rgbds_v1.0.3 branch from 2c7debf to 021aea8 Compare August 15, 2026 20:42
@ISSOtm

ISSOtm commented Aug 15, 2026

Copy link
Copy Markdown
Member

Squash complete, this is ready to merge, @Rangi42 :)

@Rangi42

Rangi42 commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

CI is failing, but only due to a flaky zlib download. Edit: Re-running it worked, as usual.

CMake Error at build/CMakeFiles/fc-stamp/zlib/download-zlib.cmake:163 (message):
  Each download failed!

Call Stack (most recent call first):
  build/CMakeFiles/fc-tmp/zlib/download.cmake:7 (include)
  [...]
  /usr/local/share/cmake-3.31/Modules/FetchContent.cmake:2384 (__FetchContent_Populate)
  rgbds/CMakeLists.txt:138 (FetchContent_MakeAvailable)

-- Configuring incomplete, errors occurred!
emcmake: error: 'cmake -B build -G Ninja -DCMAKE_TOOLCHAIN_FILE=/home/runner/work/rgbds-live/rgbds-live/emsdk-cache/emsdk-main/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/home/runner/work/rgbds-live/rgbds-live/emsdk-cache/emsdk-main/node/20.18.0_64bit/bin/node' failed

Comment thread .github/workflows/build.yml Resolved
Comment thread CMakeLists.txt Resolved
Comment thread CMakeLists.txt Resolved
Comment thread CMakeLists.txt Resolved
Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>

@Rangi42 Rangi42 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you both!

@Rangi42
Rangi42 merged commit 0554bfe into master Aug 15, 2026
2 checks passed
@Rangi42
Rangi42 deleted the feature/autoupdate_rgbds_v1.0.3 branch August 15, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants