gnu: kmscon: Remove dependency on MESA.
[jackhill/guix/guix.git] / gnu / packages / terminals.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
3 ;;; Copyright © 2016 Mckinley Olsen <mck.olsen@gmail.com>
4 ;;; Copyright © 2016, 2017 Alex Griffin <a@ajgrf.com>
5 ;;; Copyright © 2016 David Craven <david@craven.ch>
6 ;;; Copyright © 2016, 2017, 2019 Ludovic Courtès <ludo@gnu.org>
7 ;;; Copyright © 2016, 2017 José Miguel Sánchez García <jmi2k@openmailbox.org>
8 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
10 ;;; Copyright © 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
11 ;;; Copyright © 2017 Petter <petter@mykolab.ch>
12 ;;; Copyright © 2018 Hartmut Goebel <h.goebel@crazy-compilers.com>
13 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
14 ;;; Copyright © 2018 Gabriel Hondet <gabrielhondet@gmail.com>
15 ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
16 ;;; Copyright © 2018, 2019 Eric Bavier <bavier@member.fsf.org>
17 ;;;
18 ;;; This file is part of GNU Guix.
19 ;;;
20 ;;; GNU Guix is free software; you can redistribute it and/or modify it
21 ;;; under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 3 of the License, or (at
23 ;;; your option) any later version.
24 ;;;
25 ;;; GNU Guix is distributed in the hope that it will be useful, but
26 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
29 ;;;
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
32
33 (define-module (gnu packages terminals)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system glib-or-gtk)
38 #:use-module (guix build-system go)
39 #:use-module (guix build-system python)
40 #:use-module (guix download)
41 #:use-module (guix git-download)
42 #:use-module (guix packages)
43 #:use-module (gnu packages)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages crypto)
48 #:use-module (gnu packages docbook)
49 #:use-module (gnu packages fontutils)
50 #:use-module (gnu packages freedesktop)
51 #:use-module (gnu packages gcc)
52 #:use-module (gnu packages gettext)
53 #:use-module (gnu packages gl)
54 #:use-module (gnu packages glib)
55 #:use-module (gnu packages gnome)
56 #:use-module (gnu packages gtk)
57 #:use-module (gnu packages image)
58 #:use-module (gnu packages libevent)
59 #:use-module (gnu packages linux)
60 #:use-module (gnu packages ncurses)
61 #:use-module (gnu packages perl)
62 #:use-module (gnu packages perl-check)
63 #:use-module (gnu packages pkg-config)
64 #:use-module (gnu packages popt)
65 #:use-module (gnu packages protobuf)
66 #:use-module (gnu packages python)
67 #:use-module (gnu packages python-web)
68 #:use-module (gnu packages python-xyz)
69 #:use-module (gnu packages qt)
70 #:use-module (gnu packages serialization)
71 #:use-module (gnu packages ssh)
72 #:use-module (gnu packages textutils)
73 #:use-module (gnu packages xdisorg)
74 #:use-module (gnu packages xml)
75 #:use-module (gnu packages xorg)
76 #:use-module (srfi srfi-26))
77
78 (define-public tilda
79 (package
80 (name "tilda")
81 (version "1.4.1")
82 (source (origin
83 (method git-fetch)
84 (uri (git-reference
85 (url "https://github.com/lanoxx/tilda.git")
86 (commit (string-append "tilda-" version))))
87 (file-name (git-file-name name version))
88 (sha256
89 (base32
90 "154rsldqjv2m1bddisb930qicb0y35kx7bxq392n2hn68jr2pxkj"))))
91 (build-system glib-or-gtk-build-system)
92 (arguments
93 '(#:phases (modify-phases %standard-phases
94 (replace 'bootstrap
95 (lambda _
96 (setenv "NOCONFIGURE" "true")
97 (invoke "sh" "autogen.sh"))))))
98 (native-inputs
99 `(("autoconf" ,autoconf)
100 ("automake" ,automake)
101 ("gettext" ,gettext-minimal)
102 ("pkg-config" ,pkg-config)))
103 (inputs
104 `(("libconfuse" ,libconfuse)
105 ("vte" ,vte)))
106 (synopsis "GTK+-based drop-down terminal")
107 (description "Tilda is a terminal emulator similar to normal terminals like
108 gnome-terminal (GNOME) or Konsole (KDE), with the difference that it drops down
109 from the edge of a screen when a certain configurable hotkey is pressed. This
110 is similar to the built-in consoles in some applications. Tilda is highly
111 configurable through a graphical wizard.")
112 (home-page "https://github.com/lanoxx/tilda")
113 (license license:gpl2+)))
114
115 (define-public termite
116 (package
117 (name "termite")
118 (version "14")
119 (source
120 (origin
121 (method git-fetch)
122 (uri (git-reference
123 (url (string-append "https://github.com/thestinger/"
124 name ".git"))
125 (commit (string-append "v" version))
126 (recursive? #t)))
127 (file-name (string-append name "-" version "-checkout"))
128 (sha256
129 (base32
130 "0dmz9rpc2fdvcwhcmjnhb48ixn403gxpq03g334d1hgjw2hsyx7x"))))
131 (build-system gnu-build-system)
132 (arguments
133 `(#:phases
134 (modify-phases %standard-phases
135 (delete 'configure))
136 #:tests? #f
137 ;; This sets the destination when installing the necessary terminal
138 ;; capability data, which are not provided by 'ncurses'. See
139 ;; <https://lists.gnu.org/archive/html/bug-ncurses/2009-10/msg00031.html>.
140 #:make-flags (list "PREFIX="
141 (string-append "VERSION=v" (version))
142 (string-append "DESTDIR="
143 (assoc-ref %outputs "out")))))
144 (inputs
145 `(("vte" ,vte-ng)
146 ("gtk+" ,gtk+)
147 ("ncurses" ,ncurses)))
148 (native-inputs
149 `(("pkg-config" ,pkg-config)))
150
151 ;; FIXME: This should only be located in 'ncurses'. Nonetheless it is
152 ;; provided for usability reasons. See <https://bugs.gnu.org/22138>.
153 (native-search-paths
154 (list (search-path-specification
155 (variable "TERMINFO_DIRS")
156 (files '("share/terminfo")))))
157 (home-page "https://github.com/thestinger/termite/")
158 (synopsis "Keyboard-centric, VTE-based terminal")
159 (description "Termite is a minimal terminal emulator designed for use with
160 tiling window managers. It is a modal application, similar to Vim, with an
161 insert mode and command mode where keybindings have different functions.")
162
163 ;; Files under util/ are under the Expat license; the rest is LGPLv2+.
164 (license license:lgpl2.0+)))
165
166 (define-public asciinema
167 (package
168 (name "asciinema")
169 (version "1.4.0")
170 (source
171 (origin
172 (method url-fetch)
173 (uri (pypi-uri "asciinema" version))
174 (sha256
175 (base32
176 "1jrf8c8711gkdilmvyv3d37kp8xfvdc5cqighw5k92a6g9z4acgv"))))
177 (build-system python-build-system)
178 (arguments
179 `(#:phases
180 (modify-phases %standard-phases
181 (add-before 'build 'patch-exec-paths
182 (lambda* (#:key inputs #:allow-other-keys)
183 (let ((ncurses (assoc-ref inputs "ncurses")))
184 (substitute* "asciinema/recorder.py"
185 (("'tput'")
186 (string-append "'" ncurses "/bin/tput'"))))
187 #t)))))
188 (inputs `(("ncurses" ,ncurses)))
189 (native-inputs
190 ;; For tests.
191 `(("python-requests" ,python-requests)))
192 (home-page "https://asciinema.org")
193 (synopsis "Terminal session recorder")
194 (description
195 "Use asciinema to record and share your terminal sessions, the right way.
196 Forget screen recording apps and blurry video. Enjoy a lightweight, purely
197 text-based approach to terminal recording.")
198 (license license:gpl3)))
199
200 (define-public libtsm
201 (let ((commit "f70e37982f382b03c6939dac3d5f814450bda253")
202 (revision "1"))
203 (package
204 (name "libtsm")
205 (version (git-version "0.0.0" revision commit))
206 (source (origin
207 (method git-fetch)
208 ;; The freedesktop repository is no longer maintained.
209 (uri (git-reference
210 (url (string-append "https://github.com/Aetf/" name))
211 (commit commit)))
212 (sha256
213 (base32
214 "0mwn91i5h5d518i1s05y7hzv6bc13vzcvxszpfh77473iwg4wprx"))))
215 (build-system cmake-build-system)
216 (arguments
217 `(#:configure-flags '("-DBUILD_TESTING=ON")))
218 (native-inputs
219 `(("pkg-config" ,pkg-config)))
220 (inputs
221 `(("libxkbcommon" ,libxkbcommon)
222 ("check" ,check)))
223 (synopsis "Xterm state machine library")
224 (description "TSM is a state machine for DEC VT100-VT520 compatible
225 terminal emulators. It tries to support all common standards while keeping
226 compatibility to existing emulators like xterm, gnome-terminal, konsole, etc.")
227 (home-page "https://www.freedesktop.org/wiki/Software/libtsm")
228 ;; Hash table implementation is lgpl2.1+ licensed.
229 ;; The wcwidth implementation in external/wcwidth.{h,c} uses a license
230 ;; derived from ISC.
231 ;; UCS-4 to UTF-8 encoding is copied from "terminology" which is released
232 ;; under the bsd 2 license.
233 (license (list license:expat license:lgpl2.1+ license:isc license:bsd-2)))))
234
235 (define-public kmscon
236 (let ((commit "01dd0a231e2125a40ceba5f59fd945ff29bf2cdc")
237 (revision "1"))
238 (package
239 (name "kmscon")
240 (version (git-version "0.0.0" revision commit))
241 (source (origin
242 (method git-fetch)
243 ;; The freedesktop repository is no longer maintained.
244 (uri (git-reference
245 (url (string-append "https://github.com/Aetf/" name))
246 (commit commit)))
247 (sha256
248 (base32
249 "0q62kjsvy2iwy8adfiygx2bfwlh83rphgxbis95ycspqidg9py87"))
250 (patches
251 (search-patches "kmscon-runtime-keymap-switch.patch"))
252 (modules '((guix build utils)))))
253 (build-system gnu-build-system)
254 (arguments
255 `(;; The closure of MESA is huge so we'd rather avoid it.
256 #:disallowed-references (,mesa)
257
258 #:phases (modify-phases %standard-phases
259 (replace 'bootstrap
260 (lambda _
261 (setenv "NOCONFIGURE" "indeed")
262 (invoke "sh" "autogen.sh")))
263 ;; Use elogind instead of systemd.
264 (add-before 'configure 'remove-systemd
265 (lambda _
266 (substitute* "configure"
267 (("libsystemd-daemon libsystemd-login")
268 "libelogind"))
269 (substitute* "src/uterm_systemd.c"
270 (("#include <systemd/sd-login.h>")
271 "#include <elogind/sd-login.h>")
272 ;; We don't have this header.
273 (("#include <systemd/sd-daemon\\.h>")
274 "")
275 ;; Replace the call to 'sd_booted' by the truth value.
276 (("sd_booted\\(\\)")
277 "1")))))))
278 (native-inputs
279 `(("pkg-config" ,pkg-config)
280 ("autoconf" ,autoconf)
281 ("automake" ,automake)
282 ("libtool" ,libtool)
283 ("libxslt" ,libxslt) ;to build the man page
284 ("libxml2" ,libxml2) ;for XML_CATALOG_FILES
285 ("docbook-xsl" ,docbook-xsl)))
286 (inputs
287 `(("libdrm" ,libdrm)
288 ("libtsm" ,libtsm)
289 ("libxkbcommon" ,libxkbcommon)
290 ("logind" ,elogind)
291 ;; MESA can be used for accelerated video output via OpenGLESv2, but
292 ;; it's a bit dependency that we'd rather avoid in the installation
293 ;; image.
294 ;; ("mesa" ,mesa)
295 ("pango" ,pango)
296 ("udev" ,eudev)))
297 (synopsis "Linux KMS-based terminal emulator")
298 (description "Kmscon is a terminal emulator based on Linux's @dfn{kernel
299 mode setting} (KMS). It can replace the in-kernel virtual terminal (VT)
300 implementation with a user-space console. Compared to the Linux console,
301 kmscon provides enhanced features including XKB-compatible internationalized
302 keyboard support, UTF-8 input/font support, hardware-accelerated rendering,
303 multi-seat support, a replacement for @command{mingetty}, and more.")
304 (home-page "https://www.freedesktop.org/wiki/Software/kmscon")
305 ;; Hash table implementation is lgpl2.1+ licensed.
306 ;; The wcwidth implementation in external/wcwidth.{h,c} uses a license
307 ;; derived from ISC.
308 ;; UCS-4 to UTF-8 encoding is copied from "terminology" which is released
309 ;; under the bsd 2 license.
310 ;; Unifont-Font is from http://unifoundry.com/unifont.html and licensed
311 ;; under the terms of the GNU GPL.
312 (license (list license:expat license:lgpl2.1+ license:bsd-2
313 license:gpl2+))
314 (supported-systems (filter (cut string-suffix? "-linux" <>)
315 %supported-systems)))))
316
317 (define-public libtermkey
318 (package
319 (name "libtermkey")
320 (version "0.21.1")
321 (source (origin
322 (method url-fetch)
323 (uri (string-append "http://www.leonerd.org.uk/code/libtermkey/"
324 "libtermkey-" version ".tar.gz"))
325 (sha256
326 (base32 "0psd0kf10q5ixfima0mxz10syy7qq1ilz1npr0rz862xycvzgjyf"))))
327 (build-system gnu-build-system)
328 (arguments
329 '(#:make-flags (list
330 "CC=gcc"
331 (string-append "PREFIX=" (assoc-ref %outputs "out")))
332 #:phases (modify-phases %standard-phases
333 (delete 'configure)) ; no configure script
334 #:test-target "test"))
335 (inputs `(("ncurses" ,ncurses)))
336 (native-inputs `(("libtool" ,libtool)
337 ("perl-test-harness" ,perl-test-harness)
338 ("pkg-config" ,pkg-config)))
339 (synopsis "Keyboard entry processing library for terminal-based programs")
340 (description
341 "Libtermkey handles all the necessary logic to recognise special keys, UTF-8
342 combining, and so on, with a simple interface.")
343 (home-page "http://www.leonerd.org.uk/code/libtermkey")
344 (license license:expat)))
345
346 (define-public picocom
347 (package
348 (name "picocom")
349 (version "3.1")
350 (source (origin
351 (method git-fetch)
352 (uri (git-reference
353 (url "https://github.com/npat-efault/picocom.git")
354 (commit version)))
355 (file-name (git-file-name name version))
356 (sha256
357 (base32
358 "1vvjydqf0ax47nvdyyl67jafw5b3sfsav00xid6qpgia1gs2r72n"))))
359 (build-system gnu-build-system)
360 (arguments
361 `(#:make-flags '("CC=gcc")
362 #:tests? #f ; no tests
363 #:phases
364 (modify-phases %standard-phases
365 (delete 'configure) ; no configure script
366 (replace 'install
367 ;; The Makefile lacks an ‘install’ target.
368 (lambda* (#:key outputs #:allow-other-keys)
369 (let* ((out (assoc-ref outputs "out"))
370 (bin (string-append out "/bin"))
371 (man (string-append out "/share/man/man1")))
372 (install-file "picocom" bin)
373 (install-file "picocom.1" man)))))))
374 (home-page "https://github.com/npat-efault/picocom")
375 (synopsis "Minimal dumb-terminal emulator")
376 (description
377 "Picocom is a minimal dumb-terminal emulation program. It was designed to
378 serve as a simple and manual modem configuration, testing, and debugging tool.
379 It also serves well as a low-tech serial communications program to allow access
380 to all types of devices that provide serial consoles.")
381 (license license:gpl2+)))
382
383 (define-public beep
384 (package
385 (name "beep")
386 (version "1.4.4")
387 (source
388 (origin
389 (method git-fetch)
390 (uri (git-reference
391 ;; The original beep 1.3 at <http://www.johnath.com/beep> has been
392 ;; unmaintained for some time, and vulnerable to at least two CVEs:
393 ;; https://github.com/johnath/beep/issues/11#issuecomment-454056858
394 ;; Use this maintained fork instead.
395 (url "https://github.com/spkr-beep/beep.git")
396 (commit (string-append "v" version))))
397 (file-name (git-file-name name version))
398 (sha256
399 (base32 "1bk7g63qpiclbq20iz2x238by8s1b2iafdim7i6dq1i5n01s7lgx"))))
400 (build-system gnu-build-system)
401 (arguments
402 `(#:tests? #f ; no tests
403 #:make-flags
404 (list (string-append "prefix=" (assoc-ref %outputs "out"))
405 (string-append "pkgdocdir=$(docdir)/" ,name "-" ,version))
406 #:phases
407 (modify-phases %standard-phases
408 (delete 'configure)))) ; no configure script
409 (native-inputs
410 `(("gcc" ,gcc-8))) ; for ‘-fstack-clash-protection’
411 (synopsis "Linux command-line utility to control the PC speaker")
412 (description "beep allows the user to control the PC speaker with precision,
413 allowing different sounds to indicate different events. While it can be run
414 quite happily on the command line, its intended place of residence is within
415 scripts, notifying the user when something interesting occurs. Of course, it
416 has no notion of what's interesing, but it's very good at that notifying part.")
417 (home-page "https://github.com/spkr-beep/beep")
418 (license license:gpl2+)))
419
420 (define-public unibilium
421 (package
422 (name "unibilium")
423 (version "2.0.0")
424 (source
425 (origin
426 (method git-fetch)
427 (uri (git-reference
428 (url "https://github.com/mauke/unibilium.git")
429 (commit (string-append "v" version))))
430 (file-name (git-file-name name version))
431 (sha256
432 (base32
433 "1wa9a32wzqnxqh1jh554afj13dzjr6mw2wzqzw8d08nza9pg2ra2"))))
434 (build-system gnu-build-system)
435 (arguments
436 `(#:make-flags
437 (list "CC=gcc"
438 (string-append "PREFIX=" (assoc-ref %outputs "out")))
439 #:test-target "test"
440 ;; FIXME: tests require "prove"
441 #:tests? #f
442 #:phases
443 (modify-phases %standard-phases
444 (delete 'configure))))
445 (native-inputs
446 `(("libtool" ,libtool)
447 ("perl" ,perl)))
448 (home-page "https://github.com/mauke/unibilium")
449 (synopsis "Terminfo parsing library")
450 (description "Unibilium is a basic C terminfo library. It doesn't depend
451 on curses or any other library. It also doesn't use global variables, so it
452 should be thread-safe.")
453 (license license:lgpl3+)))
454
455 (define-public libvterm
456 (package
457 (name "libvterm")
458 (version "0+bzr681")
459 (source
460 (origin
461 (method url-fetch)
462 (uri (string-append "http://www.leonerd.org.uk/code/libvterm/"
463 "libvterm-" version ".tar.gz"))
464 (sha256
465 (base32
466 "1s56c8p1qz6frkcri0hg4qyydv2wcccj6n2xmz1dwcdqn38ldsmb"))))
467 (build-system gnu-build-system)
468 (arguments
469 `(#:make-flags
470 (list "CC=gcc"
471 (string-append "PREFIX=" (assoc-ref %outputs "out")))
472 #:test-target "test"
473 #:phases
474 (modify-phases %standard-phases
475 (delete 'configure))))
476 (native-inputs
477 `(("libtool" ,libtool)
478 ("perl" ,perl)))
479 (home-page "http://www.leonerd.org.uk/code/libvterm/")
480 (synopsis "VT220/xterm/ECMA-48 terminal emulator library")
481 (description "Libvterm is an abstract C99 library which implements a VT220
482 or xterm-like terminal emulator. It doesn't use any particular graphics
483 toolkit or output system, instead it invokes callback function pointers that
484 its embedding program should provide it to draw on its behalf. It avoids
485 calling @code{malloc} during normal running state, allowing it to be used in
486 embedded kernel situations.")
487 (license license:expat)))
488
489 (define-public cool-retro-term
490 (let ((commit "1.1.1")
491 (revision "0")) ;not used currently
492 (package
493 (name "cool-retro-term")
494 (version "1.1.1")
495 (source (origin
496 (method git-fetch)
497 (file-name (string-append name "-" version "-checkout"))
498 (uri (git-reference
499 (url (string-append "https://github.com/Swordfish90/" name))
500 (commit commit)
501 (recursive? #t)))
502 (sha256
503 (base32 "0wb6anchxa5jpn9c73kr4byrf2xlj8x8qzc5x7ny6saj7kbbvp75"))
504 (modules '((guix build utils)
505 (srfi srfi-1)
506 (srfi srfi-26)
507 (ice-9 rdelim)
508 (ice-9 regex)))
509 (snippet
510 '(let* ((fonts '(;"1971-ibm-3278" ; BSD 3-clause
511 "1977-apple2" ; Non-Free
512 "1977-commodore-pet" ; Non-Free
513 "1979-atari-400-800" ; Non-Free
514 ;"1981-ibm-pc ; CC-SA 4.0
515 "1982-commodore64")) ; Non-Free
516 ;"1985-ibm-pc-vga" ; CC-SA 4.0
517 ;"modern-fixedsys-excelsior" ; Redistributable
518 ;"modern-hermit" ; SIL
519 ;"modern-inconsolata"; SIL
520 ;"modern-pro-font-win-tweaked" ; X11
521 ;"modern-proggy-tiny"; X11
522 ;"modern-terminus" ; SIL
523 (name-rx (make-regexp " *name: *\"([^\"]*)\""))
524 (source-rx (make-regexp " *source: \"fonts/([^/]*)[^\"]*\""))
525 (fontname-rx (make-regexp "\"fontName\":\"([^\"]*).*"))
526 (names
527 ;; Gather font names from all Fonts*.qml files.
528 ;; These will be used to remove items from the
529 ;; default profiles.
530 (fold
531 (lambda (font-file names)
532 (call-with-input-file font-file
533 (lambda (port)
534 (let loop ((name #f) (names names))
535 (let ((line (read-line port)))
536 (cond
537 ((eof-object? line) (pk 'names names))
538 ((regexp-exec name-rx line)
539 => (lambda (m)
540 (loop (match:substring m 1) names)))
541 ((regexp-exec source-rx line)
542 => (lambda (m)
543 (let ((font (match:substring m 1)))
544 (if (member font fonts)
545 (loop #f (lset-adjoin string=?
546 names name))
547 (loop #f names)))))
548 (else (loop name names))))))))
549 '() (find-files "app/qml" "Font.*\\.qml"))))
550 ;; Remove the font files themselves
551 (for-each (lambda (font)
552 (delete-file-recursively
553 (string-append "app/qml/fonts/" font)))
554 fonts)
555 ;; Remove mention of those fonts in the source
556 (substitute* "app/qml/resources.qrc"
557 (((string-append " *<file>fonts/("
558 (string-join fonts "|")
559 ").*"))
560 ""))
561 (for-each
562 (lambda (file)
563 (let ((start-rx (make-regexp " *ListElement\\{"))
564 (end-rx (make-regexp " *\\}")))
565 (with-atomic-file-replacement file
566 (lambda (in out)
567 (let loop ((line-buffer '())
568 (hold? #f)
569 (discard? #f))
570 (let ((line (read-line in 'concat)))
571 (cond
572 ((eof-object? line) #t) ;done
573 ((regexp-exec start-rx line)
574 (loop (cons line line-buffer) #t #f))
575 ((or (regexp-exec source-rx line)
576 (regexp-exec fontname-rx line))
577 => (lambda (m)
578 (let ((font-or-name (match:substring m 1)))
579 (if (or (member font-or-name fonts)
580 (member font-or-name names))
581 (loop '() #f #t)
582 (loop (cons line line-buffer)
583 hold? #f)))))
584 ((regexp-exec end-rx line)
585 (unless discard?
586 (for-each (cut display <> out)
587 (reverse line-buffer))
588 (display line out))
589 (loop '() #f #f))
590 (hold? (loop (cons line line-buffer)
591 hold? discard?))
592 (discard? (loop line-buffer #f #t))
593 (else (display line out)
594 (loop '() #f #f)))))))))
595 '("app/qml/FontPixels.qml"
596 "app/qml/FontScanlines.qml"
597 "app/qml/Fonts.qml"
598 "app/qml/ApplicationSettings.qml"))
599 ;; Final substitution for default scanline and pixel fonts
600 (substitute* "app/qml/ApplicationSettings.qml"
601 (("COMMODORE_PET") "PROGGY_TINY"))
602 #t))))
603 (build-system gnu-build-system)
604 (inputs
605 `(("qtbase" ,qtbase)
606 ("qtdeclarative" ,qtdeclarative)
607 ("qtgraphicaleffects" ,qtgraphicaleffects)
608 ("qtquickcontrols" ,qtquickcontrols)))
609 (arguments
610 `(#:phases
611 (modify-phases %standard-phases
612 (replace 'configure
613 (lambda* (#:key outputs #:allow-other-keys)
614 (let ((out (assoc-ref outputs "out")))
615 (substitute* '("qmltermwidget/qmltermwidget.pro")
616 (("INSTALL_DIR = \\$\\$\\[QT_INSTALL_QML\\]")
617 (string-append "INSTALL_DIR = " out "/lib/qt5/qml")))
618 (substitute* '("cool-retro-term.pro" "app/app.pro")
619 (("/usr") out))
620 (invoke "qmake"))))
621 (add-after 'install 'wrap-executable
622 (lambda* (#:key inputs outputs #:allow-other-keys)
623 (let ((out (assoc-ref outputs "out"))
624 (qml "/lib/qt5/qml"))
625 (wrap-program (string-append out "/bin/cool-retro-term")
626 `("QML2_IMPORT_PATH" ":" prefix
627 (,(string-append out qml)
628 ,@(map (lambda (i)
629 (string-append (assoc-ref inputs i) qml))
630 '("qtdeclarative"
631 "qtgraphicaleffects"
632 "qtquickcontrols")))))
633 #t)))
634 (add-after 'install 'add-alternate-name
635 (lambda* (#:key outputs #:allow-other-keys)
636 (let ((bin (string-append (assoc-ref outputs "out") "/bin")))
637 (symlink (string-append bin "/cool-retro-term")
638 (string-append bin "/crt"))
639 #t)))
640 (add-after 'install 'install-man
641 (lambda* (#:key outputs #:allow-other-keys)
642 (let ((mandir (string-append (assoc-ref outputs "out")
643 "/share/man/man1")))
644 (install-file "packaging/debian/cool-retro-term.1" mandir)
645 #t))))))
646 (synopsis "Terminal emulator")
647 (description
648 "Cool-retro-term (crt) is a terminal emulator which mimics the look and
649 feel of the old cathode ray tube (CRT) screens. It has been designed to be
650 eye-candy, customizable, and reasonably lightweight.")
651 (home-page "https://github.com/Swordfish90/cool-retro-term")
652 (license (list
653 license:gpl2+ ; qmltermwidget
654 license:gpl3+ ; cool-retro-term
655 ;; Fonts
656 license:silofl1.1
657 license:x11
658 license:bsd-3)))))
659
660 (define-public sakura
661 (package
662 (name "sakura")
663 (version "3.6.0")
664 (source (origin
665 (method url-fetch)
666 (uri (string-append "https://launchpad.net/" name "/trunk/"
667 version "/+download/" name "-" version
668 ".tar.bz2"))
669 (sha256
670 (base32
671 "1q463qm41ym7jb3kbzjz7b6x549vmgkb70arpkhsf86yxly1y5m1"))))
672 (build-system cmake-build-system)
673 (arguments
674 '(#:tests? #f)) ; no check phase
675 (native-inputs
676 `(("gettext" ,gettext-minimal)
677 ("perl" ,perl) ; for pod2man
678 ("pkg-config" ,pkg-config)))
679 (inputs
680 `(("libxft" ,libxft)
681 ("vte" ,vte)))
682 (home-page "https://launchpad.net/sakura")
683 (synopsis "A simple but powerful libvte-based terminal emulator")
684 (description "@code{Sakura} is a terminal emulator based on GTK+ and VTE.
685 It's a terminal emulator with few dependencies, so you don't need a full GNOME
686 desktop installed to have a decent terminal emulator.")
687 (license license:gpl2)))
688
689 (define-public go-github.com-nsf-termbox-go
690 (let ((commit "4ed959e0540971545eddb8c75514973d670cf739")
691 (revision "0"))
692 (package
693 (name "go-github.com-nsf-termbox-go")
694 (version (git-version "0.0.0" revision commit))
695 (source (origin
696 (method git-fetch)
697 (uri (git-reference
698 (url "https://github.com/nsf/termbox-go.git")
699 (commit commit)))
700 (file-name (git-file-name name version))
701 (sha256
702 (base32
703 "1vx64i1mg660if3wwm81p4b7lzxfb3qbr39i7misdyld3fc486p9"))))
704 (build-system go-build-system)
705 (arguments
706 '(#:import-path "github.com/nsf/termbox-go"))
707 (propagated-inputs
708 `(("go-github.com-mattn-go-runewidth"
709 ,go-github.com-mattn-go-runewidth)))
710 (synopsis "@code{termbox} provides a minimal API for text-based user
711 interfaces")
712 (description
713 "Termbox is a library that provides a minimalistic API which allows the
714 programmer to write text-based user interfaces.")
715 (home-page "https://github.com/nsf/termbox-go")
716 (license license:expat))))
717
718 (define-public go-golang.org-x-crypto-ssh-terminal
719 (let ((commit "c78caca803c95773f48a844d3dcab04b9bc4d6dd")
720 (revision "0"))
721 (package
722 (name "go-golang.org-x-crypto-ssh-terminal")
723 (version (git-version "0.0.0" revision commit))
724 (source (origin
725 (method git-fetch)
726 (uri (git-reference
727 (url "https://go.googlesource.com/crypto")
728 (commit commit)))
729 (file-name (git-file-name name version))
730 (sha256
731 (base32
732 "0vxlfxr9y681yn2cfh6dbqmq35vvq4f45ay0mm31ffkny9cms0y4"))))
733 (build-system go-build-system)
734 (arguments
735 '(#:import-path "golang.org/x/crypto/ssh/terminal"
736 #:unpack-path "golang.org/x/crypto"
737 #:phases
738 (modify-phases %standard-phases
739 (add-before 'reset-gzip-timestamps 'make-gzip-archive-writable
740 (lambda* (#:key outputs #:allow-other-keys)
741 (map (lambda (file)
742 (make-file-writable file))
743 (find-files
744 (string-append (assoc-ref outputs "out")
745 "/src/golang.org/x/crypto/ed25519/testdata")
746 ".*\\.gz$"))
747 #t)))))
748 (synopsis "Support functions for dealing with terminals in Go")
749 (description "@code{terminal} provides support functions for dealing
750 with terminals in Go.")
751 (home-page "https://go.googlesource.com/crypto/")
752 (license license:bsd-3))))
753
754 (define-public go-github.com-howeyc-gopass
755 (let ((commit "bf9dde6d0d2c004a008c27aaee91170c786f6db8")
756 (revision "0"))
757 (package
758 (name "go-github.com-howeyc-gopass")
759 (version (git-version "0.0.0" revision commit))
760 (source (origin
761 (method git-fetch)
762 (uri (git-reference
763 (url "https://github.com/howeyc/gopass.git")
764 (commit commit)))
765 (file-name (git-file-name name version))
766 (sha256
767 (base32
768 "1jxzyfnqi0h1fzlsvlkn10bncic803bfhslyijcxk55mgh297g45"))))
769 (build-system go-build-system)
770 (arguments
771 '(#:import-path "github.com/howeyc/gopass"))
772 (propagated-inputs
773 `(("go-golang.org-x-crypto-ssh-terminal"
774 ,go-golang.org-x-crypto-ssh-terminal)))
775 (synopsis "Retrieve password from a terminal or piped input in Go")
776 (description
777 "@code{gopass} is a Go package for retrieving a password from user
778 terminal or piped input.")
779 (home-page "https://github.com/howeyc/gopass")
780 (license license:isc))))
781
782 (define-public python-pyte
783 (package
784 (name "python-pyte")
785 (version "0.7.0")
786 (source
787 (origin
788 (method url-fetch)
789 (uri (pypi-uri "pyte" version))
790 (sha256
791 (base32
792 "1an54hvyjm8gncx8cgabz9mkpgjkdb0bkyjlkh7g7f94nr3wnfl7"))))
793 (build-system python-build-system)
794 (arguments
795 '(#:phases
796 (modify-phases %standard-phases
797 (add-after 'unpack 'remove-failing-test
798 ;; TODO: Reenable when the `captured` files required by this test
799 ;; are included in the archive.
800 (lambda _
801 (delete-file "tests/test_input_output.py")
802 #t)))))
803 (propagated-inputs
804 `(("python-wcwidth" ,python-wcwidth)))
805 (native-inputs
806 `(("python-pytest-runner" ,python-pytest-runner)
807 ("python-pytest" ,python-pytest)))
808 (home-page "https://pyte.readthedocs.io/")
809 (synopsis "Simple VTXXX-compatible terminal emulator")
810 (description "@code{pyte} is an in-memory VTxxx-compatible terminal
811 emulator. @var{VTxxx} stands for a series of video terminals, developed by
812 DEC between 1970 and 1995. The first and probably most famous one was the
813 VT100 terminal, which is now a de-facto standard for all virtual terminal
814 emulators.
815
816 pyte is a fork of vt102, which was an incomplete pure Python implementation
817 of VT100 terminal.")
818 (license license:lgpl3+)))
819
820 (define-public python2-pyte
821 (package-with-python2 python-pyte))
822
823 (define-public python-blessings
824 (package
825 (name "python-blessings")
826 (version "1.6.1")
827 (source
828 (origin
829 (method url-fetch)
830 (uri (pypi-uri "blessings" version))
831 (sha256
832 (base32
833 "1smngy65p8mi62lgm04icasx22v976szhs2aq95y2ljmi1srb4bl"))))
834 (build-system python-build-system)
835 (arguments
836 ;; TODO: For py3, 2to2 is used to convert the code, but test-suite fails
837 `(#:tests? #f))
838 (native-inputs
839 `(("python-nose" ,python-nose)))
840 (home-page "https://github.com/erikrose/blessings")
841 (synopsis "Python module to manage terminal color, styling, and
842 positioning")
843 (description "Blessings is a pythonic API to manipulate terminal color,
844 styling, and positioning. It provides similar features to curses but avoids
845 some of curses’s limitations: it does not require clearing the whole screen
846 for little changes, provides a scroll-back buffer after the program exits, and
847 avoids styling altogether when the output is redirected to something other
848 than a terminal.")
849 (license license:expat)))
850
851 (define-public python2-blessings
852 (package-with-python2 python-blessings))
853
854 (define-public python-curtsies
855 (package
856 (name "python-curtsies")
857 (version "0.2.11")
858 (source
859 (origin
860 (method url-fetch)
861 (uri (pypi-uri "curtsies" version))
862 (sha256
863 (base32
864 "1vljmw3sy6lrqahhpyg4gk13mzcx3mwhvg8s41698ms3cpgkjipc"))))
865 (build-system python-build-system)
866 (arguments
867 `(#:phases
868 (modify-phases %standard-phases
869 (replace 'check
870 (lambda _
871 (invoke "nosetests" "-v"))))))
872 (propagated-inputs
873 `(("python-blessings" ,python-blessings)
874 ("python-wcwidth" ,python-wcwidth)))
875 (native-inputs
876 `(("python-mock" ,python-mock)
877 ("python-pyte" ,python-pyte)
878 ("python-nose" ,python-nose)))
879 (home-page "https://github.com/thomasballinger/curtsies")
880 (synopsis "Library for curses-like terminal interaction with colored
881 strings")
882 (description "Curtsies is a Python library for interacting with the
883 terminal. It features string-like objects which carry formatting information,
884 per-line fullscreen terminal rendering, and keyboard input event reporting.")
885 (license license:expat)))
886
887 (define-public python2-curtsies
888 (package-with-python2 python-curtsies))
889
890 (define-public tmate
891 (package
892 (name "tmate")
893 (version "2.2.1")
894 (source
895 (origin
896 (method git-fetch)
897 (uri (git-reference
898 (url "https://github.com/tmate-io/tmate.git")
899 (commit version)))
900 (file-name (git-file-name name version))
901 (sha256
902 (base32
903 "0pfl9vrswzim9ydi1n652h3rax2zrmy6sqkp0r09yy3lw83h4y1r"))))
904 (build-system gnu-build-system)
905 (inputs
906 `(("libevent" ,libevent)
907 ("libssh" ,libssh)
908 ("msgpack" ,msgpack)
909 ("ncurses" ,ncurses)))
910 (native-inputs
911 `(("autoconf" ,autoconf)
912 ("automake" ,automake)
913 ("pkg-config" ,pkg-config)))
914 (home-page "https://tmate.io/")
915 (synopsis "Terminal sharing application")
916 (description "tmate is a terminal sharing application that allows you to
917 share your terminal with other users over the Internet. tmate is a fork of
918 tmux.")
919 (license license:isc)))
920
921 (define-public kitty
922 (package
923 (name "kitty")
924 (version "0.13.3")
925 (home-page "https://sw.kovidgoyal.net/kitty/")
926 (source
927 (origin
928 (method git-fetch)
929 (uri (git-reference
930 (url "https://github.com/kovidgoyal/kitty.git")
931 (commit (string-append "v" version))))
932 (file-name (git-file-name name version))
933 (sha256
934 (base32
935 "1y0vd75j8g61jdj8miml79w5ri3pqli5rv9iq6zdrxvzfa4b2rmb"))
936 (modules '((guix build utils)))
937 (snippet
938 '(begin
939 ;; patch needed as sphinx-build is used as a python script
940 ;; whereas the guix package uses a bash script launching the
941 ;; python script
942 (substitute* "docs/conf.py"
943 (("(from kitty.constants import str_version)" kitty-imp)
944 (string-append "sys.path.append(\"..\")\n" kitty-imp)))
945 (substitute* "docs/Makefile"
946 (("^SPHINXBUILD[[:space:]]+= (python3.*)$")
947 "SPHINXBUILD = sphinx-build\n"))
948 #t))))
949 (build-system gnu-build-system)
950 (inputs
951 `(("python" ,python)
952 ("harfbuzz" ,harfbuzz)
953 ("zlib" ,zlib)
954 ("libpng" ,libpng)
955 ("freetype" ,freetype)
956 ("fontconfig" ,fontconfig)
957 ("pygments" ,python-pygments)
958 ("wayland" ,wayland)))
959 (native-inputs
960 `(("pkg-config" ,pkg-config)
961 ("libxrandr" ,libxrandr)
962 ("libdbus" ,dbus)
963 ("libxcursor" ,libxcursor)
964 ("libxi" ,libxi)
965 ("libxinerama" ,libxinerama)
966 ("libgl1-mesa" ,mesa)
967 ("libxkbcommon" ,libxkbcommon)
968 ("sphinx" ,python-sphinx)
969 ("ncurses" ,ncurses) ;; for tic command
970 ("wayland-protocols" ,wayland-protocols)))
971 (arguments
972 '(#:phases (modify-phases %standard-phases
973 (delete 'configure)
974 ;; Wayland backend requires EGL, which isn't found
975 ;; out-of-the-box for some reason. Hard-code it instead.
976 (add-after 'unpack 'hard-code-libegl
977 (lambda _
978 (let* ((mesa (assoc-ref %build-inputs "libgl1-mesa"))
979 (libegl (string-append mesa "/lib/libEGL.so.1")))
980 (substitute* "glfw/egl_context.c"
981 (("libEGL.so.1") libegl)))
982 #t))
983 (replace 'build
984 (lambda _
985 (invoke "python3" "setup.py" "linux-package")))
986 (replace 'check
987 (lambda _
988 (invoke "python3" "setup.py" "test")))
989 (add-before 'install 'rm-pycache
990 ;; created python cache __pycache__ are non deterministic
991 (lambda _
992 (let ((pycaches (find-files "linux-package/"
993 "__pycache__"
994 #:directories? #t)))
995 (for-each delete-file-recursively pycaches)
996 #t)))
997 (replace 'install
998 (lambda _
999 (let* ((out (assoc-ref %outputs "out"))
1000 (obin (string-append out "/bin"))
1001 (olib (string-append out "/lib"))
1002 (oshare (string-append out "/share")))
1003 (copy-recursively "linux-package/bin" obin)
1004 (copy-recursively "linux-package/share" oshare)
1005 (copy-recursively "linux-package/lib" olib)
1006 #t))))))
1007 (synopsis "Fast, featureful, GPU based terminal emulator")
1008 (description "Kitty is a fast and featureful GPU-based terminal emulator:
1009 @itemize
1010 @item Offloads rendering to the GPU for lower system load and buttery smooth
1011 scrolling. Uses threaded rendering to minimize input latency.
1012 @item Supports all modern terminal features: graphics (images), unicode,
1013 true-color, OpenType ligatures, mouse protocol, focus tracking, bracketed
1014 paste and several new terminal protocol extensions.
1015 @item Supports tiling multiple terminal windows side by side in different
1016 layouts without needing to use an extra program like tmux.
1017 @item Can be controlled from scripts or the shell prompt, even over SSH.
1018 @item Has a framework for Kittens, small terminal programs that can be used to
1019 extend kitty's functionality. For example, they are used for Unicode input,
1020 hints, and side-by-side diff.
1021 @item Supports startup sessions which allow you to specify the window/tab
1022 layout, working directories and programs to run on startup.
1023 @item Allows you to open the scrollback buffer in a separate window using
1024 arbitrary programs of your choice. This is useful for browsing the history
1025 comfortably in a pager or editor.
1026 @end itemize")
1027 (license license:gpl3+)))
1028
1029 (define-public eternalterminal
1030 (package
1031 (name "eternalterminal")
1032 (version "5.1.9")
1033 (source
1034 (origin
1035 (method git-fetch)
1036 (uri (git-reference
1037 (url "https://github.com/MisterTea/EternalTerminal.git")
1038 (commit (string-append "et-v" version))))
1039 (file-name (git-file-name name version))
1040 (sha256
1041 (base32
1042 "07ynkcnk3z6wafdlnzdxcd308cw1rzabxyq47ybj79lyji3wsgk7"))))
1043 (build-system cmake-build-system)
1044 (arguments
1045 '(#:configure-flags '("-DBUILD_TEST=ON")
1046 #:phases
1047 (modify-phases %standard-phases
1048 (add-after 'unpack 'insert-googletests
1049 (lambda* (#:key inputs #:allow-other-keys)
1050 (let ((tests (assoc-ref inputs "googletest")))
1051 (copy-recursively tests "external/googletest"))
1052 #t))
1053 (add-after 'install 'dont-provide-gtest-libraries
1054 (lambda* (#:key outputs #:allow-other-keys)
1055 (let ((out (assoc-ref outputs "out")))
1056 (delete-file-recursively (string-append out "/include"))
1057 (delete-file-recursively (string-append out "/lib")))
1058 #t)))))
1059 (inputs
1060 `(("gflags" ,gflags)
1061 ("libsodium" ,libsodium)
1062 ("protobuf" ,protobuf)))
1063 (native-inputs
1064 `(("googletest" ,(package-source googletest))))
1065 (home-page "https://mistertea.github.io/EternalTerminal/")
1066 (synopsis "Remote shell that reconnects without interrupting the session")
1067 (description "@dfn{Eternal Terminal} (ET) is a remote shell that
1068 automatically reconnects without interrupting the session. ET uses SSH to
1069 initialize a secure connection. Unlike SSH sessions, which must be killed and
1070 reconnected after a network outage an ET session will survive network outages
1071 and IP roaming. ET provides the same core functionality as @command{mosh},
1072 while also supporting native scrolling and @command{tmux} control mode
1073 (@code{tmux -CC}).")
1074 (license license:asl2.0)))