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.
 
 
 
 
 
 

121 lines
5.0 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 bash)
  19. #:use-module (guix licenses)
  20. #:use-module (gnu packages ncurses)
  21. #:use-module (gnu packages readline)
  22. #:use-module (guix packages)
  23. #:use-module (guix download)
  24. #:use-module (guix utils)
  25. #:use-module (guix build-system gnu))
  26. (define-public bash
  27. (let* ((cppflags (string-join '("-DSYS_BASHRC='\"/etc/bashrc\"'"
  28. "-DSYS_BASH_LOGOUT='\"/etc/bash_logout\"'"
  29. "-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
  30. "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
  31. "-DNON_INTERACTIVE_LOGIN_SHELLS"
  32. "-DSSH_SOURCE_BASHRC")
  33. " "))
  34. (configure-flags
  35. ``("--with-installed-readline"
  36. ,,(string-append "CPPFLAGS=" cppflags)
  37. ,(string-append
  38. "LDFLAGS=-Wl,-rpath -Wl,"
  39. (assoc-ref %build-inputs "readline")
  40. "/lib"
  41. " -Wl,-rpath -Wl,"
  42. (assoc-ref %build-inputs "ncurses")
  43. "/lib")))
  44. (post-install-phase
  45. '(lambda* (#:key outputs #:allow-other-keys)
  46. ;; Add a `bash' -> `sh' link.
  47. (let ((out (assoc-ref outputs "out")))
  48. (with-directory-excursion (string-append out "/bin")
  49. (symlink "bash" "sh"))))))
  50. (package
  51. (name "bash")
  52. (version "4.2")
  53. (source (origin
  54. (method url-fetch)
  55. (uri (string-append
  56. "mirror://gnu/bash/bash-" version ".tar.gz"))
  57. (sha256
  58. (base32
  59. "1n5kbblp5ykbz5q8aq88lsif2z0gnvddg9babk33024wxiwi2ym2"))))
  60. (build-system gnu-build-system)
  61. (inputs `(("readline" ,readline)
  62. ("ncurses" ,ncurses))) ; TODO: add texinfo
  63. (arguments
  64. `(;; When cross-compiling, `configure' incorrectly guesses that job
  65. ;; control is missing.
  66. #:configure-flags ,(if (%current-target-system)
  67. `(cons* "bash_cv_job_control_missing=no"
  68. ,configure-flags)
  69. configure-flags)
  70. ;; Bash is reportedly not parallel-safe. See, for instance,
  71. ;; <http://patches.openembedded.org/patch/32745/> and
  72. ;; <http://git.buildroot.net/buildroot/commit/?h=79e2d802ae7e376a413c02097790493e1f65c3a4>.
  73. #:parallel-build? #f
  74. #:parallel-tests? #f
  75. ;; XXX: The tests have a lot of hard-coded paths, so disable them
  76. ;; for now.
  77. #:tests? #f
  78. #:phases (alist-cons-after 'install 'post-install
  79. ,post-install-phase
  80. %standard-phases)))
  81. (synopsis "The GNU Bourne-Again SHell")
  82. (description
  83. "Bash is the shell, or commandline interpreter, of the GNU system. It
  84. is compatible with the Bourne Shell, but it also integrates useful features
  85. from the Korn Shell and the C Shell and new improvements of its own. It
  86. allows commandline editing, unlimited command history, shell functions and
  87. aliases, and job control while still allowing most sh scripts to be run
  88. without modification.")
  89. (license gpl3+)
  90. (home-page "http://www.gnu.org/software/bash/"))))
  91. (define-public bash-light
  92. ;; A stripped-down Bash for non-interactive use.
  93. (package (inherit bash)
  94. (name "bash-light")
  95. (inputs '()) ; no readline, no curses
  96. (arguments
  97. (let ((args `(#:modules ((guix build gnu-build-system)
  98. (guix build utils)
  99. (srfi srfi-1)
  100. (srfi srfi-26))
  101. ,@(package-arguments bash))))
  102. (substitute-keyword-arguments args
  103. ((#:configure-flags flags)
  104. `(list "--without-bash-malloc"
  105. "--disable-readline"
  106. "--disable-history"
  107. "--disable-help-builtin"
  108. "--disable-progcomp"
  109. "--disable-net-redirections"
  110. "--disable-nls"
  111. ,@(if (%current-target-system)
  112. '("bash_cv_job_control_missing=no")
  113. '()))))))))