at 16.09-beta 3.4 kB view raw
1{ stdenv, fetchurl, readline ? null, interactive ? false, texinfo ? null, binutils ? null, bison }: 2 3assert interactive -> readline != null; 4assert stdenv.isDarwin -> binutils != null; 5 6let 7 version = "4.3"; 8 realName = "bash-${version}"; 9 shortName = "bash43"; 10 baseConfigureFlags = if interactive then "--with-installed-readline" else "--disable-readline"; 11 sha256 = "1m14s1f61mf6bijfibcjm9y6pkyvz6gibyl8p4hxq90fisi8gimg"; 12 13 inherit (stdenv.lib) optional optionalString; 14in 15 16stdenv.mkDerivation rec { 17 name = "${realName}-p${toString (builtins.length patches)}"; 18 19 src = fetchurl { 20 url = "mirror://gnu/bash/${realName}.tar.gz"; 21 inherit sha256; 22 }; 23 24 hardeningDisable = [ "format" ]; 25 26 outputs = [ "out" "doc" "info" ]; 27 28 # the man pages are small and useful enough 29 outputMan = if interactive then "out" else null; 30 31 NIX_CFLAGS_COMPILE = '' 32 -DSYS_BASHRC="/etc/bashrc" 33 -DSYS_BASH_LOGOUT="/etc/bash_logout" 34 -DDEFAULT_PATH_VALUE="/no-such-path" 35 -DSTANDARD_UTILS_PATH="/no-such-path" 36 -DNON_INTERACTIVE_LOGIN_SHELLS 37 -DSSH_SOURCE_BASHRC 38 ''; 39 40 patchFlags = "-p0"; 41 42 patches = 43 (let 44 patch = nr: sha256: 45 fetchurl { 46 url = "mirror://gnu/bash/${realName}-patches/${shortName}-${nr}"; 47 inherit sha256; 48 }; 49 in 50 import ./bash-4.3-patches.nix patch) 51 ++ optional stdenv.isCygwin ./cygwin-bash-4.3.33-1.src.patch; 52 53 crossAttrs = { 54 configureFlags = baseConfigureFlags + 55 " bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing" + 56 optionalString stdenv.isCygwin '' 57 --without-libintl-prefix --without-libiconv-prefix 58 --with-installed-readline 59 bash_cv_dev_stdin=present 60 bash_cv_dev_fd=standard 61 bash_cv_termcap_lib=libncurses 62 ''; 63 }; 64 65 configureFlags = baseConfigureFlags; 66 67 # Note: Bison is needed because the patches above modify parse.y. 68 nativeBuildInputs = [bison] 69 ++ optional (texinfo != null) texinfo 70 ++ optional interactive readline 71 ++ optional stdenv.isDarwin binutils; 72 73 # Bash randomly fails to build because of a recursive invocation to 74 # build `version.h'. 75 enableParallelBuilding = false; 76 77 postInstall = '' 78 ln -s bash "$out/bin/sh" 79 ''; 80 81 postFixup = if interactive 82 then '' 83 substituteInPlace "$out/bin/bashbug" \ 84 --replace '${stdenv.shell}' "$out/bin/bash" 85 '' 86 # most space is taken by locale data 87 else '' 88 rm -r "$out/share" "$out/bin/bashbug" 89 ''; 90 91 meta = with stdenv.lib; { 92 homepage = http://www.gnu.org/software/bash/; 93 description = 94 "GNU Bourne-Again Shell, the de facto standard shell on Linux" + 95 (if interactive then " (for interactive use)" else ""); 96 97 longDescription = '' 98 Bash is the shell, or command language interpreter, that will 99 appear in the GNU operating system. Bash is an sh-compatible 100 shell that incorporates useful features from the Korn shell 101 (ksh) and C shell (csh). It is intended to conform to the IEEE 102 POSIX P1003.2/ISO 9945.2 Shell and Tools standard. It offers 103 functional improvements over sh for both programming and 104 interactive use. In addition, most sh scripts can be run by 105 Bash without modification. 106 ''; 107 108 license = licenses.gpl3Plus; 109 110 platforms = platforms.all; 111 112 maintainers = [ maintainers.peti ]; 113 }; 114 115 passthru = { 116 shellPath = "/bin/bash"; 117 }; 118}