Commitae4f7a5dRecorded24 Apr 2026Repositorysigil-graphics

v0.9.2: add Windows link-flags branch + windows-amd64 cross-compile config

Message

sokolgfx + sokolgp with SOKOLGLCORE on Windows MinGW need no extra link libs beyond what sigil-app supplies: the embedded Win32 GL loader (SOKOLUSEWIN32GLLOADER at sokolgfx.h:5556) pulls opengl32.dll dynamically via LoadLibraryA + wglGetProcAddress (sokolgfx.h:9131), and the only system import it needs is GetProcAddress from kernel32, which sigil-app already links. sokol_gfx.h's own MinGW/MSYS2 link docs confirm this explicitly (only -ld3d11 is needed extra, and only for the D3D11 backend).

Add an explicit (windows) '() branch with a comment documenting the reasoning, so a future reader doesn't "helpfully" add -lopengl32.

Add a windows-amd64 config (toolchain: 'zig, target: x86_64-windows-gnu) to match sigil-app v0.8.3. Without this, 'sigil build --config windows-amd64' silently cross-compiles for the host — the .a archive contains Linux ELF objects in a directory named windows-amd64/.

Changed
 package.sgl | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)
Diff
package.sglmodified
@@ -5,7 +5,7 @@
5
6
(package
7
name: "sigil-graphics"
8
version: "0.9.1"
+8
version: "0.9.2"
9
description: "2D graphics, image loading, and font rendering for Sigil"
10
url: "https://codeberg.org/sigil/sigil-graphics"
11
license: "BSD-3-Clause"
@@ -21,7 +21,20 @@
21
name: 'release
22
output-dir: "build/release"
23
debug?: #f
24
optimize: 2))
+24
optimize: 2)
+25
+26
;; Windows x86_64 (MinGW via zig) — built so downstream consumers
+27
;; (e.g., cinder-cantata) can produce Windows binaries from Linux.
+28
;; Mirrors the windows-amd64 config in sigil-audio and the main sigil package.
+29
(config
+30
name: 'windows-amd64
+31
output-dir: "build/windows-amd64"
+32
toolchain: 'zig
+33
target: "x86_64-windows-gnu"
+34
static?: #t
+35
debug?: #f
+36
optimize: 2
+37
features: '(release cross windows)))
38
39
dependencies: (list
40
(from-git url: "codeberg:sigil/sigil" package: "sigil-stdlib" version: "^0.13.0")
@@ -34,10 +47,14 @@
47
"src/c/graphics.c" "src/c/image.c" "src/c/font.c")
48
c-include-dirs: '("vendor/sokol" "vendor/stb")
49
native-init: "sigil__init_sigil_graphics_module"
37
;; Platform-specific linker flags for OpenGL
+50
;; Platform-specific linker flags for OpenGL.
+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 '()))))
59
60
tasks: (list