| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 |
|
| 28 | (define-module (gnu packages ncurses)
|
| 29 | #:use-module (gnu packages)
|
| 30 | #:use-module (guix licenses)
|
| 31 | #:use-module (guix gexp)
|
| 32 | #:use-module (guix packages)
|
| 33 | #:use-module (guix download)
|
| 34 | #:use-module (guix build-system gnu)
|
| 35 | #:use-module (guix build-system perl)
|
| 36 | #:use-module (gnu packages)
|
| 37 | #:use-module (gnu packages perl)
|
| 38 | #:use-module (gnu packages pkg-config)
|
| 39 | #:use-module (gnu packages swig)
|
| 40 | #:use-module (gnu packages linux)
|
| 41 | #:use-module (guix utils)
|
| 42 | #:use-module ((guix memoization) #:select (mlambda))
|
| 43 | #:use-module (ice-9 match))
|
| 44 |
|
| 45 | (define ncurses-rollup-patch
|
| 46 | (mlambda (version)
|
| 47 | (origin
|
| 48 | (method url-fetch)
|
| 49 | (uri (match (string-split (version-major+minor+point version) #\.)
|
| 50 | ((major minor point)
|
| 51 | (string-append "https://invisible-mirror.net/archives"
|
| 52 | "/ncurses/" major "." minor "/ncurses-"
|
| 53 | major "." minor "-" point "-patch.sh.bz2"))))
|
| 54 | (sha256
|
| 55 | (base32
|
| 56 | "1b6522cvi4066bgh9lp93q8lk93zcjjssvnw1512z447xvazy2y6")))))
|
| 57 |
|
| 58 | (define-public ncurses
|
| 59 | (package
|
| 60 | (name "ncurses")
|
| 61 | (version "6.2.20210619")
|
| 62 | (source (origin
|
| 63 | (method url-fetch)
|
| 64 | (uri (string-append "mirror://gnu/ncurses/ncurses-"
|
| 65 | (version-major+minor version)
|
| 66 | ".tar.gz"))
|
| 67 | (sha256
|
| 68 | (base32
|
| 69 | "17bcm2z1rdx5gmzj5fb8cp7f28aw5b4g2z4qvvqg3yg0fq66wc1h"))))
|
| 70 | (build-system gnu-build-system)
|
| 71 | (outputs '("out"
|
| 72 | "doc")) |
| 73 | (arguments
|
| 74 | (let ((patch-makefile-phase
|
| 75 | #~(lambda _
|
| 76 | (for-each patch-makefile-SHELL
|
| 77 | (find-files "." "Makefile.in"))))
|
| 78 | (configure-phase
|
| 79 | |
| 80 | |
| 81 | #~(lambda* (#:key build target outputs configure-flags
|
| 82 | #:allow-other-keys)
|
| 83 | (let ((out (assoc-ref outputs "out"))
|
| 84 | (doc (assoc-ref outputs "doc")))
|
| 85 | (apply invoke "./configure"
|
| 86 | (string-append "SHELL=" (which "sh"))
|
| 87 | (string-append "--build=" build)
|
| 88 | (string-append "--prefix=" out)
|
| 89 | (string-append "--mandir=" doc "/share/man")
|
| 90 | (if target
|
| 91 | (cons (string-append "--host=" target)
|
| 92 | configure-flags)
|
| 93 | configure-flags)))))
|
| 94 | (apply-rollup-patch-phase
|
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | #~(lambda* (#:key inputs native-inputs #:allow-other-keys)
|
| 100 | (let ((rollup-patch #$(ncurses-rollup-patch
|
| 101 | (package-version this-package))))
|
| 102 | (copy-file rollup-patch
|
| 103 | (string-append (getcwd) "/rollup-patch.sh.bz2"))
|
| 104 | (invoke "bzip2" "-d" "rollup-patch.sh.bz2")
|
| 105 | (invoke "sh" "rollup-patch.sh"))))
|
| 106 | (remove-shebang-phase
|
| 107 | #~(lambda _
|
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | (substitute* "misc/ncurses-config.in"
|
| 113 | (("#!@SHELL@")
|
| 114 | "# No shebang here, use /bin/sh!\n")
|
| 115 | (("@SHELL@ \\$0")
|
| 116 | "$0")
|
| 117 | (("mandir=.*$")
|
| 118 | "mandir=share/man"))))
|
| 119 | (post-install-phase
|
| 120 | #~(lambda* (#:key outputs #:allow-other-keys)
|
| 121 | (let ((out (assoc-ref outputs "out")))
|
| 122 | |
| 123 | |
| 124 | |
| 125 | #$@(if (target-mingw?)
|
| 126 | '( |
| 127 | (with-directory-excursion (string-append out "/bin")
|
| 128 | (for-each
|
| 129 | (lambda (lib)
|
| 130 | (define lib.dll
|
| 131 | (string-append "lib" lib ".dll"))
|
| 132 | (define libw6.dll
|
| 133 | (string-append "lib" lib "w6.dll"))
|
| 134 |
|
| 135 | (when (file-exists? libw6.dll)
|
| 136 | (format #t "creating symlinks for `lib~a'~%" lib)
|
| 137 | (symlink libw6.dll lib.dll)))
|
| 138 | '("curses" "ncurses" "form" "panel" "menu"))))
|
| 139 | #~())
|
| 140 | (with-directory-excursion (string-append out "/lib")
|
| 141 | (for-each (lambda (lib)
|
| 142 | (define libw.a
|
| 143 | (string-append "lib" lib "w.a"))
|
| 144 | (define lib.a
|
| 145 | (string-append "lib" lib ".a"))
|
| 146 |
|
| 147 | #$@(if (not (target-mingw?))
|
| 148 | #~((define libw.so.x
|
| 149 | (string-append "lib" lib "w.so.6"))
|
| 150 | (define lib.so.x
|
| 151 | (string-append "lib" lib ".so.6"))
|
| 152 | (define lib.so
|
| 153 | (string-append "lib" lib ".so"))
|
| 154 | (define packagew.pc
|
| 155 | (string-append lib "w.pc"))
|
| 156 | (define package.pc
|
| 157 | (string-append lib ".pc")))
|
| 158 | #~())
|
| 159 |
|
| 160 | (when (file-exists? libw.a)
|
| 161 | (format #t "creating symlinks for `lib~a'~%" lib)
|
| 162 | (symlink libw.a lib.a)
|
| 163 | #$@(if (not (target-mingw?))
|
| 164 | '((symlink libw.so.x lib.so.x)
|
| 165 | (false-if-exception (delete-file lib.so))
|
| 166 | (call-with-output-file lib.so
|
| 167 | (lambda (p)
|
| 168 | (format p "INPUT (-l~aw)~%" lib)))
|
| 169 | (with-directory-excursion "pkgconfig"
|
| 170 | (format #t "creating symlink for `~a'~%"
|
| 171 | package.pc)
|
| 172 | (when (file-exists? packagew.pc)
|
| 173 | (symlink packagew.pc package.pc))))
|
| 174 | #~())))
|
| 175 | '("curses" "ncurses" "form" "panel" "menu")))))))
|
| 176 | (list #:configure-flags
|
| 177 | #~`("--with-shared" "--without-debug" "--enable-widec"
|
| 178 |
|
| 179 | "--enable-pc-files"
|
| 180 | ,(string-append "--with-pkg-config-libdir="
|
| 181 | #$output "/lib/pkgconfig")
|
| 182 |
|
| 183 | |
| 184 | |
| 185 | ,(string-append "--includedir=" #$output "/include")
|
| 186 | "--enable-overwrite" |
| 187 |
|
| 188 | |
| 189 | |
| 190 | ,(string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
|
| 191 |
|
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | #$@(if (%current-target-system) #~("--disable-stripping") #~())
|
| 197 |
|
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | "cf_cv_ld_searchpath=/no-ld-searchpath"
|
| 203 |
|
| 204 | |
| 205 | #$@(if (target-mingw?) #~("--enable-term-driver") #~()))
|
| 206 | #:tests? #f |
| 207 | #:phases #~(modify-phases %standard-phases
|
| 208 | (add-after 'unpack 'apply-rollup-patch
|
| 209 | #$apply-rollup-patch-phase)
|
| 210 | (replace 'configure #$configure-phase)
|
| 211 | (add-after 'install 'post-install
|
| 212 | #$post-install-phase)
|
| 213 | (add-before 'configure 'patch-makefile-SHELL
|
| 214 | #$patch-makefile-phase)
|
| 215 | (add-before 'patch-source-shebangs 'remove-unneeded-shebang
|
| 216 | #$remove-shebang-phase)))))
|
| 217 | (native-inputs
|
| 218 | (if (%current-target-system)
|
| 219 | (list pkg-config this-package) |
| 220 | (list pkg-config)))
|
| 221 | (native-search-paths
|
| 222 | (list (search-path-specification
|
| 223 | (variable "TERMINFO_DIRS")
|
| 224 | (files '("share/terminfo")))))
|
| 225 | (synopsis "Terminal emulation (termcap, terminfo) library")
|
| 226 | (description
|
| 227 | "GNU Ncurses is a library which provides capabilities to write text to
|
| 228 | a terminal in a terminal-independent manner. It supports pads and color as
|
| 229 | well as multiple highlights and forms characters. It is typically used to
|
| 230 | implement user interfaces for command-line applications. The accompanying
|
| 231 | ncursesw library provides wide character support.")
|
| 232 | (license x11)
|
| 233 | (home-page "https://www.gnu.org/software/ncurses/")))
|
| 234 |
|
| 235 | (define-public ncurses/gpm
|
| 236 | (package/inherit ncurses
|
| 237 | (name "ncurses-with-gpm")
|
| 238 | (arguments
|
| 239 | (substitute-keyword-arguments arguments
|
| 240 | ((#:configure-flags cf)
|
| 241 | #~(cons (string-append "--with-gpm="
|
| 242 | #$(this-package-input "gpm")
|
| 243 | "/lib/libgpm.so.2")
|
| 244 | #$cf))))
|
| 245 | (inputs (list gpm))))
|
| 246 |
|
| 247 | |
| 248 | |
| 249 | (define-public ncurses/tinfo
|
| 250 | (package/inherit ncurses
|
| 251 | (name "ncurses-with-tinfo")
|
| 252 | (arguments
|
| 253 | (substitute-keyword-arguments arguments
|
| 254 | ((#:configure-flags cf)
|
| 255 | #~(cons "--with-termlib=tinfo" #$cf))))))
|
| 256 |
|
| 257 | (define-public cdk
|
| 258 | (package
|
| 259 | (name "cdk")
|
| 260 | (version "5.0-20250116")
|
| 261 | (source (origin
|
| 262 | (method url-fetch)
|
| 263 | (uri (string-append
|
| 264 | "https://invisible-mirror.net/archives/cdk/cdk-"
|
| 265 | version ".tgz"))
|
| 266 | (sha256
|
| 267 | (base32
|
| 268 | "10ywvbnxwk6sfvlbkzfnbx9whsq9xv227znaiir742ym4h9d800m"))))
|
| 269 | (build-system gnu-build-system)
|
| 270 | |
| 271 | (arguments
|
| 272 | (list #:configure-flags #~'("--with-shared" "--enable-rpath")))
|
| 273 | (inputs
|
| 274 | (list ncurses))
|
| 275 | (synopsis "Curses widgets")
|
| 276 | (description "Curses Development Kit (CDK) is a C library of widgets
|
| 277 | which allow a programmer to quickly create TUI applications. Widgets are
|
| 278 | objects whose appearance and behavior can be customized, e.g. a pulldown
|
| 279 | menu or a file-viewer.")
|
| 280 | (home-page "https://invisible-island.net/cdk/cdk.html")
|
| 281 | |
| 282 | (license (non-copyleft "file://share/doc/cdk/COPYING"))))
|
| 283 |
|
| 284 | (define-public dialog
|
| 285 | (package
|
| 286 | (name "dialog")
|
| 287 | (version "1.3-20250116")
|
| 288 | (source (origin
|
| 289 | (method url-fetch)
|
| 290 | (uri (string-append
|
| 291 | "https://invisible-mirror.net/archives/dialog/dialog-"
|
| 292 | version ".tgz"))
|
| 293 | (sha256
|
| 294 | (base32
|
| 295 | "1p8n31a2143fw1agh9qshsn925vf9jlj1k2ri453sy3vh8ln6h38"))))
|
| 296 | (build-system gnu-build-system)
|
| 297 | (arguments
|
| 298 | (list #:configure-flags #~'("--with-shared" "--enable-rpath")
|
| 299 | #:phases #~(modify-phases %standard-phases
|
| 300 | (add-after 'install 'install-lib
|
| 301 | (lambda _
|
| 302 | (invoke "make" "install-lib"))))))
|
| 303 | (inputs
|
| 304 | (list ncurses))
|
| 305 | (synopsis "Curses widgets")
|
| 306 | (description "Dialog is a script-interpreter and a library which provides
|
| 307 | a set of curses widgets, such as dialog boxes.")
|
| 308 | (home-page "https://invisible-island.net/dialog/dialog.html")
|
| 309 | (license lgpl2.1)))
|
| 310 |
|
| 311 | (define-public perl-curses
|
| 312 | (package
|
| 313 | (name "perl-curses")
|
| 314 | (version "1.45")
|
| 315 | (source
|
| 316 | (origin
|
| 317 | (method url-fetch)
|
| 318 | (uri (string-append "mirror://cpan/authors/id/G/GI/GIRAFFED/"
|
| 319 | "Curses-" version ".tar.gz"))
|
| 320 | (sha256
|
| 321 | (base32
|
| 322 | "1cmf0mpbsfiymy4znr84rg938mxfn52bnckamq5lmmm22c01w8l4"))))
|
| 323 | (build-system perl-build-system)
|
| 324 | (inputs
|
| 325 | (list ncurses))
|
| 326 | (arguments
|
| 327 | `(#:make-maker-flags (list "PANELS" "MENUS")
|
| 328 | #:phases
|
| 329 | (modify-phases %standard-phases
|
| 330 | (add-before
|
| 331 | 'configure 'set-curses-ldflags
|
| 332 | (lambda* (#:key inputs #:allow-other-keys)
|
| 333 | (let* ((ncurses (assoc-ref inputs "ncurses"))
|
| 334 | (include (string-append ncurses "/include"))
|
| 335 | (lib (string-append ncurses "/lib")))
|
| 336 | (setenv "CURSES_LIBTYPE" "ncurses")
|
| 337 | (setenv "CURSES_CFLAGS" (string-append "-I" include))
|
| 338 | (setenv "CURSES_PANEL_CFLAGS" (string-append "-I" include))
|
| 339 | (setenv "CURSES_MENU_CFLAGS" (string-append "-I" include))
|
| 340 | (setenv "CURSES_FORM_CFLAGS" (string-append "-I" include))
|
| 341 | (setenv "CURSES_LDFLAGS" (string-append "-L" lib " -lncurses"))
|
| 342 | (setenv "CURSES_PANEL_LDFLAGS" (string-append "-L" lib " -lpanel"))
|
| 343 | (setenv "CURSES_MENU_LDFLAGS" (string-append "-L" lib " -lmenu"))
|
| 344 | (setenv "CURSES_FORM_LDFLAGS" (string-append "-L" lib " -lform"))
|
| 345 | #t))))))
|
| 346 | (home-page "https://metacpan.org/release/Curses")
|
| 347 | (synopsis "Terminal screen handling and optimization")
|
| 348 | (description
|
| 349 | "@code{Curses} is the interface between Perl and the curses library
|
| 350 | of your system.")
|
| 351 | (license perl-license)))
|
| 352 |
|
| 353 | (define-public stfl
|
| 354 | (package
|
| 355 | (name "stfl")
|
| 356 | (version "0.24")
|
| 357 | (source
|
| 358 | (origin
|
| 359 | (method url-fetch)
|
| 360 | |
| 361 | |
| 362 | (uri (string-append "https://web.archive.org/web/20211113222004/"
|
| 363 | "http://www.clifford.at/stfl/stfl-"
|
| 364 | version ".tar.gz"))
|
| 365 | (sha256
|
| 366 | (base32 "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl"))))
|
| 367 | (build-system gnu-build-system)
|
| 368 | (arguments
|
| 369 | `(#:tests? #f |
| 370 | #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out"))
|
| 371 | (string-append "CC=" ,(cc-for-target)))
|
| 372 | #:phases
|
| 373 | (modify-phases %standard-phases
|
| 374 | (delete 'configure) |
| 375 | |
| 376 | (add-before 'build 'patch-ncursesw
|
| 377 | (lambda _
|
| 378 | (substitute* "stfl_internals.h"
|
| 379 | (("ncursesw/") ""))))
|
| 380 | (add-after 'install 'install-missing-symlink
|
| 381 | (lambda* (#:key outputs #:allow-other-keys)
|
| 382 | (let* ((out (assoc-ref outputs "out"))
|
| 383 | (lib (string-append out "/lib")))
|
| 384 | |
| 385 | (symlink "libstfl.so" (string-append lib "/libstfl.so.0"))))))))
|
| 386 | (inputs (list ncurses))
|
| 387 | (native-inputs (list ncurses swig-4.0))
|
| 388 | (home-page (string-append "https://web.archive.org/web/20211113222004/"
|
| 389 | "http://www.clifford.at/stfl/"))
|
| 390 | (synopsis "Structured terminal forms library")
|
| 391 | (description "@acronym{STFL, Structured Terminal Forms Language} is a
|
| 392 | language for easily describing @acronym{GUIs, Graphical User Interfaces}.
|
| 393 | @acronym{STFL, Structured Terminal Forms Library} is also the name of this
|
| 394 | library which translates those descriptions into a curses-based widget set for
|
| 395 | text terminals.
|
| 396 |
|
| 397 | STFL descriptions do not contain any concrete layouting information, such as x/y
|
| 398 | coordinates of widgets. Instead, container widgets such as vertical and
|
| 399 | horizontal boxes, as well as tables, are used to group widgets. The actual
|
| 400 | layouting work is done by the STFL library. This allows STFL GUIs to handle
|
| 401 | terminals of different sizes and terminal resize events transparently for the
|
| 402 | application programmer.")
|
| 403 | (license lgpl3+)))
|