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