Skip to content

daspkg: ship native shared deps via release_include_dll#2590

Merged
borisbat merged 1 commit intomasterfrom
daspkg-native-deps
May 6, 2026
Merged

daspkg: ship native shared deps via release_include_dll#2590
borisbat merged 1 commit intomasterfrom
daspkg-native-deps

Conversation

@borisbat
Copy link
Copy Markdown
Collaborator

@borisbat borisbat commented May 6, 2026

Summary

  • New manifest API release_include_dll(name) in daslib/daspkg.das — a module's .das_package declares its native shared library deps. daspkg searches <das_root>/{bin,lib}/ and ships them colocated with their owning .shared_module under <bundle>/modules/<X>/.
  • Loader fixes so colocated deps are actually found at runtime — Windows LoadLibraryEx flags + Linux/macOS $ORIGIN / @loader_path rpath append in ADD_DAS_SHARED_MODULE_LIB.
  • dasGlfw/.das_package declares glfw3.dll / libglfw.so.3.4 / libglfw.3.4.dylib per platform.
  • Bonus diagnostics fix in daspkg's run_cmd: Windows _popen quote-stripping was destroying redirect targets, leaving silent (rc=1): errors with no output. Wrap in outer quotes on Windows + capture popen pipe as fallback + synthesize <no output captured> block when both channels are empty.
  • New CI smoke test: examples/games/sequence/ci_smoke_test.{ps1,sh} runs the full daspkg installrelease → launch cycle on the in-tree sequence game (uses GLFW + has a daspkg dep on das-cards). Wired into build.yml on every Release matrix entry except 32-bit Windows / ARM Linux / sanitizer entries. Bundled exe launches with --max-frames 60 under a 60s outer timeout.

What's bundled along

  • .gitattributes: *.sh text eol=lf so the shell script keeps LF on POSIX checkouts under core.autocrlf=true.
  • skills/sql.md, CLAUDE.md, .gitignore: small unrelated additions.

Test plan

  • Verified end-to-end on Windows: rebuilt libDaScriptDyn_runtime.dll with the LoadLibraryEx fix, dropped into bundle, sequence.exe --max-frames 60 runs init + shutdown, exits 0.
  • Smoke test script (pwsh ci_smoke_test.ps1 D:\daslang) reports smoke: PASS (rc=0).
  • Linux / macOS rpath wiring verified by CI (untestable locally).
  • CI sequence smoke test green on linux / darwin15 / darwin26 / windows.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 6, 2026 07:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends daspkg release bundling to ship a package’s declared native shared-library dependencies alongside its .shared_module, and adjusts runtime loader behavior (Windows + POSIX) so those colocated dependencies resolve correctly when launching from a bundle.

Changes:

  • Add manifest API release_include_dll(name) (stored as native_dlls) and propagate it through release metadata collection and bundle shipping.
  • Update loader resolution: Windows uses LoadLibraryEx search flags; Linux/macOS rely on $ORIGIN / @loader_path rpath appended by ADD_DAS_SHARED_MODULE_LIB.
  • Add CI end-to-end “sequence” smoke test scripts (PS1 + SH) and wire them into the Release workflow matrix.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
utils/daspkg/utils.das Improves run_cmd diagnostics/output capture (notably Windows quoting + fallback pipe capture).
utils/daspkg/package_runner.das Plumbs native_dlls from ReleaseSpec into PackageReleaseInfo.
utils/daspkg/commands.das Ships declared native deps into bundles (ship_native_dlls) and includes them for deps + project releases.
daslib/daspkg.das Introduces ReleaseSpec.native_dlls and release_include_dll(...) manifest API.
src/misc/sysos.cpp Windows loader updated to LoadLibraryExA with search flags and absolute-path resolution.
CMakeLists.txt Appends $ORIGIN / @loader_path rpaths to shared modules for colocated dep resolution.
modules/dasGlfw/CMakeLists.txt Switches to APPEND rpath properties to avoid clobbering macro-added origin/loader_path.
modules/dasGlfw/.das_package Declares GLFW native dep filename per-platform via release_include_dll.
examples/games/sequence/ci_smoke_test.sh POSIX smoke test for install → release → run (validates bundled native deps).
examples/games/sequence/ci_smoke_test.ps1 Windows smoke test for install → release → run.
.github/workflows/build.yml Adds Release-matrix smoke test execution (with skips for unsupported runners).
.gitattributes Forces LF for *.sh to avoid CRLF issues on POSIX.
CLAUDE.md Documents the new skills/sql.md skill entry.
skills/sql.md Adds a comprehensive dasSQLITE skill guide (docs-only).
.gitignore Adds ignores for opencode-related config files.
Comments suppressed due to low confidence (1)

utils/daspkg/commands.das:1446

  • When include_globs is empty (but native_dlls is not), glob_filtered still performs a full dir_rec walk of the dependency directory even though it can never include anything. Consider guarding this call with if (!empty(dep_spec.include_globs)) to avoid unnecessary filesystem traversal during release bundling.
    var dep_files : array<string>
    glob_filtered(pkg_dir, dep_spec.include_globs, dep_spec.exclude_globs) $(rel_path, is_dir) {
        if (!is_dir) {
            dep_files |> push_clone(rel_path)
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/games/sequence/ci_smoke_test.sh Outdated
Comment thread utils/daspkg/commands.das
Comment thread utils/daspkg/commands.das
Comment thread utils/daspkg/commands.das
@borisbat borisbat force-pushed the daspkg-native-deps branch 2 times, most recently from cd1ce4e to 462c318 Compare May 6, 2026 07:53
@borisbat borisbat requested a review from Copilot May 6, 2026 07:57
@borisbat borisbat force-pushed the daspkg-native-deps branch from 462c318 to 9b1c612 Compare May 6, 2026 08:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.

Comment thread utils/daspkg/utils.das
Comment thread CMakeLists.txt Outdated
Comment thread modules/dasGlfw/CMakeLists.txt
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 16 changed files in this pull request and generated no new comments.

@borisbat borisbat force-pushed the daspkg-native-deps branch from 0b4c013 to 1b83755 Compare May 6, 2026 09:13
New manifest API: a module's .das_package can declare its native shared
library deps (e.g. dasGlfw -> glfw3.dll / libglfw.so.3.4 /
libglfw.3.4.dylib). Daspkg searches <das_root>/{bin,lib}/ and ships them
colocated with their owning .shared_module under <bundle>/modules/<X>/.

Loader fixes so colocated deps are actually found at runtime:
  - Windows: LoadLibraryEx(LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR |
    LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)
    in src/misc/sysos.cpp. Backwards compatible (deps next to .exe still
    resolve), adds the loaded DLL's own dir to the search.
  - Linux/macOS: ADD_DAS_SHARED_MODULE_LIB appends \$ORIGIN /
    @loader_path to BUILD_RPATH + INSTALL_RPATH for every dynamic module.
  - dasGlfw CMakeLists.txt: switched its existing rpath setters to
    set_property APPEND so the macro's default isn't clobbered.

dasGlfw declares glfw3.dll / libglfw.* via the new .das_package.

CI smoke test: examples/games/sequence/ci_smoke_test.{ps1,sh} runs the
full daspkg install -> release -> launch cycle on the in-tree sequence
game (uses GLFW + has a daspkg dep on das-cards). Wired into build.yml
as a new step on every Release matrix entry (skips 32-bit Windows + ARM
Linux + sanitizer matrix). The bundled exe is launched with
--max-frames 60 under a 60s outer timeout.

Diagnostics fix in daspkg's run_cmd (utils/daspkg/utils.das): on
Windows, popen invokes cmd.exe /c <cmd> without outer quoting, and
cmd's quote-stripping rule (cmd /?, "old behavior") strips the first
AND last quote when the line has 2+ quotes plus a special char like
'>'. That destroyed the redirect target. Wrap in outer quotes on
Windows. Also capture popen pipe output as fallback and synthesize
"<no output captured>" diagnostic block when both channels are empty
- previous failure mode was "(rc=1):" with a blank line.

Other:
  - .gitattributes: *.sh text eol=lf so shell scripts keep LF on
    POSIX checkouts under autocrlf=true.
  - skills/sql.md: new SQL skill doc (Boris's local addition).
  - CLAUDE.md / .gitignore: small unrelated tweaks (Boris's local).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@borisbat borisbat force-pushed the daspkg-native-deps branch from 1b83755 to 684031b Compare May 6, 2026 09:36
@borisbat borisbat merged commit b885c1b into master May 6, 2026
31 checks passed
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.

2 participants