gnu: Use synopses from the Womb.
[jackhill/guix/guix.git] / gnu / packages / bash.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 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
19 (define-module (gnu packages bash)
20 #:use-module (guix licenses)
21 #:use-module (gnu packages ncurses)
22 #:use-module (gnu packages readline)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix utils)
26 #:use-module (guix build-system gnu))
27
28 (define-public bash
29 (let ((cppflags (string-join '("-DSYS_BASHRC='\"/etc/bashrc\"'"
30 "-DSYS_BASH_LOGOUT='\"/etc/bash_logout\"'"
31 "-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
32 "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
33 "-DNON_INTERACTIVE_LOGIN_SHELLS"
34 "-DSSH_SOURCE_BASHRC")
35 " "))
36 (post-install-phase
37 '(lambda* (#:key outputs #:allow-other-keys)
38 ;; Add a `bash' -> `sh' link.
39 (let ((out (assoc-ref outputs "out")))
40 (with-directory-excursion (string-append out "/bin")
41 (symlink "bash" "sh"))))))
42 (package
43 (name "bash")
44 (version "4.2")
45 (source (origin
46 (method url-fetch)
47 (uri (string-append
48 "mirror://gnu/bash/bash-" version ".tar.gz"))
49 (sha256
50 (base32
51 "1n5kbblp5ykbz5q8aq88lsif2z0gnvddg9babk33024wxiwi2ym2"))))
52 (build-system gnu-build-system)
53 (inputs `(("readline" ,readline)
54 ("ncurses" ,ncurses))) ; TODO: add texinfo
55 (arguments
56 `(#:configure-flags `("--with-installed-readline"
57 ,,(string-append "CPPFLAGS=" cppflags)
58 ,(string-append
59 "LDFLAGS=-Wl,-rpath -Wl,"
60 (assoc-ref %build-inputs "readline")
61 "/lib"
62 " -Wl,-rpath -Wl,"
63 (assoc-ref %build-inputs "ncurses")
64 "/lib"))
65
66 ;; Bash is reportedly not parallel-safe. See, for instance,
67 ;; <http://patches.openembedded.org/patch/32745/> and
68 ;; <http://git.buildroot.net/buildroot/commit/?h=79e2d802ae7e376a413c02097790493e1f65c3a4>.
69 #:parallel-build? #f
70 #:parallel-tests? #f
71
72 ;; XXX: The tests have a lot of hard-coded paths, so disable them
73 ;; for now.
74 #:tests? #f
75
76 #:phases (alist-cons-after 'install 'post-install
77 ,post-install-phase
78 %standard-phases)))
79 (synopsis "The GNU Bourne-Again SHell")
80 (description
81 "Bash is the shell, or command language interpreter, that will appear in
82 the GNU operating system. Bash is an sh-compatible shell that incorporates
83 useful features from the Korn shell (ksh) and C shell (csh). It is intended
84 to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It
85 offers functional improvements over sh for both programming and interactive
86 use. In addition, most sh scripts can be run by Bash without
87 modification.")
88 (license gpl3+)
89 (home-page "http://www.gnu.org/software/bash/"))))
90
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")))))))