gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / readline.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
ce0be567 2;;; Copyright © 2012, 2013, 2014, 2020 Ludovic Courtès <ludo@gnu.org>
2cb4f940 3;;; Copyright © 2016, 2019 Efraim Flashner <efraim@flashner.co.il>
ae12d586 4;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
f1fac6b8 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
d7316c77 6;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
c44899a2 7;;;
233e7676 8;;; This file is part of GNU Guix.
c44899a2 9;;;
233e7676 10;;; GNU Guix is free software; you can redistribute it and/or modify it
c44899a2
LC
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;;;
233e7676 15;;; GNU Guix is distributed in the hope that it will be useful, but
c44899a2
LC
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
233e7676 21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
c44899a2 22
1ffa7090 23(define-module (gnu packages readline)
4a44e743 24 #:use-module (guix licenses)
59a43334 25 #:use-module (gnu packages)
1ffa7090 26 #:use-module (gnu packages ncurses)
a2285798 27 #:use-module (gnu packages perl)
c44899a2 28 #:use-module (guix packages)
87f5d366 29 #:use-module (guix download)
ae12d586 30 #:use-module (guix build-system gnu)
371193ec
MB
31 #:use-module (guix utils)
32 #:use-module (ice-9 format))
33
f7511ff1
MB
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))
371193ec 37
ce0be567
LC
38(define (readline-patch version seqno sha256-bv)
39 "Return the origin of Readline patch SEQNO, with expected hash SHA256-BV"
371193ec
MB
40 (origin
41 (method url-fetch)
f7511ff1 42 (uri (patch-url version seqno))
ce0be567 43 (sha256 sha256-bv)))
371193ec 44
f7511ff1
MB
45(define-syntax-rule (patch-series version (seqno hash) ...)
46 (list (readline-patch version seqno (base32 hash))
371193ec
MB
47 ...))
48
d7316c77
MB
49(define %patch-series-8.0
50 (patch-series
51 "8.0"
d317d3df
MB
52 (1 "0sfh7wn0pr743xspnb1zndxndlv9rc0hcg14cbw5cmyg6f4ykrfq")
53 (2 "1xy8mv8xm8hsfixwp3ci9kfx3dii3y92cq27wwd0jq75y6zzxc1n")
54 (3 "1vza7sxjcsr2z295ij12nzgncdil1vb6as3mqy4m7svi1chv5pcl")
55 (4 "0k1rfx9w32lglxg564yvp0mw6jg6883p8ac2f2lxxqpf80m3vami")))
d7316c77 56
371193ec
MB
57(define %patch-series-7.0
58 (patch-series
f7511ff1 59 "7.0"
371193ec
MB
60 (1 "0xm3sxvwmss7ddyfb11n6pgcqd1aglnpy15g143vzcf75snb7hcs")
61 (2 "0n1dxmqsbjgrfxb1hgk5c6lsraw4ncbnzxlsx7m35nym6lncjiw7")
463ad503
MB
62 (3 "1027kmymniizcy0zbdlrczxfx3clxcdln5yq05q9yzlc6y9slhwy")
63 (4 "0r3bbaf12iz8m02z6p3fzww2m365fhn71xmzab2p62gj54s6h9gr")
64 (5 "0lxpa4f72y2nsgj6fgrhjk2nmmxvccys6aciwfxwchb5f21rq5fa")))
c44899a2
LC
65
66(define-public readline
a850cbdd
MB
67 (package
68 (name "readline")
d7316c77
MB
69 (version (string-append "8.0."
70 (number->string (length %patch-series-8.0))))
a850cbdd
MB
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
2cb4f940 77 "0qg4924hf4hg0r0wbx2chswsr08734536fh5iagkd3a7f4czafg3"))
d7316c77
MB
78 (patches (append %patch-series-8.0
79 (search-patches "readline-link-ncurses.patch")))
a850cbdd
MB
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")
f6d47eb6 87
a850cbdd
MB
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 '()))
4500581a 97
a850cbdd
MB
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
a22dc0c4
LC
107are typed in. It can maintain a searchable history of previously entered
108commands, letting you easily recall, edit and re-enter past commands. It
109features both Emacs-like and vi-like keybindings, making its usage
110comfortable for anyone.")
a850cbdd
MB
111 (license gpl3+)
112 (home-page "https://savannah.gnu.org/projects/readline/")))
50322c84 113
2cb4f940
EF
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
50322c84
LC
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"))
d9721bcf
LF
138 (patches (search-patches "readline-6.2-CVE-2014-2524.patch"))
139 (patch-flags '("-p0"))
50322c84
LC
140 (sha256
141 (base32
142 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))))))
a2285798
EF
143
144(define-public rlwrap
145 (package
146 (name "rlwrap")
f1fac6b8 147 (version "0.43")
a2285798
EF
148 (source
149 (origin
150 (method url-fetch)
f1fac6b8
TGR
151 (uri (string-append "https://github.com/hanslub42/rlwrap/releases/"
152 "download/v" version "/"
153 name "-" version ".tar.gz"))
a2285798
EF
154 (sha256
155 (base32
f1fac6b8 156 "0bzb7ylk2770iv59v2d0gypb21y2xn87m299s9rqm6rdi2vx11lf"))))
a2285798 157 (build-system gnu-build-system)
f1fac6b8
TGR
158 (native-inputs
159 `(("perl" ,perl)))
a2285798
EF
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
165readline library to allow the editing of keyboard input for any command. You
166should consider rlwrap especially when you need user-defined completion (by way
167of completion word lists) and persistent history, or if you want to program
168'special effects' using the filter mechanism.")
f1fac6b8 169 (home-page "https://github.com/hanslub42/rlwrap")
a2285798 170 (license gpl2+)))