gnu: python-pandas: Fix build on 32-bit.
[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 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
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
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages readline)
22 #:use-module (guix licenses)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages ncurses)
25 #:use-module (gnu packages perl)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix utils))
30
31 (define-public readline
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))
42 (find-files lib "\\.a"))))))
43 (package
44 (name "readline")
45 (version "7.0")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append "mirror://gnu/readline/readline-"
49 version ".tar.gz"))
50 (sha256
51 (base32
52 "0d13sg9ksf982rrrmv5mb6a2p4ys9rvg9r71d6il0vr8hmql63bm"))
53 (patches (search-patches "readline-link-ncurses.patch"))
54 (patch-flags '("-p0"))))
55 (build-system gnu-build-system)
56 (propagated-inputs `(("ncurses" ,ncurses)))
57 (arguments `(#:configure-flags
58 (list (string-append "LDFLAGS=-Wl,-rpath -Wl,"
59 (assoc-ref %build-inputs "ncurses")
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")
66 '())
67 ;; MinGW: ncurses provides the termcap api.
68 ,@(if (target-mingw?)
69 '("bash_cv_termcap_lib=ncurses")
70 '()))
71
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 '())
78 #:phases (alist-cons-after
79 'install 'post-install
80 ,post-install-phase
81 %standard-phases)))
82 (synopsis "Edit command lines while typing, with history support")
83 (description
84 "The GNU readline library allows users to edit command lines as they
85 are typed in. It can maintain a searchable history of previously entered
86 commands, letting you easily recall, edit and re-enter past commands. It
87 features both Emacs-like and vi-like keybindings, making its usage
88 comfortable for anyone.")
89 (license gpl3+)
90 (home-page "http://savannah.gnu.org/projects/readline/"))))
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"))
99 (patches (search-patches "readline-6.2-CVE-2014-2524.patch"))
100 (patch-flags '("-p0"))
101 (sha256
102 (base32
103 "10ckm2bd2rkxhvdmj7nmbsylmihw0abwcsnxf8y27305183rd9kr"))))))
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
124 readline library to allow the editing of keyboard input for any command. You
125 should consider rlwrap especially when you need user-defined completion (by way
126 of 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+)))