You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

139 lines
6.3 KiB

  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. (define-module (gnu packages ncurses)
  19. #:use-module (guix licenses)
  20. #:use-module (guix packages)
  21. #:use-module (guix download)
  22. #:use-module (guix build-system gnu))
  23. (define-public ncurses
  24. (let ((patch-makefile-phase
  25. '(lambda _
  26. (for-each patch-makefile-SHELL
  27. (find-files "." "Makefile.in"))))
  28. (configure-phase
  29. '(lambda* (#:key inputs outputs configure-flags
  30. #:allow-other-keys)
  31. ;; The `ncursesw5-config' has a #!/bin/sh. We want to patch
  32. ;; it to point to libc's embedded Bash, to avoid retaining a
  33. ;; reference to the bootstrap Bash.
  34. (let* ((libc (assoc-ref inputs "libc"))
  35. (bash (string-append libc "/bin/bash"))
  36. (out (assoc-ref outputs "out")))
  37. (format #t "configure flags: ~s~%" configure-flags)
  38. (zero? (apply system* bash "./configure"
  39. (string-append "SHELL=" bash)
  40. (string-append "CONFIG_SHELL=" bash)
  41. (string-append "--prefix=" out)
  42. configure-flags)))))
  43. (cross-pre-install-phase
  44. '(lambda _
  45. ;; Run the native `tic' program, not the cross-built one.
  46. (substitute* "misc/run_tic.sh"
  47. (("\\{TIC_PATH:=.*\\}")
  48. "{TIC_PATH:=true}")
  49. (("cross_compiling:=no")
  50. "cross_compiling:=yes"))))
  51. (post-install-phase
  52. ;; FIXME: The `tic' binary lacks a RUNPATH; fix it.
  53. '(lambda* (#:key outputs #:allow-other-keys)
  54. (let ((out (assoc-ref outputs "out")))
  55. ;; When building a wide-character (Unicode) build, create backward
  56. ;; compatibility links from the the "normal" libraries to the
  57. ;; wide-character libraries (e.g. libncurses.so to libncursesw.so).
  58. (with-directory-excursion (string-append out "/lib")
  59. (for-each (lambda (lib)
  60. (define libw.a
  61. (string-append "lib" lib "w.a"))
  62. (define lib.a
  63. (string-append "lib" lib ".a"))
  64. (define libw.so.x
  65. (string-append "lib" lib "w.so.5"))
  66. (define lib.so.x
  67. (string-append "lib" lib ".so.5"))
  68. (define lib.so
  69. (string-append "lib" lib ".so"))
  70. (when (file-exists? libw.a)
  71. (format #t "creating symlinks for `lib~a'~%" lib)
  72. (symlink libw.a lib.a)
  73. (symlink libw.so.x lib.so.x)
  74. (false-if-exception (delete-file lib.so))
  75. (call-with-output-file lib.so
  76. (lambda (p)
  77. (format p "INPUT (-l~aw)~%" lib)))))
  78. '("curses" "ncurses" "form" "panel" "menu")))))))
  79. (package
  80. (name "ncurses")
  81. (version "5.9")
  82. (source (origin
  83. (method url-fetch)
  84. (uri (string-append "mirror://gnu/ncurses/ncurses-"
  85. version ".tar.gz"))
  86. (sha256
  87. (base32
  88. "0fsn7xis81za62afan0vvm38bvgzg5wfmv1m86flqcj0nj7jjilh"))))
  89. (build-system gnu-build-system)
  90. (arguments
  91. `(#:configure-flags
  92. `("--with-shared" "--without-debug" "--enable-widec"
  93. ;; By default headers land in an `ncursesw' subdir, which is not
  94. ;; what users expect.
  95. ,(string-append "--includedir=" (assoc-ref %outputs "out")
  96. "/include")
  97. ;; C++ bindings fail to build on
  98. ;; `i386-pc-solaris2.11' with GCC 3.4.3:
  99. ;; <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6395191>.
  100. ,,@(if (string=? (%current-system) "i686-solaris")
  101. '("--without-cxx-binding")
  102. '()))
  103. #:tests? #f ; no "check" target
  104. #:phases ,(if (%current-target-system)
  105. `(alist-cons-before ; cross build
  106. 'configure 'patch-makefile-SHELL
  107. ,patch-makefile-phase
  108. (alist-cons-before
  109. 'install 'pre-install
  110. ,cross-pre-install-phase
  111. (alist-cons-after
  112. 'install 'post-install ,post-install-phase
  113. %standard-phases)))
  114. `(alist-cons-after ; native build
  115. 'install 'post-install ,post-install-phase
  116. (alist-cons-before
  117. 'configure 'patch-makefile-SHELL
  118. ,patch-makefile-phase
  119. (alist-replace
  120. 'configure
  121. ,configure-phase
  122. %standard-phases))))))
  123. (self-native-input? #t) ; for `tic'
  124. (synopsis "Terminal emulation (termcap, terminfo) library")
  125. (description
  126. "Ncurses is a library which provides capabilities to write text to a
  127. terminal in a terminal-independent manner. It supports pads and color as
  128. well as multiple highlights and forms characters. It is typically used to
  129. implement user interfaces for command-line applications.")
  130. (license x11)
  131. (home-page "http://www.gnu.org/software/ncurses/"))))