Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
9a97b814 | 2 | ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org> |
c44899a2 | 3 | ;;; |
233e7676 | 4 | ;;; This file is part of GNU Guix. |
c44899a2 | 5 | ;;; |
233e7676 | 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
c44899a2 LC |
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 | ;;; | |
233e7676 | 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
c44899a2 LC |
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 | |
233e7676 | 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
c44899a2 | 18 | |
1ffa7090 | 19 | (define-module (gnu packages bash) |
4a44e743 | 20 | #:use-module (guix licenses) |
1ffa7090 LC |
21 | #:use-module (gnu packages ncurses) |
22 | #:use-module (gnu packages readline) | |
c44899a2 | 23 | #:use-module (guix packages) |
87f5d366 | 24 | #:use-module (guix download) |
c44899a2 LC |
25 | #:use-module (guix utils) |
26 | #:use-module (guix build-system gnu)) | |
27 | ||
28 | (define-public bash | |
9a97b814 LC |
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 | (configure-flags | |
37 | ``("--with-installed-readline" | |
38 | ,,(string-append "CPPFLAGS=" cppflags) | |
39 | ,(string-append | |
40 | "LDFLAGS=-Wl,-rpath -Wl," | |
41 | (assoc-ref %build-inputs "readline") | |
42 | "/lib" | |
43 | " -Wl,-rpath -Wl," | |
44 | (assoc-ref %build-inputs "ncurses") | |
45 | "/lib"))) | |
46 | (post-install-phase | |
47 | '(lambda* (#:key outputs #:allow-other-keys) | |
48 | ;; Add a `bash' -> `sh' link. | |
49 | (let ((out (assoc-ref outputs "out"))) | |
50 | (with-directory-excursion (string-append out "/bin") | |
51 | (symlink "bash" "sh")))))) | |
c44899a2 LC |
52 | (package |
53 | (name "bash") | |
54 | (version "4.2") | |
55 | (source (origin | |
87f5d366 | 56 | (method url-fetch) |
c44899a2 | 57 | (uri (string-append |
0db342a5 | 58 | "mirror://gnu/bash/bash-" version ".tar.gz")) |
c44899a2 LC |
59 | (sha256 |
60 | (base32 | |
61 | "1n5kbblp5ykbz5q8aq88lsif2z0gnvddg9babk33024wxiwi2ym2")))) | |
62 | (build-system gnu-build-system) | |
63 | (inputs `(("readline" ,readline) | |
64 | ("ncurses" ,ncurses))) ; TODO: add texinfo | |
65 | (arguments | |
9a97b814 LC |
66 | `(;; When cross-compiling, `configure' incorrectly guesses that job |
67 | ;; control is missing. | |
68 | #:configure-flags ,(if (%current-target-system) | |
69 | `(cons* "bash_cv_job_control_missing=no" | |
70 | ,configure-flags) | |
71 | configure-flags) | |
c44899a2 LC |
72 | |
73 | ;; Bash is reportedly not parallel-safe. See, for instance, | |
74 | ;; <http://patches.openembedded.org/patch/32745/> and | |
75 | ;; <http://git.buildroot.net/buildroot/commit/?h=79e2d802ae7e376a413c02097790493e1f65c3a4>. | |
76 | #:parallel-build? #f | |
77 | #:parallel-tests? #f | |
78 | ||
79 | ;; XXX: The tests have a lot of hard-coded paths, so disable them | |
80 | ;; for now. | |
81 | #:tests? #f | |
82 | ||
c0895112 LC |
83 | #:phases (alist-cons-after 'install 'post-install |
84 | ,post-install-phase | |
56c092ce | 85 | %standard-phases))) |
f50d2669 | 86 | (synopsis "The GNU Bourne-Again SHell") |
c44899a2 LC |
87 | (description |
88 | "Bash is the shell, or command language interpreter, that will appear in | |
89 | the GNU operating system. Bash is an sh-compatible shell that incorporates | |
90 | useful features from the Korn shell (ksh) and C shell (csh). It is intended | |
91 | to conform to the IEEE POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It | |
92 | offers functional improvements over sh for both programming and interactive | |
93 | use. In addition, most sh scripts can be run by Bash without | |
94 | modification.") | |
4a44e743 | 95 | (license gpl3+) |
c44899a2 | 96 | (home-page "http://www.gnu.org/software/bash/")))) |
450fb5a6 LC |
97 | |
98 | (define-public bash-light | |
99 | ;; A stripped-down Bash for non-interactive use. | |
100 | (package (inherit bash) | |
101 | (name "bash-light") | |
102 | (inputs '()) ; no readline, no curses | |
103 | (arguments | |
104 | (let ((args `(#:modules ((guix build gnu-build-system) | |
105 | (guix build utils) | |
106 | (srfi srfi-1) | |
56c092ce | 107 | (srfi srfi-26)) |
0e999137 | 108 | ,@(package-arguments bash)))) |
450fb5a6 LC |
109 | (substitute-keyword-arguments args |
110 | ((#:configure-flags flags) | |
111 | `(list "--without-bash-malloc" | |
112 | "--disable-readline" | |
113 | "--disable-history" | |
114 | "--disable-help-builtin" | |
115 | "--disable-progcomp" | |
116 | "--disable-net-redirections" | |
0e999137 LC |
117 | "--disable-nls" |
118 | ||
119 | ,@(if (%current-target-system) | |
120 | '("bash_cv_job_control_missing=no") | |
121 | '())))))))) |