Commit97e5c218Recorded24 Apr 2026Repositorysigil-graphics

v0.9.3: 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 -lGL leaked into Windows cross-compile builds and caused the final link to fail against zig's MinGW sysroot (which has no matching GL import library).

OS branches are unchanged: linux → -lGL darwin → -framework OpenGL -framework Metal -framework MetalKit windows → '() (sokol_gfx's GL backend dynamically loads opengl32.dll)

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

Changed
 CHANGELOG.md | 20 ++++++++++++++++++++
 package.sgl  | 18 ++++++++++++------
 2 files changed, 32 insertions(+), 6 deletions(-)
Diff
CHANGELOG.mdmodified
@@ -5,6 +5,26 @@ 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.9.3] - 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
`-lGL` leaked into Windows cross-compile builds and caused the
+16
final link to fail against zig's MinGW sysroot (which has no
+17
matching GL import library). The procedural form re-evaluates at
+18
link time with the target triple. Branches themselves are
+19
unchanged (`linux`: `-lGL`; `darwin`: `-framework OpenGL
+20
-framework Metal -framework MetalKit`; `windows`: `'()`, since
+21
sokol_gfx's GL backend dynamically loads `opengl32.dll`).
+22
+23
### Requires
+24
+25
- `sigil-build` 0.14.0+ (for the `target-os` / `target-arch` helpers
+26
and the procedural-link-flags dispatch in `collect-native-link-flags`).
+27
28
## [0.9.0] - 2026-04-18
29
30
> Note: skips 0.8.0. The `v0.8.0` git tag was used on 2026-03-29 for the
package.sglmodified
@@ -5,7 +5,7 @@
5
6
(package
7
name: "sigil-graphics"
8
version: "0.9.2"
+8
version: "0.9.3"
9
description: "2D graphics, image loading, and font rendering for Sigil"
10
url: "https://codeberg.org/sigil/sigil-graphics"
11
license: "BSD-3-Clause"
@@ -51,11 +51,17 @@
51
;; Windows: sokol_gfx's GL backend loads opengl32.dll dynamically via
52
;; LoadLibraryA + GetProcAddress (kernel32 — linked via sigil-app), so no
53
;; extra link libs are needed beyond what sigil-app provides.
54
link-flags: (case (host-os)
55
((linux) '("-lGL"))
56
((darwin) '("-framework" "OpenGL" "-framework" "Metal" "-framework" "MetalKit"))
57
((windows) '())
58
(else '()))))
+54
;;
+55
;; Procedural (lambda ctx) form so cross-compile configs evaluate
+56
;; the right branch at link time. (case (host-os) ...) was evaluated
+57
;; once at package-load on the host, leaking `-lGL` into Windows
+58
;; cross builds.
+59
link-flags: (lambda (ctx)
+60
(case (target-os ctx)
+61
((linux) '("-lGL"))
+62
((darwin) '("-framework" "OpenGL" "-framework" "Metal" "-framework" "MetalKit"))
+63
((windows) '())
+64
(else '())))))
65
66
tasks: (list
67
(task