1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
25 (define-public ncurses
26 (let ((patch-makefile-phase
28 (for-each patch-makefile-SHELL
29 (find-files "." "Makefile.in"))))
31 '(lambda* (#:key inputs outputs configure-flags
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)
45 (cross-pre-install-phase
47 ;; Run the native `tic' program, not the cross-built one.
48 (substitute* "misc/run_tic.sh"
49 (("\\{TIC_PATH:=.*\\}")
51 (("cross_compiling:=no")
52 "cross_compiling:=yes"))))
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)
63 (string-append "lib" lib "w.a"))
65 (string-append "lib" lib ".a"))
67 (string-append "lib" lib "w.so.5"))
69 (string-append "lib" lib ".so.5"))
71 (string-append "lib" lib ".so"))
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
80 (format p "INPUT (-l~aw)~%" lib)))))
81 '("curses" "ncurses" "form" "panel" "menu")))))))
87 (uri (string-append "mirror://gnu/ncurses/ncurses-"
91 "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"))))
92 (build-system gnu-build-system)
95 `("--with-shared" "--without-debug" "--enable-widec"
97 ;; By default headers land in an `ncursesw' subdir, which is not
99 ,(string-append "--includedir=" (assoc-ref %outputs "out")
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")
108 #:tests? #f ; no "check" target
109 #:phases ,(if (%current-target-system)
111 `(alist-cons-before ; cross build
112 'configure 'patch-makefile-SHELL
113 ,patch-makefile-phase
115 'install 'pre-install
116 ,cross-pre-install-phase
118 'install 'post-install ,post-install-phase
119 %standard-cross-phases)))
121 `(alist-cons-after ; native build
122 'install 'post-install ,post-install-phase
124 'configure 'patch-makefile-SHELL
125 ,patch-makefile-phase
129 %standard-phases))))))
130 (self-native-input? #t) ; for `tic'
131 (synopsis "Terminal emulation (termcap, terminfo) library")
133 "The Ncurses (new curses) library is a free software emulation of curses
134 in System V Release 4.0, and more. It uses Terminfo format, supports pads
135 and color and multiple highlights and forms characters and function-key
136 mapping, and has all the other SYSV-curses enhancements over BSD Curses.
138 The ncurses code was developed under GNU/Linux. It has been in use for some
139 time with OpenBSD as the system curses library, and on FreeBSD and NetBSD as
140 an external package. It should port easily to any ANSI/POSIX-conforming
141 UNIX. It has even been ported to OS/2 Warp!")
143 (home-page "http://www.gnu.org/software/ncurses/"))))