AtlatestRepositorycore-channel
core-channel / tree / src / core / packagesinput.sgl
1
;;; Keyboard handling.2
;;;3
;;; libxkbcommon compiles XKB keymaps and turns key codes into keysyms and4
;;; UTF-8. A Wayland client needs it because the compositor hands over its5
;;; keymap as an XKB TEXT description over a file descriptor and each client6
;;; compiles that itself.7
;;;8
;;; THAT IS ALSO WHY `xkeyboard-config` IS NOT IN THIS CHANNEL. The keymap9
;;; DATABASE -- rules, symbols, geometry -- is what an X server or a10
;;; compositor reads to BUILD a keymap. A Wayland client is handed the11
;;; finished text and never opens the database, so `xkb-config-root` is left12
;;; at its default and nothing resolves it at runtime. Worth stating because13
;;; the default points at a path that does not exist here, and a reader who14
;;; assumes it is load-bearing will go looking for a missing package.15
(define-library (core packages input)16
(import (sigil core)17
(core build-environments)18
(core packages build-tools)19
(core packages python)20
(sigil env package)21
(sigil build external))22
(export libxkbcommon)23
(begin24
;; VERSION 1.7.0, AND IT IS CHOSEN RATHER THAN INHERITED.25
;;26
;; Two reasons, and they point the same way:27
;;28
;; PROVENANCE. `xkbcommon.org/download/` stops at 1.7.0 -- every later29
;; version 404s there -- and GitHub publishes no release asset for this30
;; project, only auto-generated source archives. Those archives are not31
;; release artifacts: their bytes can be regenerated and have changed32
;; under people before. 1.7.0 is the newest version with a real upstream33
;; dist tarball.34
;;35
;; COST. 1.7.0's meson.build:157 makes bison `required: false` and falls36
;; back to `find_program('byacc')`. 1.13.2 requires `bison >= 3.6`37
;; outright, and bison needs GNU m4 to build -- so the newer version38
;; would have added TWO packages to this channel, in exchange for weaker39
;; provenance.40
;;41
;; foot asks only for `xkbcommon >= 1.0.0`, so 1.7.0 is comfortably inside42
;; what it needs. If a future consumer wants a newer one, that is a scoped43
;; upgrade with an upstream-tarball question attached, not a reason to put44
;; a synthetic archive on this path.45
;;46
;; The byacc fallback is why `core/byacc` installs itself under BOTH names:47
;; the fallback looks for a program called `byacc`, and byacc's own48
;; makefile installs only `yacc`. See the note there.49
(define libxkbcommon50
(package51
name: "libxkbcommon"52
version: "1.7.0"53
source: (external-source54
location: "https://xkbcommon.org/download/libxkbcommon-1.7.0.tar.xz"55
sha256: "65782f0a10a4b455af9c6baab7040e2f537520caa2ec2092805cdfd36863b247")56
buildenv: core-buildenv57
build-inputs: (list meson samurai python byacc)58
phases: (list59
(external-phase60
kind: 'run61
args: (list "sh" "-c"62
(string-append63
"set -eu\n"64
"meson setup build"65
" --prefix=${out}"66
" --buildtype=plain"67
" --default-library=static"68
;; X11 support would want libxcb; the registry69
;; and the tools would want more still. foot is70
;; a Wayland client and links only the core71
;; library.72
" -Denable-x11=false"73
" -Denable-xkbregistry=false"74
" -Denable-wayland=false"75
" -Denable-tools=false"76
" -Denable-docs=false"77
" -Denable-bash-completion=false\n"78
"echo XKBCOMMON-CONFIGURED\n")))79
(external-phase80
kind: 'run81
args: (list "sh" "-c"82
(string-append83
"set -eu\n"84
;; Prove the yacc fallback actually ran, rather85
;; than assuming it: the parser is GENERATED, and86
;; a byacc without backtracking dies on this87
;; grammar's `%destructor`.88
;;89
;; SEARCHED RATHER THAN NAMED, because the first90
;; version of this check asserted91
;; `build/src/xkbcomp/parser.c` -- a path I had92
;; guessed. meson actually emits it into93
;; per-target directories94
;; (`build/libxkbcommon.a.p/parser.c`), so the95
;; check failed on a build where all 121 targets96
;; had linked successfully. A gate that names a97
;; path it has not observed is asserting its98
;; author's expectations, not the product.99
"meson compile -C build\n"100
"n=$(find build -name parser.c | wc -l)\n"101
"echo \"XKBCOMMON-GENERATED-PARSERS=$n\"\n"102
"test \"$n\" -ge 1\n"103
"echo XKBCOMMON-PARSER-GENERATED\n")))104
(external-phase105
kind: 'run106
args: (list "sh" "-c"107
(string-append108
"set -eu\n"109
"d=\"$(dirname \"$PWD\")/install-root\"\n"110
"DESTDIR=\"$d\" meson install -C build --no-rebuild\n"111
"test -f \"$d${out}/lib/pkgconfig/xkbcommon.pc\"\n"112
"echo XKBCOMMON-INSTALLED\n"))))))))