AtlatestRepositorysigil-ui

sigil-ui / tree / scripts / macosprepare-qualification.sgl

1;;; FONT HOST_PACKET HOST_MANIFEST_SHA256 OUTPUT — assemble prebuilt images only.
2(import (sigil shell prelude))
3(requires (tools cp chmod sha256sum))
4(define root (realpath (path (script-dir) "../..")))
5(define font (realpath (arg 1)))
6(define host (realpath (arg 2)))
7(define expected-host (arg 3))
8(define destination (arg 4))
9(unless (and (starts-with? destination "/") (not (file-exists? destination)))
10 (error "Expected a fresh absolute packet directory"))
11(unless (equal? expected-host (car (regex-split "\\s+" (out sha256sum ,(path host "SHA256SUMS")))))
12 (error "Host manifest differs from its external pin"))
13($ sha256sum --quiet -c SHA256SUMS cwd: ,host)
14(ensure-directory destination)
15(define (copy! source name)
16 (define output (path destination name))
17 (ensure-directory (dirname output))
18 ($ cp ,source ,output))
19(each name '("host-aarch64" "appkit-conformance" "webkit-aarch64" "initialization-aarch64" "Info.plist")
20 (copy! (path host name) name))
21(copy! (path root "test/macos/qualify.sgl") "qualify.sgl")
22(copy! (path root "test/macos/fixture-arguments.sgl") "fixture-arguments.sgl")
23(copy! (path font "test/coretext-host/build/darwin-arm64/bin/sigil-font-coretext-tests") "font-aarch64")
24(copy! (path root "test/macos-drawing/build/darwin-arm64/bin/sigil-font-ui-drawing-tests") "ui-drawing-aarch64")
25(each name '("host-aarch64" "appkit-conformance" "webkit-aarch64" "initialization-aarch64"
26 "font-aarch64" "ui-drawing-aarch64")
27 ($ chmod "755" ,(path destination name)))
28(each name '("JetBrainsMono-Regular.ttf" "JetBrainsMono-Bold.ttf" "NotoSansSymbols2-Regular.ttf"
29 "OFL.txt" "Noto-Symbols-OFL.txt" "README.md" "helpers.sgl")
30 (copy! (path font "test/fixtures" name) (path "font/fixtures" name)))
31(each name '("test-conformance.sgl" "test-coretext-lifetime.sgl" "test-coretext-unicode.sgl")
32 (copy! (path font "test" name) (path "font/test" name)))
33(each entry '(("native/coretext.c" "coretext.c") ("native/coretext-runtime.c" "coretext-runtime.c")
34 ("native/coretext-runtime.h" "coretext-runtime.h")
35 ("test/coretext-host/native/fixture.c" "fixture.c")
36 ("test/coretext-host/src/sigil/font/tests/coretext.sgl" "coretext-main.sgl")
37 ("test/coretext-host/native/probe-support.h" "probe-support.h")
38 ("test/coretext-host/native/collection-support.h" "collection-support.h")
39 ("test/coretext-host/src/sigil/font/tests/fixtures.sgl" "fixture-module.sgl")
40 ("test/coretext-host/package.sgl" "coretext-package.sgl") ("package.sgl" "font-package.sgl"))
41 (copy! (path font (car entry)) (path "font/source" (cadr entry))))
42(each entry '(("src/drawing/main.sgl" "drawing-main.sgl") ("src/drawing/native.sgl" "drawing-native.sgl")
43 ("native/capture.c" "capture.c") ("package.sgl" "drawing-package.sgl"))
44 (copy! (path root "test/macos-drawing" (car entry)) (path "font/source" (cadr entry))))
45(define names (map (lambda (file) (path-relative destination file))
46 (filter file? (directory-walk-list destination))))
47(unless (= 33 (length names)) (error "Incomplete qualification packet" (length names)))
48(write-text (path destination "SHA256SUMS") (str (out sha256sum ,@names cwd: ,destination) "\n"))
49($ sha256sum --quiet -c SHA256SUMS cwd: ,destination)
50(println "PASS: 33 exact inputs; independently record this manifest pin")
51($ sha256sum ,(path destination "SHA256SUMS"))