feat(bundle): a native library's licence ships with it - each linked package's native/LICENSE* beside the .exe, in Contents/Resources on macOS

Checked on both machines with a bundled Jolt probe: the licence and the library in place, the app
signed (Mac) and the probe's ball landing at the same height on both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-27 14:43:16 +03:00
parent 0e3cef813f
commit 1fc01df39c
2 changed files with 26 additions and 0 deletions

View file

@ -283,10 +283,29 @@ function bundle_natives_mac(contents: pointer, exe: pointer) -> bool {
err(`ludic bundle: could not place {g_built_natives[i]}\n`)
return false
}
bundle_native_notices(g_built_natives[i], `{contents}/Resources`)
}
return true
}
# a path with every backslash made a slash (a Windows path from the compiler)
function fwd_path(p: pointer) -> pointer {
var out = ""
var i = 0
while p[i] != 0 {
if p[i] == 92 { out = out + "/" } else { out = out + p[i..i + 1] }
i += 1
}
return out
}
# a native library's licence goes with every copy of it: the package's native/LICENSE* files,
# found from the library's own path (<package>/lib/<target>/<file>)
function bundle_native_notices(lib: pointer, dest: pointer) -> void {
let pkg = dir_of_path(dir_of_path(dir_of_path(fwd_path(lib))))
shell(`cp "{pkg}"/native/LICENSE* "{dest}/" 2>/dev/null`)
}
# copy the .dll files ludicc wrote into <exe>.natives beside the executable
function bundle_natives_win(list: pointer, root: pointer) -> bool {
let txt = read_file(list)
@ -297,6 +316,7 @@ function bundle_natives_win(list: pointer, root: pointer) -> bool {
err(`ludic bundle: could not place {libs[i]}\n`)
return false
}
if libs[i] != "" { bundle_native_notices(fwd_path(libs[i]), root) }
}
return true
}