AtlatestRepositorycore-channel
core-channel / tree / src / core / packagesterminal.sgl
1
;;; Terminal libraries.2
;;;3
;;; ncurses is the wide-character terminal library every terminal editor in4
;;; this channel links against. The install phase must pin `ticdir` because5
;;; ncurses' own install rule otherwise writes the compiled terminfo database6
;;; 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
(begin14
(define ncurses15
(package16
name: "ncurses"17
version: "6.6"18
source: (external-source19
location: "https://ftp.gnu.org/gnu/ncurses/ncurses-6.6.tar.gz"20
sha256: "355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11")21
buildenv: core-buildenv22
;; ncurses with `--enable-widec` installs its headers ONLY into23
;; `include/ncursesw/`; `include/` itself holds no headers at all24
;; (measured on both built store items). A consumer compiling25
;; `#include <curses.h>` therefore needs that directory on its include26
;; path.27
;;28
;; This declaration is what replaced a hardcode. The generic builder29
;; used to emit `-I<dep>/include/ncursesw` for EVERY dependency of30
;; EVERY package: one package's directory layout baked into the builder31
;; for all packages alike. Now ncurses says it itself, and only32
;; 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 directions36
;; (without it the compile fails `fatal error: 'curses.h' file not37
;; found`; with it, it succeeds).38
search-paths: (list (cons "CPATH" "include/ncursesw"))39
phases: (list40
(external-phase41
kind: 'configure42
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 compiled56
;; terminfo database outside DESTDIR, so `ticdir` has to be57
;; pinned. This was spelled `/tmp/sigil/build/out/...` under58
;; the old model; `${out}` expands to exactly the same string59
;; (the builder rewrote both `/out` and `/tmp/sigil/build/out`60
;; to the package's own prefix), so this is a rename, not a61
;; behaviour change.62
(external-phase63
kind: 'install64
args: (list "ticdir=${out}/share/terminfo")))))))