AtlatestRepositorycore-channel

core-channel / tree / src / core / packagesgraphics.sgl

1;;; Software rasterisation.
2;;;
3;;; pixman is foot's renderer: foot draws its cells into pixman images in
4;;; shared memory and hands the buffer to the compositor through `wl_shm`.
5;;; There is no GPU path in foot at all, which is why nothing in this channel
6;;; needs Mesa, a DRM driver, or anything else that would have to match the
7;;; host's graphics stack.
8;;;
9;;; VERSION, and this is a deliberate choice rather than staleness: 0.42.2 is
10;;; the last pixman release with an autotools build. 0.43 and later are
11;;; meson-only. foot's meson.build asks only for `pixman-1` with no version
12;;; constraint -- it tests `pixman.version().version_compare('>=0.46.0')` to
13;;; decide whether to define HAVE_PIXMAN_RGBA_16, and simply does not define it
14;;; otherwise. So taking the autotools release costs one optional pixel format
15;;; and removes a meson build from the chain.
16(define-library (core packages graphics)
17 (import (sigil core)
18 (core build-environments)
19 (core packages compression)
20 (sigil env package)
21 (sigil build external))
22 (export pixman libpng)
23 (begin
24 (define pixman
25 (package
26 name: "pixman"
27 version: "0.42.2"
28 source: (external-source
29 location: "https://cairographics.org/releases/pixman-0.42.2.tar.gz"
30 sha256: "ea1480efada2fd948bc75366f7c349e1c96d3297d09a3fe62626e38e234a625e")
31 buildenv: core-buildenv
32 phases: (list
33 (external-phase
34 kind: 'configure
35 args: (list "--prefix=${out}"
36 "--disable-shared"
37 "--enable-static"
38 ;; Every one of these is a probe that would
39 ;; otherwise make the output depend on what
40 ;; happens to be visible in the build
41 ;; environment. Turning them off is what makes
42 ;; the result a function of the declared
43 ;; inputs rather than of the sandbox's luck.
44 "--disable-gtk"
45 "--disable-libpng"
46 "--disable-openmp"))
47 (external-phase kind: 'make)
48 (external-phase kind: 'install))))
50 ;; libpng exists here for `grim`, the screenshot client, and for nothing
51 ;; else -- foot renders through pixman and never encodes an image.
52 ;;
53 ;; zlib is declared for the reason set out at length on `fontconfig` in
54 ;; (core packages fonts): libpng's generated `libpng.pc` carries a
55 ;; `Requires:` on zlib, and this channel composes PKG_CONFIG_PATH from
56 ;; DIRECT dependencies only. It is also simply true -- PNG's compression
57 ;; IS zlib's deflate, so zlib is on every libpng consumer's static link
58 ;; line.
59 (define libpng
60 (package
61 name: "libpng"
62 version: "1.6.50"
63 source: (external-source
64 location: "https://download.sourceforge.net/libpng/libpng-1.6.50.tar.xz"
65 sha256: "4df396518620a7aa3651443e87d1b2862e4e88cad135a8b93423e01706232307")
66 buildenv: core-buildenv
67 dependencies: (list zlib)
68 phases: (list
69 (external-phase
70 kind: 'configure
71 args: (list "--prefix=${out}"
72 "--disable-shared"
73 "--enable-static"))
74 (external-phase kind: 'make)
75 (external-phase kind: 'install)
76 (external-phase
77 kind: 'run
78 args: (list "sh" "-c"
79 (string-append
80 "set -eu\n"
81 "d=\"$(dirname \"$PWD\")/install-root\"\n"
82 "test -f \"$d${out}/lib/pkgconfig/libpng.pc\"\n"
83 "echo LIBPNG-PC-PRESENT\n"))))))))