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