gnu: at-spi2-core: Move html documentation to 'doc' output.
[jackhill/guix/guix.git] / gnu / packages / bash.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015 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 bash)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages ncurses)
24 #:use-module (gnu packages readline)
25 #:use-module (gnu packages bison)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix utils)
29 #:use-module (guix build-system gnu)
30 #:autoload (guix gnupg) (gnupg-verify*)
31 #:autoload (guix hash) (port-sha256)
32 #:autoload (guix base32) (bytevector->nix-base32-string)
33 #:use-module (srfi srfi-1)
34 #:use-module (srfi srfi-26)
35 #:use-module (ice-9 format))
36
37 (define (patch-url seqno)
38 "Return the URL of Bash patch number SEQNO."
39 (format #f "mirror://gnu/bash/bash-4.3-patches/bash43-~3,'0d" seqno))
40
41 (define (bash-patch seqno sha256)
42 "Return the origin of Bash patch SEQNO, with expected hash SHA256"
43 (origin
44 (method url-fetch)
45 (uri (patch-url seqno))
46 (sha256 sha256)))
47
48 (define-syntax-rule (patch-series (seqno hash) ...)
49 (list (bash-patch seqno (base32 hash))
50 ...))
51
52 (define %patch-series-4.3
53 ;; This is the current patches series for 4.3, generated using
54 ;; 'download-patches' below.
55 (patch-series
56 (1 "0hip2n2s5hws8p4nfcz37379zn6cak83ljsm64z52rw6ckrdzczc")
57 (2 "0ashj5d1g3zbyr7zf0r72s5wnk96cz1xj919y3jajadbc9qcvrzf")
58 (3 "0z88q4daq7dmw93iqd9c5i5d1sndklih3nrh0v75746da2n6w3h0")
59 (4 "0f0kh9j5k4ym6knshscx31przm50x5cc7ifkwqk0swh6clna982y")
60 (5 "1ym3b8b7lgmdp3dklp8qaqhyq965wd5392namq8mz7rb0d231j0s")
61 (6 "04q20igq49py49ynb0f83f6f52cdkyqwd9bpic6akr0m5pkqwr50")
62 (7 "18zkz23d9myshrwfcwcdjk7qmkqp8az5n91ni9jaixlwqlhy64qi")
63 (8 "0pprcwvh7ngdli0x95pc1cpssg4qg7layi9xrv2jq6c7965ajhcr")
64 (9 "19a0pf0alp30d1bjj0zf3zq2f5n0s6y91w7brm9jyswl51kns8n0")
65 (10 "1dzhr5ammyijisz48cqi5vaw26hfr5vh9smnqxq4qc9p06f7j1ff")
66 (11 "0fvzdzzi142a8rf3v965r6gbpn0k7fv2gif1yq8a4160vcn40qvw")
67 (12 "04lcgfcyz7p3zagb4hkia3hkpd7lii9m8ycy9qqwzyrm1c1pj4ry")
68 (13 "0y9cqi378z6flapkd5k5lfl4lq3ivzg4njj3i3wmw7xb6r9wma5z")
69 (14 "04xcb0k9fxxq4vashgzb98567xzdnm4655nlm4jvfvjv6si6ykas")
70 (15 "13ay6lldy1p00xj41nfjpq8lai3vw2qwca79gx6s80z04j53wa8k")
71 (16 "0wq7bvx3pfw90pnfb86yg5nr9jgjsvm2nq5rrkqxf6zn977hpmlj")
72 (17 "103p7sibihv6cshqj12k546zsbz0dnd5cv5vlx1719avddfc4rqj")
73 (18 "0n1x3812y1brb9xbabaj3fvr4cpvm2225iwckmqk2fcpkq5b9a3s")
74 (19 "08rd1p7zpzgbpmmmnj2im8wj2pcwmbbx51psr9vdc5c049si9ad7")
75 (20 "163c6g05qpag2plx5q795pmw3f3m904jy7z93xj2i08pgzc8cpna")
76 (21 "1a90cl3h10dh8k9f2ddrsjmw5ywaw2d5x78xb4fd2sryi039yhs1")
77 (22 "120s0s4qcqd0q12j1iv0hkpf9fp3w5jnqw646kv66n66jnxlfkgx")
78 (23 "1m00sfi88p2akgiyrg4hw0gvz3s1586pkzjdr3dm73vs773m1hls")
79 (24 "0v0gjqzjsqjfgj5x17fq7g649k94jn8zq92qsxkhc2d6l215hl1v")
80 (25 "0lcj96i659q35f1jcmwwbnw3p7w7vvlxjxqi989vn6d6qksqcl8y") ;CVE-2014-6271
81 (26 "0k919ir0inwn4wai2vdzpbwqq5h54fnrlkmgccxjg91v3ch15k1f") ;CVE-2014-7169
82 (27 "1gnsfvq6bhb3srlbh0cannj2hackdsipcg7z0ds7zlk1hp96mdqy")
83 (28 "17a65c4fn4c5rgsiw9gqqnzhznh3gwnd2xzzv2dppyi48znxpc78") ;CVE-2014-7186
84 (29 "14k27p28r5l2fz3r03kd0x72vvsq8bja8c6hjz5kxikbzsbs7i2c") ;CVE-2014-6277
85 (30 "0nrqb0m7s89qsrbfaffpilc5gcf82bx9yvgzld4hr79p5y54yhw5") ;CVE-2014-6278
86 (31 "07d62bl3z7qa8v6kgk47vzzazw563mlk9zhrsr4xsbqgvmcrylnd")
87 (32 "0jjgapfq4qhmndfrw8c3q3lva8xjdhlbd9cc631v41b0kb95g4w8")
88 (33 "05ma5rlxiadnfh925p4y7s0vvk917kmsdb1mfdx05gizl63pfapv")))
89 (define (download-patches store count)
90 "Download COUNT Bash patches into store. Return a list of
91 number/base32-hash tuples, directly usable in the 'patch-series' form."
92 (unfold (cut > <> count)
93 (lambda (number)
94 (let* ((patch (download-to-store store (patch-url number)))
95 (sig (download-to-store store
96 (string-append (patch-url number)
97 ".sig"))))
98 (unless (gnupg-verify* sig patch)
99 (error "failed to verify signature" patch))
100
101 (list number
102 (bytevector->nix-base32-string
103 (call-with-input-file patch port-sha256)))))
104 1+
105 1))
106
107 (define-public bash
108 (let* ((cppflags (string-join '("-DSYS_BASHRC='\"/etc/bashrc\"'"
109 "-DSYS_BASH_LOGOUT='\"/etc/bash_logout\"'"
110 "-DDEFAULT_PATH_VALUE='\"/no-such-path\"'"
111 "-DSTANDARD_UTILS_PATH='\"/no-such-path\"'"
112 "-DNON_INTERACTIVE_LOGIN_SHELLS"
113 "-DSSH_SOURCE_BASHRC")
114 " "))
115 (configure-flags
116 ``("--with-installed-readline"
117 ,,(string-append "CPPFLAGS=" cppflags)
118 ,(string-append
119 "LDFLAGS=-Wl,-rpath -Wl,"
120 (assoc-ref %build-inputs "readline")
121 "/lib"
122 " -Wl,-rpath -Wl,"
123 (assoc-ref %build-inputs "ncurses")
124 "/lib")))
125 (post-install-phase
126 '(lambda* (#:key outputs #:allow-other-keys)
127 ;; Add a `bash' -> `sh' link.
128 (let ((out (assoc-ref outputs "out")))
129 (with-directory-excursion (string-append out "/bin")
130 (symlink "bash" "sh")))))
131 (version "4.3"))
132 (package
133 (name "bash")
134 (source (origin
135 (method url-fetch)
136 (uri (string-append
137 "mirror://gnu/bash/bash-" version ".tar.gz"))
138 (sha256
139 (base32
140 "1m14s1f61mf6bijfibcjm9y6pkyvz6gibyl8p4hxq90fisi8gimg"))
141 (patch-flags '("-p0"))
142 (patches %patch-series-4.3)
143
144 ;; The patches above modify 'parse.y', so force a rebuild of the
145 ;; parser.
146 (snippet '(for-each delete-file
147 '("y.tab.c" "y.tab.h" "parser-built")))))
148 (version (string-append version "."
149 (number->string (length %patch-series-4.3))))
150 (build-system gnu-build-system)
151 (native-inputs `(("bison" ,bison))) ;to rebuild the parser
152 (inputs `(("readline" ,readline)
153 ("ncurses" ,ncurses))) ;TODO: add texinfo
154 (arguments
155 `(;; When cross-compiling, `configure' incorrectly guesses that job
156 ;; control is missing.
157 #:configure-flags ,(if (%current-target-system)
158 `(cons* "bash_cv_job_control_missing=no"
159 ,configure-flags)
160 configure-flags)
161
162 ;; Bash is reportedly not parallel-safe. See, for instance,
163 ;; <http://patches.openembedded.org/patch/32745/> and
164 ;; <http://git.buildroot.net/buildroot/commit/?h=79e2d802ae7e376a413c02097790493e1f65c3a4>.
165 #:parallel-build? #f
166 #:parallel-tests? #f
167
168 ;; XXX: The tests have a lot of hard-coded paths, so disable them
169 ;; for now.
170 #:tests? #f
171
172 #:phases (alist-cons-after 'install 'post-install
173 ,post-install-phase
174 %standard-phases)))
175 (synopsis "The GNU Bourne-Again SHell")
176 (description
177 "Bash is the shell, or command-line interpreter, of the GNU system. It
178 is compatible with the Bourne Shell, but it also integrates useful features
179 from the Korn Shell and the C Shell and new improvements of its own. It
180 allows command-line editing, unlimited command history, shell functions and
181 aliases, and job control while still allowing most sh scripts to be run
182 without modification.")
183 (license gpl3+)
184 (home-page "http://www.gnu.org/software/bash/"))))
185
186 (define-public bash-light
187 ;; A stripped-down Bash for non-interactive use.
188 (package (inherit bash)
189 (name "bash-light")
190 (inputs '()) ; no readline, no curses
191 (arguments
192 (let ((args `(#:modules ((guix build gnu-build-system)
193 (guix build utils)
194 (srfi srfi-1)
195 (srfi srfi-26))
196 ,@(package-arguments bash))))
197 (substitute-keyword-arguments args
198 ((#:configure-flags flags)
199 `(list "--without-bash-malloc"
200 "--disable-readline"
201 "--disable-history"
202 "--disable-help-builtin"
203 "--disable-progcomp"
204 "--disable-net-redirections"
205 "--disable-nls"
206
207 ,@(if (%current-target-system)
208 '("bash_cv_job_control_missing=no")
209 '()))))))))
210
211 (define-public bash-completion
212 (package
213 (name "bash-completion")
214 (version "2.1")
215 (source (origin
216 (method url-fetch)
217 (uri (string-append
218 "http://bash-completion.alioth.debian.org/files/"
219 "bash-completion-" version ".tar.bz2"))
220 (sha256
221 (base32
222 "0kxf8s5bw7y50x0ksb77d3kv0dwadixhybl818w27y6mlw26hq1b"))
223 (patches
224 (list (search-patch "bash-completion-directories.patch")))))
225 (build-system gnu-build-system)
226 (synopsis "Bash completions for common commands")
227 (description
228 "This package provides extensions that allow Bash to provide adapted
229 completion for many common commands.")
230 (home-page "http://bash-completion.alioth.debian.org/")
231 (license gpl2+)))