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