AtlatestRepositorysigil-ui

sigil-ui / treepackage.sgl

1;;; sigil-ui - a retained-mode UI framework for Sigil
2;;;
3;;; Views are functions of state, reconciled into a persistent tree that
4;;; produces a display list. Renderers turn the display list into pixels;
5;;; surfaces put the pixels on a screen or in a file.
6
7(define ui-common-sources '("native/raster.c" "native/png.c"))
8(define ui-flags '("-std=c99" "-Wall" "-Wextra" "-Wno-unused-parameter" "-D_GNU_SOURCE"))
9
10(define (compile-ui ctx)
11 ((compile-c-sources
12 sources: (append ui-common-sources
13 (case (target-os ctx)
14 ((darwin windows) '("native/surface-unavailable.c"))
15 ((linux) '("native/surface.c" "native/wayland.c"))
16 (else (error "sigil-ui supports Linux, macOS and Windows targets"))))
17 include-dirs: '("native/wayland" "native/wayland/include")
18 flags: (with-sigil-c-flags ui-flags)) ctx))
20(define (compile-ui-modules ctx)
21 ((compile-sigil-modules
22 sources: "src/**/*.sgl"
23 exclude: (map (lambda (file) (path-join (context-package-dir ctx) file))
24 (append
25 (if (eq? (target-os ctx) 'windows) '() '("src/sigil/ui/win32.sgl"))
26 (if (eq? (target-os ctx) 'darwin) '()
27 '("src/sigil/ui/appkit.sgl" "src/sigil/ui/appkit/wait.sgl"))))
28 output-dir: (config-output-subdir "lib")) ctx))
30(package
31 name: "sigil-ui"
32 version: "0.2.11"
33 sigil: "0.24.8"
34 description: "Retained-mode UI framework with a software renderer"
35 url: "https://git.usesigil.org/sigil/sigil-ui"
36 license: "BSD-3-Clause"
37 authors: (list "David Wilson <david@daviwil.com>")
39 configs: (list
40 (config name: 'darwin-arm64 toolchain: 'zig target: "aarch64-macos.15.0-none"
41 features: '(cross darwin) output-dir: "build/darwin-arm64")
42 (config name: 'darwin-amd64 toolchain: 'zig target: "x86_64-macos.15.0-none"
43 features: '(cross darwin) output-dir: "build/darwin-amd64")
44 (config name: 'windows-amd64 toolchain: 'zig target: "x86_64-windows-gnu"
45 features: '(cross windows) output-dir: "build/windows-amd64")
46 (config
47 name: 'dev
48 output-dir: "build/dev"
49 debug?: #t
50 optimize: 0)
51 (config
52 name: 'release
53 output-dir: "build/release"
54 debug?: #f
55 optimize: 2))
57 dependencies: (list
58 (from-pkg name: "sigil/sigil-window" version: "^0.2.2")
59 (from-pkg name: "sigil/sigil-font" version: "^0.1.3")
60 (from-pkg name: "sigil/sigil-lib" version: "^0.24.8")
61 (from-pkg name: "sigil/sigil-stdlib" version: "^0.24.8"))
63 ;; The test runner declares its package/build/store helpers transitively.
64 dev-dependencies: (list
65 (from-pkg name: "sigil/sigil-shell" version: "^0.24.6")
66 (from-pkg name: "sigil/sigil-test" version: "^0.24.6")
67 (from-pkg name: "sigil/sigil-test-runner" version: "^0.24.6"))
69 ;; Pixel loops and device access are native. Linux uses runtime-loaded
70 ;; Wayland libraries and the protocol tables from sigil-window. Sigil-window
71 ;; also supplies the AppKit host and native child services.
72 libraries: (list
73 (library
74 name: 'sigil-ui
75 c-sources: ui-common-sources
76 c-include-dirs: '("native" "native/wayland" "native/wayland/include")
77 native-init: "sigil__init_sigil_ui_native"
78 link-flags: '()))
80 tasks: (list
81 (task
82 name: 'build
83 description: "Build sigil-ui"
84 steps: (list
85 compile-ui
87 (create-static-library
88 name: "sigil-ui")
90 compile-ui-modules
92 (copy-package-docs)))))