Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
6d69a7ed | 2 | ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> |
b1d5f5da | 3 | ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> |
c44899a2 | 4 | ;;; |
233e7676 | 5 | ;;; This file is part of GNU Guix. |
c44899a2 | 6 | ;;; |
233e7676 | 7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
c44899a2 LC |
8 | ;;; under the terms of the GNU General Public License as published by |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
233e7676 | 12 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
c44899a2 LC |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
c44899a2 | 19 | |
1ffa7090 | 20 | (define-module (gnu packages ncurses) |
4a44e743 | 21 | #:use-module (guix licenses) |
c44899a2 | 22 | #:use-module (guix packages) |
87f5d366 | 23 | #:use-module (guix download) |
c44899a2 LC |
24 | #:use-module (guix build-system gnu)) |
25 | ||
26 | (define-public ncurses | |
49f5a216 LC |
27 | (let ((patch-makefile-phase |
28 | '(lambda _ | |
feddc16c LC |
29 | (for-each patch-makefile-SHELL |
30 | (find-files "." "Makefile.in")))) | |
31 | (configure-phase | |
32 | '(lambda* (#:key inputs outputs configure-flags | |
33 | #:allow-other-keys) | |
34 | ;; The `ncursesw5-config' has a #!/bin/sh. We want to patch | |
35 | ;; it to point to libc's embedded Bash, to avoid retaining a | |
36 | ;; reference to the bootstrap Bash. | |
37 | (let* ((libc (assoc-ref inputs "libc")) | |
38 | (bash (string-append libc "/bin/bash")) | |
39 | (out (assoc-ref outputs "out"))) | |
40 | (format #t "configure flags: ~s~%" configure-flags) | |
41 | (zero? (apply system* bash "./configure" | |
42 | (string-append "SHELL=" bash) | |
43 | (string-append "CONFIG_SHELL=" bash) | |
44 | (string-append "--prefix=" out) | |
45 | configure-flags))))) | |
f755aa3f LC |
46 | (cross-pre-install-phase |
47 | '(lambda _ | |
48 | ;; Run the native `tic' program, not the cross-built one. | |
49 | (substitute* "misc/run_tic.sh" | |
50 | (("\\{TIC_PATH:=.*\\}") | |
51 | "{TIC_PATH:=true}") | |
52 | (("cross_compiling:=no") | |
53 | "cross_compiling:=yes")))) | |
49f5a216 | 54 | (post-install-phase |
c44899a2 LC |
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 | |
87f5d366 | 86 | (method url-fetch) |
0db342a5 | 87 | (uri (string-append "mirror://gnu/ncurses/ncurses-" |
c44899a2 LC |
88 | version ".tar.gz")) |
89 | (sha256 | |
90 | (base32 | |
91 | "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh")))) | |
92 | (build-system gnu-build-system) | |
93 | (arguments | |
21c203a5 LC |
94 | `(#:configure-flags |
95 | `("--with-shared" "--without-debug" "--enable-widec" | |
c44899a2 | 96 | |
21c203a5 LC |
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") | |
c44899a2 | 101 | |
b1d5f5da MW |
102 | ;; By default man pages land in PREFIX/man, but we want them |
103 | ;; in PREFIX/share/man. | |
104 | ,(string-append "--mandir=" (assoc-ref %outputs "out") | |
105 | "/share/man") | |
106 | ||
6d69a7ed LC |
107 | ;; Make sure programs like 'tic', 'reset', and 'clear' have a |
108 | ;; correct RUNPATH. | |
109 | ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out") | |
110 | "/lib") | |
111 | ||
21c203a5 LC |
112 | ;; C++ bindings fail to build on |
113 | ;; `i386-pc-solaris2.11' with GCC 3.4.3: | |
114 | ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>. | |
115 | ,,@(if (string=? (%current-system) "i686-solaris") | |
116 | '("--without-cxx-binding") | |
117 | '())) | |
118 | #:tests? #f ; no "check" target | |
f755aa3f LC |
119 | #:phases ,(if (%current-target-system) |
120 | ||
121 | `(alist-cons-before ; cross build | |
122 | 'configure 'patch-makefile-SHELL | |
123 | ,patch-makefile-phase | |
124 | (alist-cons-before | |
125 | 'install 'pre-install | |
126 | ,cross-pre-install-phase | |
127 | (alist-cons-after | |
128 | 'install 'post-install ,post-install-phase | |
56c092ce | 129 | %standard-phases))) |
f755aa3f LC |
130 | |
131 | `(alist-cons-after ; native build | |
132 | 'install 'post-install ,post-install-phase | |
133 | (alist-cons-before | |
134 | 'configure 'patch-makefile-SHELL | |
135 | ,patch-makefile-phase | |
136 | (alist-replace | |
137 | 'configure | |
138 | ,configure-phase | |
139 | %standard-phases)))))) | |
140 | (self-native-input? #t) ; for `tic' | |
f50d2669 | 141 | (synopsis "Terminal emulation (termcap, terminfo) library") |
c44899a2 | 142 | (description |
79c311b8 LC |
143 | "GNU Ncurses is a library which provides capabilities to write text to |
144 | a terminal in a terminal-independent manner. It supports pads and color as | |
a22dc0c4 | 145 | well as multiple highlights and forms characters. It is typically used to |
79c311b8 LC |
146 | implement user interfaces for command-line applications. The accompanying |
147 | ncursesw library provides wide character support.") | |
4a44e743 | 148 | (license x11) |
c44899a2 | 149 | (home-page "http://www.gnu.org/software/ncurses/")))) |