gnu: ncurses: Really install headers to OUT/include.
[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 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
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 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
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
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages ncurses)
21 #:use-module (guix licenses)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu))
25
26 (define-public ncurses
27 (let ((patch-makefile-phase
28 '(lambda _
29 (for-each patch-makefile-SHELL
30 (find-files "." "Makefile.in"))))
31 (remove-shebang-phase
32 '(lambda _
33 ;; To avoid retaining a reference to the bootstrap Bash via the
34 ;; shebang of the 'ncursesw5-config' script, simply remove that
35 ;; shebang: it'll work just as well without it.
36 (substitute* "misc/ncurses-config.in"
37 (("#!@SHELL@")
38 "# No shebang here, use /bin/sh!\n")
39 (("@SHELL@ \\$0")
40 "$0"))
41 #t))
42 (post-install-phase
43 '(lambda* (#:key outputs #:allow-other-keys)
44 (let ((out (assoc-ref outputs "out")))
45 ;; When building a wide-character (Unicode) build, create backward
46 ;; compatibility links from the the "normal" libraries to the
47 ;; wide-character libraries (e.g. libncurses.so to libncursesw.so).
48 (with-directory-excursion (string-append out "/lib")
49 (for-each (lambda (lib)
50 (define libw.a
51 (string-append "lib" lib "w.a"))
52 (define lib.a
53 (string-append "lib" lib ".a"))
54 (define libw.so.x
55 (string-append "lib" lib "w.so.6"))
56 (define lib.so.x
57 (string-append "lib" lib ".so.6"))
58 (define lib.so
59 (string-append "lib" lib ".so"))
60
61 (when (file-exists? libw.a)
62 (format #t "creating symlinks for `lib~a'~%" lib)
63 (symlink libw.a lib.a)
64 (symlink libw.so.x lib.so.x)
65 (false-if-exception (delete-file lib.so))
66 (call-with-output-file lib.so
67 (lambda (p)
68 (format p "INPUT (-l~aw)~%" lib)))))
69 '("curses" "ncurses" "form" "panel" "menu")))))))
70 (package
71 (name "ncurses")
72 (version "6.0")
73 (source (origin
74 (method url-fetch)
75 (uri (string-append "mirror://gnu/ncurses/ncurses-"
76 version ".tar.gz"))
77 (sha256
78 (base32
79 "0q3jck7lna77z5r42f13c4xglc7azd19pxfrjrpgp2yf615w4lgm"))))
80 (build-system gnu-build-system)
81 (arguments
82 `(#:configure-flags
83 `("--with-shared" "--without-debug" "--enable-widec"
84
85 ;; By default headers land in an `ncursesw' subdir, which is not
86 ;; what users expect.
87 ,(string-append "--includedir=" (assoc-ref %outputs "out")
88 "/include")
89 "--enable-overwrite" ;really honor --includedir
90
91 ;; Make sure programs like 'tic', 'reset', and 'clear' have a
92 ;; correct RUNPATH.
93 ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
94 "/lib"))
95 #:tests? #f ; no "check" target
96 #:phases (modify-phases %standard-phases
97 (add-after 'install 'post-install
98 ,post-install-phase)
99 (add-before 'configure 'patch-makefile-SHELL
100 ,patch-makefile-phase)
101 (add-after 'unpack 'remove-unneeded-shebang
102 ,remove-shebang-phase))))
103 (self-native-input? #t) ; for `tic'
104 (synopsis "Terminal emulation (termcap, terminfo) library")
105 (description
106 "GNU Ncurses is a library which provides capabilities to write text to
107 a terminal in a terminal-independent manner. It supports pads and color as
108 well as multiple highlights and forms characters. It is typically used to
109 implement user interfaces for command-line applications. The accompanying
110 ncursesw library provides wide character support.")
111 (license x11)
112 (home-page "http://www.gnu.org/software/ncurses/"))))