gnu: cvs-fast-export: Update to 1.56.
[jackhill/guix/guix.git] / gnu / packages / readline.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages readline)
24 #:use-module (guix licenses)
25 #:use-module (gnu packages)
26 #:use-module (gnu packages ncurses)
27 #:use-module (gnu packages perl)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix utils)
32 #:use-module (ice-9 format))
33
34 (define (patch-url version seqno)
35 (format #f "mirror://gnu/readline/readline-~a-patches/readline~a-~3,'0d"
36 version (string-join (string-split version #\.) "") seqno))
37
38 (define (readline-patch version seqno sha256-bv)
39 "Return the origin of Readline patch SEQNO, with expected hash SHA256-BV"
40 (origin
41 (method url-fetch)
42 (uri (patch-url version seqno))
43 (sha256 sha256-bv)))
44
45 (define-syntax-rule (patch-series version (seqno hash) ...)
46 (list (readline-patch version seqno (base32 hash))
47 ...))
48
49 (define %patch-series-8.0
50 (patch-series
51 "8.0"
52 (1 "0sfh7wn0pr743xspnb1zndxndlv9rc0hcg14cbw5cmyg6f4ykrfq")
53 (2 "1xy8mv8xm8hsfixwp3ci9kfx3dii3y92cq27wwd0jq75y6zzxc1n")
54 (3 "1vza7sxjcsr2z295ij12nzgncdil1vb6as3mqy4m7svi1chv5pcl")
55 (4 "0k1rfx9w32lglxg564yvp0mw6jg6883p8ac2f2lxxqpf80m3vami")))
56
57 (define %patch-series-7.0
58 (patch-series
59 "7.0"
60 (1 "0xm3sxvwmss7ddyfb11n6pgcqd1aglnpy15g143vzcf75snb7hcs")
61 (2 "0n1dxmqsbjgrfxb1hgk5c6lsraw4ncbnzxlsx7m35nym6lncjiw7")
62 (3 "1027kmymniizcy0zbdlrczxfx3clxcdln5yq05q9yzlc6y9slhwy")
63 (4 "0r3bbaf12iz8m02z6p3fzww2m365fhn71xmzab2p62gj54s6h9gr")
64 (5 "0lxpa4f72y2nsgj6fgrhjk2nmmxvccys6aciwfxwchb5f21rq5fa")))
65
66 (define-public readline
67 (package
68 (name "readline")
69 (version (string-append "8.0."
70 (number->string (length %patch-series-8.0))))
71 (source (origin
72 (method url-fetch)
73 (uri (string-append "mirror://gnu/readline/readline-"
74 (version-major+minor version) ".tar.gz"))
75 (sha256
76 (base32
77 "0qg4924hf4hg0r0wbx2chswsr08734536fh5iagkd3a7f4czafg3"))
78 (patches (append %patch-series-8.0
79 (search-patches "readline-link-ncurses.patch")))
80 (patch-flags '("-p0"))))
81 (build-system gnu-build-system)
82 (propagated-inputs `(("ncurses" ,ncurses)))
83 (arguments `(#:configure-flags
84 (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
85 (assoc-ref %build-inputs "ncurses")
86 "/lib")
87
88 ;; This test does an 'AC_TRY_RUN', which aborts when
89 ;; cross-compiling, so provide the correct answer.
90 ,@(if (%current-target-system)
91 '("bash_cv_wcwidth_broken=no")
92 '())
93 ;; MinGW: ncurses provides the termcap api.
94 ,@(if (target-mingw?)
95 '("bash_cv_termcap_lib=ncurses")
96 '()))
97
98 ,@(if (target-mingw?)
99 ;; MinGW: termcap in ncurses
100 ;; some SIG_* #defined in _POSIX
101 '(#:make-flags '("TERMCAP_LIB=-lncurses"
102 "CPPFLAGS=-D_POSIX -D'chown(f,o,g)=0'"))
103 '())))
104 (synopsis "Edit command lines while typing, with history support")
105 (description
106 "The GNU readline library allows users to edit command lines as they
107 are typed in. It can maintain a searchable history of previously entered
108 commands, letting you easily recall, edit and re-enter past commands. It
109 features both Emacs-like and vi-like keybindings, making its usage
110 comfortable for anyone.")
111 (license gpl3+)
112 (home-page "https://savannah.gnu.org/projects/readline/")))
113
114 (define-public readline-7
115 (package (inherit readline)
116 (name "readline")
117 (version (string-append "7.0."
118 (number->string (length %patch-series-7.0))))
119 (source (origin
120 (method url-fetch)
121 (uri (string-append "mirror://gnu/readline/readline-"
122 (version-major+minor version) ".tar.gz"))
123 (sha256
124 (base32
125 "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm"))
126 (patches (append
127 %patch-series-7.0
128 (search-patches "readline-link-ncurses.patch")))
129 (patch-flags '("-p0"))))))
130
131 (define-public readline-6.2
132 (package (inherit readline)
133 (version "6.2")
134 (source (origin (inherit (package-source readline))
135 (method url-fetch)
136 (uri (string-append "mirror://gnu/readline/readline-"
137 version ".tar.gz"))
138 (patches (search-patches "readline-6.2-CVE-2014-2524.patch"))
139 (patch-flags '("-p0"))
140 (sha256
141 (base32
142 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))))))
143
144 (define-public rlwrap
145 (package
146 (name "rlwrap")
147 (version "0.43")
148 (source
149 (origin
150 (method url-fetch)
151 (uri (string-append "https://github.com/hanslub42/rlwrap/releases/"
152 "download/v" version "/"
153 name "-" version ".tar.gz"))
154 (sha256
155 (base32
156 "0bzb7ylk2770iv59v2d0gypb21y2xn87m299s9rqm6rdi2vx11lf"))))
157 (build-system gnu-build-system)
158 (native-inputs
159 `(("perl" ,perl)))
160 (inputs
161 `(("readline" ,readline)))
162 (synopsis "Wrapper to allow the editing of keyboard commands")
163 (description
164 "Rlwrap is a 'readline wrapper', a small utility that uses the GNU
165 readline library to allow the editing of keyboard input for any command. You
166 should consider rlwrap especially when you need user-defined completion (by way
167 of completion word lists) and persistent history, or if you want to program
168 'special effects' using the filter mechanism.")
169 (home-page "https://github.com/hanslub42/rlwrap")
170 (license gpl2+)))