gnu: Use HTTPS for almost all gnu.org HOME-PAGEs.
[jackhill/guix/guix.git] / gnu / packages / readline.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
f6d47eb6 2;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
a2285798 3;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
ae12d586 4;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
c44899a2 5;;;
233e7676 6;;; This file is part of GNU Guix.
c44899a2 7;;;
233e7676 8;;; GNU Guix is free software; you can redistribute it and/or modify it
c44899a2
LC
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
233e7676 13;;; GNU Guix is distributed in the hope that it will be useful, but
c44899a2
LC
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
233e7676 19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
c44899a2 20
1ffa7090 21(define-module (gnu packages readline)
4a44e743 22 #:use-module (guix licenses)
59a43334 23 #:use-module (gnu packages)
1ffa7090 24 #:use-module (gnu packages ncurses)
a2285798 25 #:use-module (gnu packages perl)
c44899a2 26 #:use-module (guix packages)
87f5d366 27 #:use-module (guix download)
ae12d586
JN
28 #:use-module (guix build-system gnu)
29 #:use-module (guix utils))
c44899a2
LC
30
31(define-public readline
530c1695
LC
32 (let ((post-install-phase
33 '(lambda* (#:key outputs #:allow-other-keys)
34 (let* ((out (assoc-ref outputs "out"))
35 (lib (string-append out "/lib")))
36 ;; Make libraries writable so that `strip' can work.
37 ;; Failing to do that, it bails out with "Permission
38 ;; denied".
39 (for-each (lambda (f) (chmod f #o755))
40 (find-files lib "\\.so"))
41 (for-each (lambda (f) (chmod f #o644))
c0895112 42 (find-files lib "\\.a"))))))
530c1695
LC
43 (package
44 (name "readline")
0c64d856 45 (version "7.0")
530c1695
LC
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "mirror://gnu/readline/readline-"
49 version ".tar.gz"))
50 (sha256
51 (base32
0c64d856 52 "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm"))
fc1adab1 53 (patches (search-patches "readline-link-ncurses.patch"))
de80b504 54 (patch-flags '("-p0"))))
530c1695
LC
55 (build-system gnu-build-system)
56 (propagated-inputs `(("ncurses" ,ncurses)))
de80b504 57 (arguments `(#:configure-flags
530c1695
LC
58 (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
59 (assoc-ref %build-inputs "ncurses")
f6d47eb6
LC
60 "/lib")
61
62 ;; This test does an 'AC_TRY_RUN', which aborts when
63 ;; cross-compiling, so provide the correct answer.
64 ,@(if (%current-target-system)
65 '("bash_cv_wcwidth_broken=no")
ae12d586
JN
66 '())
67 ;; MinGW: ncurses provides the termcap api.
68 ,@(if (target-mingw?)
69 '("bash_cv_termcap_lib=ncurses")
f6d47eb6 70 '()))
4500581a 71
ae12d586
JN
72 ,@(if (target-mingw?)
73 ;; MinGW: termcap in ncurses
74 ;; some SIG_* #defined in _POSIX
75 '(#:make-flags '("TERMCAP_LIB=-lncurses"
76 "CPPFLAGS=-D_POSIX -D'chown(f,o,g)=0'"))
77 '())
530c1695
LC
78 #:phases (alist-cons-after
79 'install 'post-install
80 ,post-install-phase
56c092ce 81 %standard-phases)))
f50d2669 82 (synopsis "Edit command lines while typing, with history support")
530c1695 83 (description
79c311b8 84 "The GNU readline library allows users to edit command lines as they
a22dc0c4
LC
85are typed in. It can maintain a searchable history of previously entered
86commands, letting you easily recall, edit and re-enter past commands. It
87features both Emacs-like and vi-like keybindings, making its usage
88comfortable for anyone.")
530c1695 89 (license gpl3+)
6fd52309 90 (home-page "https://savannah.gnu.org/projects/readline/"))))
50322c84
LC
91
92(define-public readline-6.2
93 (package (inherit readline)
94 (version "6.2")
95 (source (origin (inherit (package-source readline))
96 (method url-fetch)
97 (uri (string-append "mirror://gnu/readline/readline-"
98 version ".tar.gz"))
d9721bcf
LF
99 (patches (search-patches "readline-6.2-CVE-2014-2524.patch"))
100 (patch-flags '("-p0"))
50322c84
LC
101 (sha256
102 (base32
103 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))))))
a2285798
EF
104
105(define-public rlwrap
106 (package
107 (name "rlwrap")
108 (version "0.42")
109 (source
110 (origin
111 (method url-fetch)
112 (uri (string-append "http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-"
113 version ".tar.gz"))
114 (sha256
115 (base32
116 "0i3yz303wscrysyzpdq04h4nrl9ajz9dbwi80risdl5rkm3dhw2s"))))
117 (build-system gnu-build-system)
118 (native-inputs `(("perl" ,perl)))
119 (inputs
120 `(("readline" ,readline)))
121 (synopsis "Wrapper to allow the editing of keyboard commands")
122 (description
123 "Rlwrap is a 'readline wrapper', a small utility that uses the GNU
124readline library to allow the editing of keyboard input for any command. You
125should consider rlwrap especially when you need user-defined completion (by way
126of completion word lists) and persistent history, or if you want to program
127'special effects' using the filter mechanism.")
128 (home-page "http://utopia.knoware.nl/~hlub/uck/rlwrap/")
129 (license gpl2+)))