AtlatestRepositorycore-channel

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

1;;; Terminal libraries.
2;;;
3;;; ncurses is the wide-character terminal library every terminal editor in
4;;; this channel links against. The install phase must pin `ticdir` because
5;;; ncurses' own install rule otherwise writes the compiled terminfo database
6;;; outside DESTDIR; see the note beside the `install` phase below.
7(define-library (core packages terminal)
8 (import (sigil core)
9 (core build-environments)
10 (sigil env package)
11 (sigil build external))
12 (export ncurses)
13 (begin
14 (define ncurses
15 (package
16 name: "ncurses"
17 version: "6.6"
18 source: (external-source
19 location: "https://ftp.gnu.org/gnu/ncurses/ncurses-6.6.tar.gz"
20 sha256: "355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11")
21 buildenv: core-buildenv
22 ;; ncurses with `--enable-widec` installs its headers ONLY into
23 ;; `include/ncursesw/`; `include/` itself holds no headers at all
24 ;; (measured on both built store items). A consumer compiling
25 ;; `#include <curses.h>` therefore needs that directory on its include
26 ;; path.
27 ;;
28 ;; This declaration is what replaced a hardcode. The generic builder
29 ;; used to emit `-I<dep>/include/ncursesw` for EVERY dependency of
30 ;; EVERY package: one package's directory layout baked into the builder
31 ;; for all packages alike. Now ncurses says it itself, and only
32 ;; ncurses' consumers hear it.
33 ;;
34 ;; CPATH rather than a `-I` flag because a search path is a path list,
35 ;; and measured: zig cc 0.16.0 honours CPATH in both directions
36 ;; (without it the compile fails `fatal error: 'curses.h' file not
37 ;; found`; with it, it succeeds).
38 search-paths: (list (cons "CPATH" "include/ncursesw"))
39 phases: (list
40 (external-phase
41 kind: 'configure
42 args: (list "--prefix=${out}"
43 "--without-ada"
44 "--without-tests"
45 "--without-cxx"
46 "--without-cxx-binding"
47 "--without-debug"
48 "--disable-stripping"
49 "--without-shared"
50 "--with-normal"
51 "--enable-widec"
52 "--with-default-terminfo-dir=${out}/share/terminfo"
53 "--with-terminfo-dirs=${out}/share/terminfo"))
54 (external-phase kind: 'make)
55 ;; ncurses' own install rule otherwise writes the compiled
56 ;; terminfo database outside DESTDIR, so `ticdir` has to be
57 ;; pinned. This was spelled `/tmp/sigil/build/out/...` under
58 ;; the old model; `${out}` expands to exactly the same string
59 ;; (the builder rewrote both `/out` and `/tmp/sigil/build/out`
60 ;; to the package's own prefix), so this is a rename, not a
61 ;; behaviour change.
62 (external-phase
63 kind: 'install
64 args: (list "ticdir=${out}/share/terminfo")))))))