gnu: texlive-latex-babel: Install to generic/babel.
[jackhill/guix/guix.git] / gnu / packages / ncurses.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
9b1bf330 2;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
d230cf61 3;;; Copyright © 2014, 2016 Mark H Weaver <mhw@netris.org>
625e7cd6 4;;; Copyright © 2015, 2017 Leo Famulari <leo@famulari.name>
b393a44c 5;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
c76dab7b 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
d230cf61 7;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
c44899a2 8;;;
233e7676 9;;; This file is part of GNU Guix.
c44899a2 10;;;
233e7676 11;;; GNU Guix is free software; you can redistribute it and/or modify it
c44899a2
LC
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
233e7676 16;;; GNU Guix is distributed in the hope that it will be useful, but
c44899a2
LC
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
233e7676 22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
c44899a2 23
1ffa7090 24(define-module (gnu packages ncurses)
d230cf61 25 #:use-module (gnu packages)
4a44e743 26 #:use-module (guix licenses)
c44899a2 27 #:use-module (guix packages)
87f5d366 28 #:use-module (guix download)
b393a44c 29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system perl)
31 #:use-module (gnu packages)
c76dab7b 32 #:use-module (gnu packages perl)
57742b35 33 #:use-module (gnu packages pkg-config)
d230cf61
MW
34 #:use-module (gnu packages swig)
35 #:use-module (guix utils))
c44899a2
LC
36
37(define-public ncurses
d230cf61
MW
38 (package
39 (name "ncurses")
625e7cd6 40 (replacement ncurses/fixed)
d230cf61
MW
41 (version "6.0")
42 (source (origin
87f5d366 43 (method url-fetch)
0db342a5 44 (uri (string-append "mirror://gnu/ncurses/ncurses-"
c44899a2
LC
45 version ".tar.gz"))
46 (sha256
47 (base32
7b066880 48 "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm"))))
d230cf61
MW
49 (build-system gnu-build-system)
50 (outputs '("out"
51 "doc")) ;1 MiB of man pages
52 (arguments
53 (let ((patch-makefile-phase
54 '(lambda _
55 (for-each patch-makefile-SHELL
56 (find-files "." "Makefile.in"))))
57 (configure-phase
58 ;; The 'configure' script does not understand '--docdir', so we must
59 ;; override that and use '--mandir' instead.
60 '(lambda* (#:key build target outputs configure-flags
61 #:allow-other-keys)
62 (let ((out (assoc-ref outputs "out"))
63 (doc (assoc-ref outputs "doc")))
64 (zero? (apply system* "./configure"
65 (string-append "SHELL=" (which "sh"))
66 (string-append "--build=" build)
67 (string-append "--prefix=" out)
68 (string-append "--mandir=" doc "/share/man")
69 (if target
70 (cons (string-append "--host=" target)
71 configure-flags)
72 configure-flags))))))
73 (remove-shebang-phase
74 '(lambda _
75 ;; To avoid retaining a reference to the bootstrap Bash via the
76 ;; shebang of the 'ncursesw6-config' script, simply remove that
77 ;; shebang: it'll work just as well without it. Likewise, do not
78 ;; retain a reference to the "doc" output.
79 (substitute* "misc/ncurses-config.in"
80 (("#!@SHELL@")
81 "# No shebang here, use /bin/sh!\n")
82 (("@SHELL@ \\$0")
83 "$0")
84 (("mandir=.*$")
85 "mandir=share/man"))
86 #t))
87 (post-install-phase
88 `(lambda* (#:key outputs #:allow-other-keys)
89 (let ((out (assoc-ref outputs "out")))
90 ;; When building a wide-character (Unicode) build, create backward
91 ;; compatibility links from the the "normal" libraries to the
74288230 92 ;; wide-character ones (e.g. libncurses.so to libncursesw.so).
d230cf61
MW
93 ,@(if (target-mingw?)
94 '( ;; TODO: create .la files to link to the .dll?
95 (with-directory-excursion (string-append out "/bin")
96 (for-each
97 (lambda (lib)
98 (define lib.dll
99 (string-append "lib" lib ".dll"))
100 (define libw6.dll
101 (string-append "lib" lib "w6.dll"))
102
103 (when (file-exists? libw6.dll)
104 (format #t "creating symlinks for `lib~a'~%" lib)
105 (symlink libw6.dll lib.dll)))
106 '("curses" "ncurses" "form" "panel" "menu"))))
107 '())
108 (with-directory-excursion (string-append out "/lib")
109 (for-each (lambda (lib)
110 (define libw.a
111 (string-append "lib" lib "w.a"))
112 (define lib.a
113 (string-append "lib" lib ".a"))
114
115 ,@(if (not (target-mingw?))
116 '((define libw.so.x
117 (string-append "lib" lib "w.so.6"))
118 (define lib.so.x
119 (string-append "lib" lib ".so.6"))
120 (define lib.so
74288230
LF
121 (string-append "lib" lib ".so"))
122 (define packagew.pc
123 (string-append lib "w.pc"))
124 (define package.pc
125 (string-append lib ".pc")))
d230cf61 126 '())
c44899a2 127
d230cf61
MW
128 (when (file-exists? libw.a)
129 (format #t "creating symlinks for `lib~a'~%" lib)
130 (symlink libw.a lib.a)
131 ,@(if (not (target-mingw?))
132 '((symlink libw.so.x lib.so.x)
133 (false-if-exception (delete-file lib.so))
134 (call-with-output-file lib.so
135 (lambda (p)
74288230
LF
136 (format p "INPUT (-l~aw)~%" lib)))
137 (with-directory-excursion "pkgconfig"
138 (format #t "creating symlink for `~a'~%"
139 package.pc)
140 (when (file-exists? packagew.pc)
141 (symlink packagew.pc package.pc))))
d230cf61
MW
142 '())))
143 '("curses" "ncurses" "form" "panel" "menu")))))))
144 `(#:configure-flags
145 ,(cons*
146 'quasiquote
147 `(("--with-shared" "--without-debug" "--enable-widec"
148
74288230
LF
149 "--enable-pc-files"
150 ,(list 'unquote '(string-append "--with-pkg-config-libdir="
151 (assoc-ref %outputs "out")
152 "/lib/pkgconfig"))
57742b35 153
d230cf61
MW
154 ;; By default headers land in an `ncursesw' subdir, which is not
155 ;; what users expect.
156 ,(list 'unquote '(string-append "--includedir=" (assoc-ref %outputs "out")
157 "/include"))
158 "--enable-overwrite" ;really honor --includedir
c44899a2 159
d230cf61
MW
160 ;; Make sure programs like 'tic', 'reset', and 'clear' have a
161 ;; correct RUNPATH.
162 ,(list 'unquote '(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
163 "/lib"))
164 ;; MinGW: Use term-driver created for the MinGW port.
165 ,@(if (target-mingw?) '("--enable-term-driver") '()))))
166 #:tests? #f ; no "check" target
167 #:phases (modify-phases %standard-phases
168 (replace 'configure ,configure-phase)
169 (add-after 'install 'post-install
170 ,post-install-phase)
171 (add-before 'configure 'patch-makefile-SHELL
172 ,patch-makefile-phase)
173 (add-after 'unpack 'remove-unneeded-shebang
174 ,remove-shebang-phase)))))
175 (self-native-input? #t) ; for `tic'
57742b35
TGR
176 (native-inputs
177 `(("pkg-config" ,pkg-config)))
d230cf61
MW
178 (native-search-paths
179 (list (search-path-specification
180 (variable "TERMINFO_DIRS")
181 (files '("share/terminfo")))))
182 (synopsis "Terminal emulation (termcap, terminfo) library")
183 (description
184 "GNU Ncurses is a library which provides capabilities to write text to
79c311b8 185a terminal in a terminal-independent manner. It supports pads and color as
a22dc0c4 186well as multiple highlights and forms characters. It is typically used to
79c311b8
LC
187implement user interfaces for command-line applications. The accompanying
188ncursesw library provides wide character support.")
d230cf61 189 (license x11)
6fd52309 190 (home-page "https://www.gnu.org/software/ncurses/")))
44298269 191
625e7cd6
LF
192(define ncurses/fixed
193 (package
194 (inherit ncurses)
195 (source
196 (origin
197 (inherit (package-source ncurses))
198 (patches
199 (append
200 (origin-patches (package-source ncurses))
201 (search-patches "ncurses-CVE-2017-10684-10685.patch")))))))
202
44298269
LF
203(define-public dialog
204 (package
205 (name "dialog")
206 (version "1.2-20150920")
207 (source (origin
208 (method url-fetch)
209 (uri (string-append
210 "http://invisible-mirror.net/archives/dialog/dialog-"
211 version ".tgz"))
212 (sha256
213 (base32
214 "01ccd585c241nkj02n0zdbx8jqhylgcfpcmmshynh0c7fv2ixrn4"))))
215 (build-system gnu-build-system)
216 (arguments
217 `(#:tests? #f)) ; no test suite
218 (inputs
219 `(("ncurses" ,ncurses)))
220 (synopsis "Curses widgets")
221 (description "Dialog is a script-interpreter which provides a set of
222curses widgets, such as dialog boxes.")
223 (home-page "http://invisible-island.net/dialog/dialog.html")
224 ;; Includes the gpl3 file "config.sub" from Automake.
225 (license (list lgpl2.1 gpl3))))
b393a44c 226
227(define-public perl-curses
228 (package
229 (name "perl-curses")
230 (version "1.36")
231 (source
232 (origin
233 (method url-fetch)
234 (uri (string-append "mirror://cpan/authors/id/G/GI/GIRAFFED/"
235 "Curses-" version ".tar.gz"))
236 (sha256
237 (base32
238 "0r6xd9wr0c25rr28zixhqipak575zqsfb7r7f2693i9il1dpj554"))))
239 (build-system perl-build-system)
240 (inputs
241 `(("ncurses" ,ncurses)))
242 (arguments
243 `(#:make-maker-flags (list "PANELS" "MENUS")
244 #:phases
245 (modify-phases %standard-phases
246 (add-before
247 'configure 'set-curses-ldflags
248 (lambda* (#:key inputs #:allow-other-keys)
249 (let* ((ncurses (assoc-ref inputs "ncurses"))
250 (include (string-append ncurses "/include"))
251 (lib (string-append ncurses "/lib")))
252 (setenv "CURSES_LIBTYPE" "ncurses")
253 (setenv "CURSES_CFLAGS" (string-append "-I" include))
254 (setenv "CURSES_PANEL_CFLAGS" (string-append "-I" include))
255 (setenv "CURSES_MENU_CFLAGS" (string-append "-I" include))
256 (setenv "CURSES_FORM_CFLAGS" (string-append "-I" include))
257 (setenv "CURSES_LDFLAGS" (string-append "-L" lib " -lncurses"))
258 (setenv "CURSES_PANEL_LDFLAGS" (string-append "-L" lib " -lpanel"))
259 (setenv "CURSES_MENU_LDFLAGS" (string-append "-L" lib " -lmenu"))
260 (setenv "CURSES_FORM_LDFLAGS" (string-append "-L" lib " -lform"))
261 #t))))))
262 (home-page "http://search.cpan.org/dist/Curses")
263 (synopsis "Terminal screen handling and optimization")
264 (description
265 "@code{Curses} is the interface between Perl and the curses library
266of your system.")
2f3108ad 267 (license perl-license)))
c76dab7b
EF
268
269(define-public stfl
270 (package
271 (name "stfl")
272 (version "0.24")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (string-append "http://www.clifford.at/stfl/stfl-"
277 version ".tar.gz"))
278 (sha256
279 (base32
280 "1460d5lc780p3q38l3wc9jfr2a7zlyrcra0li65aynj738cam9yl"))))
281 (build-system gnu-build-system)
282 (arguments
283 '(#:tests? #f ; no test target
284 #:make-flags (list (string-append "prefix=" (assoc-ref %outputs "out")))
285 #:phases
286 (modify-phases %standard-phases
287 (delete 'configure) ; there is no configure script
288 ;; in our ncurses, the headers are in /include
289 (add-before 'build 'patch-ncursesw
290 (lambda _
291 (substitute* "stfl_internals.h"
292 (("ncursesw/") ""))
293 #t))
294 (add-after 'install 'install-missing-symlink
295 (lambda* (#:key outputs #:allow-other-keys)
296 (let* ((out (assoc-ref outputs "out"))
297 (lib (string-append out "/lib")))
298 ;; Some programs look for libstfl.so.0.
299 (symlink "libstfl.so" (string-append lib "/libstfl.so.0"))))))))
300 (inputs `(("ncurses" ,ncurses)))
301 (native-inputs `(("swig" ,swig)))
302 (home-page "http://www.clifford.at/stfl/")
303 (synopsis "Structured terminal forms library")
304 (description "Stfl is a library which implements a curses-based widget
305set for text terminals.")
306 (license lgpl3+)))