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