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