AtlatestRepositorysigil-ui
1
#!/usr/bin/env sigil2
(import (sigil shell prelude))4
(requires (tools gcc zig nm))5
(define root (realpath (path (script-dir) "..")))6
(define fixture (path root "test/link-check"))7
(define cli (arg 1 default: (executable-path)))9
(define (global-symbols archive selection)10
(map (lambda (line) (car (split line " ")))11
(filter (lambda (line) (and (not (equal? line "")) (not (ends-with? line ":"))))12
(lines nm -P -g ,selection ,archive timeout: 30))))14
($ ,cli deps install cwd: ,fixture timeout: 180)15
(each config '("gcc" "dev")16
($ ,cli build --config ,config cwd: ,fixture timeout: 300)17
(define build (path fixture "build" config))18
(define ui-archive (path build "native/libsigil-ui.a"))19
(define ui (global-symbols ui-archive "--defined-only"))20
(define window (global-symbols (path build "native/libsigil-window.a") "--defined-only"))21
(define collisions (filter (lambda (name) (member name window)) ui))22
(unless (null? collisions)23
(error "Wayland libraries define duplicate globals" config collisions))24
(unless (and (member "sui_wayland_acquire" ui)25
(member "sigil_window_wayland_acquire" window)26
(member "wl_display_interface" window)27
(member "xdg_activation_v1_interface" window)28
(member "xdg_activation_v1_interface" (global-symbols ui-archive "--undefined-only")))29
(error "Expected both Wayland bridges and sigil-window protocol tables" config))30
($ ,(path build "bin/sigil-ui-link-check") timeout: 30)31
(println "PASS: ~a linked both Wayland archives with unique globals" config))