summary refs log tree commit diff
path: root/pkgs/shells/bash
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-06-01 12:24:16 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-06-22 17:53:53 -0400
commitf75ad79375d3596d6402af881454ba8c5260b866 (patch)
treeb4192b4a07970f42e311acaa72d0b81b790e692e /pkgs/shells/bash
parentef0b07e94a2fa745d731b0308dbc175be58d0184 (diff)
downloadnixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.tar
nixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.tar.gz
nixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.tar.bz2
nixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.tar.lz
nixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.tar.xz
nixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.tar.zst
nixpkgs-f75ad79375d3596d6402af881454ba8c5260b866.zip
bash: Modernize derivation, hopefully fixing cross compilation
Diffstat (limited to 'pkgs/shells/bash')
-rw-r--r--pkgs/shells/bash/4.4.nix42
1 files changed, 21 insertions, 21 deletions
diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix
index 061f183e96e..e2defc2bf37 100644
--- a/pkgs/shells/bash/4.4.nix
+++ b/pkgs/shells/bash/4.4.nix
@@ -1,15 +1,16 @@
-{ stdenv, fetchurl, readline70 ? null, interactive ? false, texinfo ? null
-, binutils ? null, bison
+{ stdenv, buildPackages
+, fetchurl, readline70 ? null, texinfo ? null, binutils ? null, bison
+, buildPlatform, hostPlatform
+, interactive ? false
 }:
 
 assert interactive -> readline70 != null;
-assert stdenv.isDarwin -> binutils != null;
+assert hostPlatform.isDarwin -> binutils != null;
 
 let
   version = "4.4";
   realName = "bash-${version}";
   shortName = "bash44";
-  baseConfigureFlags = if interactive then "--with-installed-readline" else "--disable-readline";
   sha256 = "1jyz6snd63xjn6skk7za6psgidsd53k05cr3lksqybi0q6936syq";
 
   upstreamPatches =
@@ -22,7 +23,7 @@ let
     in
       import ./bash-4.4-patches.nix patch;
 
-  inherit (stdenv.lib) optional optionalString;
+  inherit (stdenv.lib) optional optionals;
 in
 
 stdenv.mkDerivation rec {
@@ -52,26 +53,25 @@ stdenv.mkDerivation rec {
   patchFlags = "-p0";
 
   patches = upstreamPatches
-      ++ optional stdenv.isCygwin ./cygwin-bash-4.3.33-1.src.patch;
-
-  crossAttrs = {
-    configureFlags = baseConfigureFlags +
-      " bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing bash_cv_getcwd_malloc=yes" +
-      optionalString stdenv.isCygwin ''
-        --without-libintl-prefix --without-libiconv-prefix
-        --with-installed-readline
-        bash_cv_dev_stdin=present
-        bash_cv_dev_fd=standard
-        bash_cv_termcap_lib=libncurses
-      '';
-  };
-
-  configureFlags = baseConfigureFlags;
+      ++ optional hostPlatform.isCygwin ./cygwin-bash-4.3.33-1.src.patch;
+
+  configureFlags = [
+    (if interactive then "--with-installed-readline" else "--disable-readline")
+  ] ++ optionals (hostPlatform != buildPlatform) [
+    "bash_cv_job_control_missing=nomissing bash_cv_sys_named_pipes=nomissing bash_cv_getcwd_malloc=yes"
+  ] ++ optionals hostPlatform.isCygwin [
+    "--without-libintl-prefix --without-libiconv-prefix"
+    "--with-installed-readline"
+    "bash_cv_dev_stdin=present"
+    "bash_cv_dev_fd=standard"
+    "bash_cv_termcap_lib=libncurses"
+  ];
 
   # Note: Bison is needed because the patches above modify parse.y.
   nativeBuildInputs = [bison]
     ++ optional (texinfo != null) texinfo
-    ++ optional stdenv.isDarwin binutils;
+    ++ optional hostPlatform.isDarwin binutils
+    ++ optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
 
   buildInputs = optional interactive readline70;