gnu: glib: Upgrade to 2.40.0.
[jackhill/guix/guix.git] / gnu / packages / ncurses.scm
index 1be2551..de7e6f6 100644 (file)
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,7 +21,6 @@
   #:use-module (guix licenses)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix utils)
   #:use-module (guix build-system gnu))
 
 (define-public ncurses
                             (string-append "CONFIG_SHELL=" bash)
                             (string-append "--prefix=" out)
                             configure-flags)))))
+        (cross-pre-install-phase
+         '(lambda _
+            ;; Run the native `tic' program, not the cross-built one.
+            (substitute* "misc/run_tic.sh"
+              (("\\{TIC_PATH:=.*\\}")
+               "{TIC_PATH:=true}")
+              (("cross_compiling:=no")
+               "cross_compiling:=yes"))))
         (post-install-phase
          '(lambda* (#:key outputs #:allow-other-keys)
             (let ((out (assoc-ref outputs "out")))
                 "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"))))
      (build-system gnu-build-system)
      (arguments
-      (case-lambda
-        ((system)
-         `(#:configure-flags
-           `("--with-shared" "--without-debug" "--enable-widec"
+      `(#:configure-flags
+        `("--with-shared" "--without-debug" "--enable-widec"
 
-             ;; By default headers land in an `ncursesw' subdir, which is not
-             ;; what users expect.
-             ,(string-append "--includedir=" (assoc-ref %outputs "out")
-                             "/include")
+          ;; By default headers land in an `ncursesw' subdir, which is not
+          ;; what users expect.
+          ,(string-append "--includedir=" (assoc-ref %outputs "out")
+                          "/include")
 
-             ;; C++ bindings fail to build on
-             ;; `i386-pc-solaris2.11' with GCC 3.4.3:
-             ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
-             ,,@(if (string=? system "i686-solaris")
-                    '("--without-cxx-binding")
-                    '()))
-           #:tests? #f                            ; no "check" target
-           #:phases (alist-cons-after
-                     'install 'post-install ,post-install-phase
-                     (alist-cons-before
-                      'configure 'patch-makefile-SHELL
-                      ,patch-makefile-phase
-                      (alist-replace
-                       'configure
-                       ,configure-phase
-                       %standard-phases)))))
-        ((system cross-system)
-         (arguments cross-system))))
-     (self-native-input? #t)
-     (synopsis
-      "GNU Ncurses, a free software emulation of curses in SVR4 and more")
-     (description
-      "The Ncurses (new curses) library is a free software emulation of curses
-in System V Release 4.0, and more.  It uses Terminfo format, supports pads
-and color and multiple highlights and forms characters and function-key
-mapping, and has all the other SYSV-curses enhancements over BSD Curses.
+          ;; By default man pages land in PREFIX/man, but we want them
+          ;; in PREFIX/share/man.
+          ,(string-append "--mandir=" (assoc-ref %outputs "out")
+                          "/share/man")
+
+          ;; Make sure programs like 'tic', 'reset', and 'clear' have a
+          ;; correct RUNPATH.
+          ,(string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "out")
+                          "/lib")
 
-The ncurses code was developed under GNU/Linux.  It has been in use for some
-time with OpenBSD as the system curses library, and on FreeBSD and NetBSD as
-an external package.  It should port easily to any ANSI/POSIX-conforming
-UNIX.  It has even been ported to OS/2 Warp!")
+          ;; C++ bindings fail to build on
+          ;; `i386-pc-solaris2.11' with GCC 3.4.3:
+          ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
+          ,,@(if (string=? (%current-system) "i686-solaris")
+                 '("--without-cxx-binding")
+                 '()))
+        #:tests? #f                               ; no "check" target
+        #:phases ,(if (%current-target-system)
+
+                      `(alist-cons-before         ; cross build
+                        'configure 'patch-makefile-SHELL
+                        ,patch-makefile-phase
+                        (alist-cons-before
+                         'install 'pre-install
+                         ,cross-pre-install-phase
+                         (alist-cons-after
+                          'install 'post-install ,post-install-phase
+                          %standard-phases)))
+
+                      `(alist-cons-after          ; native build
+                        'install 'post-install ,post-install-phase
+                        (alist-cons-before
+                         'configure 'patch-makefile-SHELL
+                         ,patch-makefile-phase
+                         (alist-replace
+                          'configure
+                          ,configure-phase
+                          %standard-phases))))))
+     (self-native-input? #t)                      ; for `tic'
+     (synopsis "Terminal emulation (termcap, terminfo) library")
+     (description
+      "GNU Ncurses is a library which provides capabilities to write text to
+a terminal in a terminal-independent manner.  It supports pads and color as
+well as multiple highlights and forms characters.  It is typically used to
+implement user interfaces for command-line applications.  The accompanying
+ncursesw library provides wide character support.")
      (license x11)
      (home-page "http://www.gnu.org/software/ncurses/"))))