Synchronize package descriptions with the Womb.
[jackhill/guix/guix.git] / gnu / packages / ncurses.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages ncurses)
20 #:use-module (guix licenses)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu))
24
25 (define-public ncurses
26 (let ((patch-makefile-phase
27 '(lambda _
28 (for-each patch-makefile-SHELL
29 (find-files "." "Makefile.in"))))
30 (configure-phase
31 '(lambda* (#:key inputs outputs configure-flags
32 #:allow-other-keys)
33 ;; The `ncursesw5-config' has a #!/bin/sh. We want to patch
34 ;; it to point to libc's embedded Bash, to avoid retaining a
35 ;; reference to the bootstrap Bash.
36 (let* ((libc (assoc-ref inputs "libc"))
37 (bash (string-append libc "/bin/bash"))
38 (out (assoc-ref outputs "out")))
39 (format #t "configure flags: ~s~%" configure-flags)
40 (zero? (apply system* bash "./configure"
41 (string-append "SHELL=" bash)
42 (string-append "CONFIG_SHELL=" bash)
43 (string-append "--prefix=" out)
44 configure-flags)))))
45 (cross-pre-install-phase
46 '(lambda _
47 ;; Run the native `tic' program, not the cross-built one.
48 (substitute* "misc/run_tic.sh"
49 (("\\{TIC_PATH:=.*\\}")
50 "{TIC_PATH:=true}")
51 (("cross_compiling:=no")
52 "cross_compiling:=yes"))))
53 (post-install-phase
54 ;; FIXME: The `tic' binary lacks a RUNPATH; fix it.
55 '(lambda* (#:key outputs #:allow-other-keys)
56 (let ((out (assoc-ref outputs "out")))
57 ;; When building a wide-character (Unicode) build, create backward
58 ;; compatibility links from the the "normal" libraries to the
59 ;; wide-character libraries (e.g. libncurses.so to libncursesw.so).
60 (with-directory-excursion (string-append out "/lib")
61 (for-each (lambda (lib)
62 (define libw.a
63 (string-append "lib" lib "w.a"))
64 (define lib.a
65 (string-append "lib" lib ".a"))
66 (define libw.so.x
67 (string-append "lib" lib "w.so.5"))
68 (define lib.so.x
69 (string-append "lib" lib ".so.5"))
70 (define lib.so
71 (string-append "lib" lib ".so"))
72
73 (when (file-exists? libw.a)
74 (format #t "creating symlinks for `lib~a'~%" lib)
75 (symlink libw.a lib.a)
76 (symlink libw.so.x lib.so.x)
77 (false-if-exception (delete-file lib.so))
78 (call-with-output-file lib.so
79 (lambda (p)
80 (format p "INPUT (-l~aw)~%" lib)))))
81 '("curses" "ncurses" "form" "panel" "menu")))))))
82 (package
83 (name "ncurses")
84 (version "5.9")
85 (source (origin
86 (method url-fetch)
87 (uri (string-append "mirror://gnu/ncurses/ncurses-"
88 version ".tar.gz"))
89 (sha256
90 (base32
91 "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"))))
92 (build-system gnu-build-system)
93 (arguments
94 `(#:configure-flags
95 `("--with-shared" "--without-debug" "--enable-widec"
96
97 ;; By default headers land in an `ncursesw' subdir, which is not
98 ;; what users expect.
99 ,(string-append "--includedir=" (assoc-ref %outputs "out")
100 "/include")
101
102 ;; C++ bindings fail to build on
103 ;; `i386-pc-solaris2.11' with GCC 3.4.3:
104 ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
105 ,,@(if (string=? (%current-system) "i686-solaris")
106 '("--without-cxx-binding")
107 '()))
108 #:tests? #f ; no "check" target
109 #:phases ,(if (%current-target-system)
110
111 `(alist-cons-before ; cross build
112 'configure 'patch-makefile-SHELL
113 ,patch-makefile-phase
114 (alist-cons-before
115 'install 'pre-install
116 ,cross-pre-install-phase
117 (alist-cons-after
118 'install 'post-install ,post-install-phase
119 %standard-phases)))
120
121 `(alist-cons-after ; native build
122 'install 'post-install ,post-install-phase
123 (alist-cons-before
124 'configure 'patch-makefile-SHELL
125 ,patch-makefile-phase
126 (alist-replace
127 'configure
128 ,configure-phase
129 %standard-phases))))))
130 (self-native-input? #t) ; for `tic'
131 (synopsis "Terminal emulation (termcap, terminfo) library")
132 (description
133 "Ncurses is a library which provides capabilities to write text to a
134 terminal in a terminal-independent manner. It supports pads and color as
135 well as multiple highlights and forms characters. It is typically used to
136 implement user interfaces for command-line applications.")
137 (license x11)
138 (home-page "http://www.gnu.org/software/ncurses/"))))