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