summary refs log tree commit diff
path: root/pkgs/shells/bash/4.0.nix
blob: 0554039f279c10c62fd773d721a75db2be7ff3dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{stdenv, fetchurl, bison, interactive ? false, ncurses ? null, texinfo ? null, readline ? null}:

assert interactive -> ncurses != null;
assert interactive -> readline != null;

stdenv.mkDerivation {
  name = "bash-4.0";

  src = fetchurl {
    url = mirror://gnu/bash/bash-4.0.tar.gz;
    sha256 = "9793d394f640a95030c77d5ac989724afe196921956db741bcaf141801c50518";
  };

  NIX_CFLAGS_COMPILE = ''
    -DSYS_BASHRC="/etc/bashrc"
    -DSYS_BASH_LOGOUT="/etc/bash_logout"
    -DDEFAULT_PATH_VALUE="/no-such-path"
    -DSTANDARD_UTILS_PATH="/no-such-path"
    -DNON_INTERACTIVE_LOGIN_SHELLS
    -DSSH_SOURCE_BASHRC
  '';

  postInstall = "ln -s bash $out/bin/sh";

  patches = [
    # For dietlibc builds.
    ./winsize.patch
  ];

  configureFlags = if interactive then "--enable-readline --with-installed-readline" else "";

  # !!! Bison is only needed for bash-3.2 (because of bash32-001.patch)
  buildInputs = [bison]
    ++ stdenv.lib.optional (texinfo != null) texinfo
    ++ stdenv.lib.optional interactive readline
    ++ stdenv.lib.optional interactive ncurses;

  meta = {
    homepage = http://www.gnu.org/software/bash/;
    description =
      "GNU Bourne-Again Shell, the de facto standard shell on Linux" +
        (if interactive then " (for interactive use)" else "");
  };
}