Commite80c8252Recorded24 Apr 2026Repositorysigil-audio

v0.10.2: procedural link-flags for cross-compile correctness

Message

Migrates link-flags: from (case (host-os) ...) to (lambda (ctx) (case (target-os ctx) ...)) so cross-compile builds (Linux → Windows via zig) pick the right branch at link time.

Before: (case (host-os) ...) evaluated once at package-load on the host, so a Linux host cross-compiling for Windows injected -lasound into the final link and failed against zig's MinGW sysroot.

OS branches are unchanged: linux → -lasound darwin → -framework AudioToolbox windows → -lole32 -lwinmm -lksuser

Requires sigil-build 0.14.0+ (for target-os helper and procedural link-flags: dispatch in collect-native-link-flags).

Changed
 CHANGELOG.md | 21 +++++++++++++++++++++
 package.sgl  | 26 ++++++++++++++++----------
 2 files changed, 37 insertions(+), 10 deletions(-)
Diff
CHANGELOG.mdmodified
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
5
The format is based on [Keep a Changelog](https://keepachangelog.com/),
6
and this project adheres to [Semantic Versioning](https://semver.org/).
7
+8
## [0.10.2] - 2026-04-24
+9
+10
### Fixed
+11
+12
- `link-flags:` now uses `(lambda (ctx) (case (target-os ctx) ...))`
+13
instead of a host-based `(case (host-os) ...)` expression. The
+14
host-based form evaluated at package-load time on the host, so
+15
Linux link flags leaked into Windows cross-compile builds; a
+16
`sigil build --config windows-amd64` pass from a Linux host would
+17
inject `-lasound` into the final link and fail against zig's MinGW
+18
sysroot. The procedural form re-evaluates at link time with the
+19
target triple, so cross-compile configs now pick the right branch.
+20
The OS branches themselves are unchanged (`linux`: `-lasound`;
+21
`darwin`: `-framework AudioToolbox`; `windows`: `-lole32 -lwinmm
+22
-lksuser`).
+23
+24
### Requires
+25
+26
- `sigil-build` 0.14.0+ (for the `target-os` / `target-arch` helpers
+27
and the procedural-link-flags dispatch in `collect-native-link-flags`).
+28
29
## [0.10.0] - 2026-04-24
30
31
### Added
package.sglmodified
@@ -6,7 +6,7 @@
6
7
(package
8
name: "sigil-audio"
9
version: "0.10.0"
+9
version: "0.10.2"
10
description: "Audio playback and streaming for Sigil"
11
url: "https://codeberg.org/sigil/sigil-audio"
12
license: "BSD-3-Clause"
@@ -56,15 +56,21 @@
56
native-init: "sigil__init_sigil_audio_module"
57
;; Platform-specific linker flags for sokol_audio's audio backend.
58
;; OGG Vorbis is now vendored — no more -lvorbis/-lvorbisenc/-logg.
59
link-flags: (case (host-os)
60
((linux) '("-lasound"))
61
((darwin) '("-framework" "AudioToolbox"))
62
;; sokol_audio's WASAPI backend uses CoCreateInstance
63
;; / CoInitializeEx (ole32). winmm + ksuser are
64
;; carried for completeness against future sokol
65
;; revisions that touch waveOut / kernel-streaming.
66
((windows) '("-lole32" "-lwinmm" "-lksuser"))
67
(else '()))))
+59
;;
+60
;; Procedural (lambda ctx) form so cross-compile configs evaluate
+61
;; the right branch at link time. (case (host-os) ...) was evaluated
+62
;; once at package-load on the host, leaking Linux flags into
+63
;; cross builds.
+64
link-flags: (lambda (ctx)
+65
(case (target-os ctx)
+66
((linux) '("-lasound"))
+67
((darwin) '("-framework" "AudioToolbox"))
+68
;; sokol_audio's WASAPI backend uses CoCreateInstance
+69
;; / CoInitializeEx (ole32). winmm + ksuser are
+70
;; carried for completeness against future sokol
+71
;; revisions that touch waveOut / kernel-streaming.
+72
((windows) '("-lole32" "-lwinmm" "-lksuser"))
+73
(else '())))))
74
75
tasks: (list
76
(task