@@ -1,15 +1,16 @@
1−{ stdenv, fetchurl, readline70 ? null, interactive ? false, texinfo ? null
2−, binutils ? null, bison
1+{ stdenv, buildPackages
2+, fetchurl, readline70 ? null, texinfo ? null, binutils ? null, bison
3+, buildPlatform, hostPlatform
4+, interactive ? false
35}:
46
57assert interactive -> readline70 != null;
6−assert stdenv.isDarwin -> binutils != null;
8+assert hostPlatform.isDarwin -> binutils != null;
79
810let
911 version = "4.4";
1012 realName = "bash-${version}";
1113 shortName = "bash44";
12− baseConfigureFlags = if interactive then "--with-installed-readline" else "--disable-readline";
1314 sha256 = "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq";
1415
1516 upstreamPatches =
@@ -22,7 +23,7 @@ let
2223 in
2324 import ./bash-4.4-patches.nix patch;
2425
25− inherit (stdenv.lib) optional optionalString;
26+ inherit (stdenv.lib) optional optionals;
2627in
2728
2829stdenv.mkDerivation rec {
@@ -52,26 +53,25 @@ stdenv.mkDerivation rec {
5253 patchFlags = "-p0";
5354
5455 patches = upstreamPatches
55− ++ optional stdenv.isCygwin ./cygwin-bash-4.3.33-1.src.patch;
56−
57− crossAttrs = {
58− configureFlags = baseConfigureFlags +
59− " bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing bash_cv_getcwd_malloc=yes" +
60− optionalString stdenv.isCygwin ''
61− --without-libintl-prefix --without-libiconv-prefix
62− --with-installed-readline
63− bash_cv_dev_stdin=present
64− bash_cv_dev_fd=standard
65− bash_cv_termcap_lib=libncurses
66− '';
67− };
68−
69− configureFlags = baseConfigureFlags;
56+ ++ optional hostPlatform.isCygwin ./cygwin-bash-4.3.33-1.src.patch;
57+
58+ configureFlags = [
59+ (if interactive then "--with-installed-readline" else "--disable-readline")
60+ ] ++ optionals (hostPlatform != buildPlatform) [
61+ "bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing bash_cv_getcwd_malloc=yes"
62+ ] ++ optionals hostPlatform.isCygwin [
63+ "--without-libintl-prefix --without-libiconv-prefix"
64+ "--with-installed-readline"
65+ "bash_cv_dev_stdin=present"
66+ "bash_cv_dev_fd=standard"
67+ "bash_cv_termcap_lib=libncurses"
68+ ];
7069
7170 # Note: Bison is needed because the patches above modify parse.y.
7271 nativeBuildInputs = [bison]
7372 ++ optional (texinfo != null) texinfo
74− ++ optional stdenv.isDarwin binutils;
73+ ++ optional hostPlatform.isDarwin binutils
74+ ++ optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
7575
7676 buildInputs = optional interactive readline70;
7777