about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@yahoo.com>2017-05-17 19:09:00 -0400
committerGitHub <noreply@github.com>2017-05-17 19:09:00 -0400
commitafec912d81e08339868e0e1e84234e6ed7f6b3fd (patch)
treeff7616435b45620a8b1d4a94f27fbfc45c99ff3c
parent64acaa1e2dcb73d19c91c97499a23c0c2f6f19a9 (diff)
parent2601a80639ecee27fdb83ce099c037a348ba7125 (diff)
downloadnixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.tar
nixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.tar.gz
nixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.tar.bz2
nixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.tar.lz
nixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.tar.xz
nixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.tar.zst
nixlib-afec912d81e08339868e0e1e84234e6ed7f6b3fd.zip
Merge pull request #25867 from obsidiansystems/ghc-deps-cross
Fix cross compilation of some GHC deps
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix10
-rw-r--r--pkgs/development/libraries/ncurses/default.nix12
-rw-r--r--pkgs/top-level/release-cross.nix63
3 files changed, 44 insertions, 41 deletions
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index e30c15e629ef..92dd602fc4d8 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -1,4 +1,7 @@
-{ stdenv, fetchurl, m4, cxx ? true, withStatic ? false }:
+{ stdenv, fetchurl, m4, cxx ? true
+, buildPackages
+, buildPlatform, hostPlatform
+, withStatic ? false }:
 
 let inherit (stdenv.lib) optional optionalString; in
 
@@ -16,7 +19,8 @@ let self = stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "info" ];
   passthru.static = self.out;
 
-  nativeBuildInputs = [ m4 ];
+  nativeBuildInputs = [ m4 ]
+    ++ stdenv.lib.optional (buildPlatform != hostPlatform) buildPackages.stdenv.cc;
 
   configureFlags =
     # Build a "fat binary", with routines for several sub-architectures
@@ -39,7 +43,7 @@ let self = stdenv.mkDerivation rec {
       configureFlagsArray+=("--build=$(./configfsf.guess)")
     '';
 
-  doCheck = true;
+  doCheck = buildPlatform == hostPlatform;
 
   dontDisableStatic = withStatic;
 
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 4ffaee9be5ab..9e7f2eef46bf 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -5,6 +5,9 @@
 , unicode ? true
 
 , gpm
+
+, buildPlatform, hostPlatform
+, buildPackages
 }:
 let
   version = if abiVersion == "5" then "5.9" else "6.0";
@@ -35,7 +38,11 @@ stdenv.mkDerivation rec {
   # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
   CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [
+    pkgconfig
+  ] ++ lib.optionals (buildPlatform != hostPlatform) [
+    buildPackages.ncurses buildPackages.stdenv.cc
+  ];
   buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
 
   preConfigure = ''
@@ -58,7 +65,8 @@ stdenv.mkDerivation rec {
     sed -i -e 's,LIB_SUFFIX="t,LIB_SUFFIX=",' configure
   '';
 
-  selfNativeBuildInput = true;
+  # Here only for native hash, remove on next mass rebuild
+  selfNativeBuildInput = buildPlatform == hostPlatform;
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix
index 861b3abe1ad8..31ce31a67595 100644
--- a/pkgs/top-level/release-cross.nix
+++ b/pkgs/top-level/release-cross.nix
@@ -12,31 +12,29 @@ with import ./release-lib.nix { inherit supportedSystems scrubJobs; };
 let
   nativePlatforms = linux;
 
-  /* Basic list of packages to cross-build */
-  basicCrossDrv = {
-    bison = nativePlatforms;
-    busybox = nativePlatforms;
-    coreutils = nativePlatforms;
-    dropbear = nativePlatforms;
+  common = {
+    buildPackages.binutils = nativePlatforms;
+    gmp = nativePlatforms;
   };
 
-  /* Basic list of packages to be natively built,
-     but need a crossSystem defined to get meaning */
-  basicNativeDrv = {
-    buildPackages.binutils = nativePlatforms;
+  gnuCommon = common // {
     buildPackages.gccCrossStageFinal = nativePlatforms;
-    buildPackages.gdbCross = nativePlatforms;
+    coreutils = nativePlatforms;
   };
 
-  basic = basicCrossDrv // basicNativeDrv;
+  linuxCommon = gnuCommon // {
+    buildPackages.gdbCross = nativePlatforms;
 
-  windows = {
-    buildPackages.binutils = nativePlatforms;
-    buildPackages.gccCrossStageFinal = nativePlatforms;
+    bison = nativePlatforms;
+    busybox = nativePlatforms;
+    dropbear = nativePlatforms;
+    ed = nativePlatforms;
+    ncurses = nativePlatforms;
+    patch = nativePlatforms;
+  };
 
-    coreutils = nativePlatforms;
+  windowsCommon = gnuCommon // {
     boehmgc = nativePlatforms;
-    gmp = nativePlatforms;
     guile_1_8 = nativePlatforms;
     libffi = nativePlatforms;
     libtool = nativePlatforms;
@@ -44,6 +42,10 @@ let
     windows.wxMSW = nativePlatforms;
   };
 
+  darwinCommon = {
+    buildPackages.binutils = darwin;
+  };
+
 in
 
 {
@@ -92,9 +94,7 @@ in
       arch = "arm64";
       libc = "libSystem";
     };
-  in mapTestOnCross crossSystem {
-    buildPackages.binutils = darwin;
-  };
+  in mapTestOnCross crossSystem darwinCommon;
 
   darwinToArm = let
     crossSystem = {
@@ -102,9 +102,7 @@ in
       arch = "armv7-a";
       libc = "libSystem";
     };
-  in mapTestOnCross crossSystem {
-    buildPackages.binutils = darwin;
-  };
+  in mapTestOnCross crossSystem darwinCommon;
 
   /* Test some cross builds to the Sheevaplug */
   crossSheevaplugLinux = let
@@ -118,7 +116,7 @@ in
       libc = "glibc";
       openssl.system = "linux-generic32";
     };
-  in mapTestOnCross crossSystem (basic // {
+  in mapTestOnCross crossSystem (linuxCommon // {
     ubootSheevaplug = nativePlatforms;
   });
 
@@ -131,7 +129,7 @@ in
       libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
       platform = {};
     };
-  in mapTestOnCross crossSystem windows;
+  in mapTestOnCross crossSystem windowsCommon;
 
 
   /* Test some cross builds on 64 bit mingw-w64 */
@@ -143,7 +141,7 @@ in
       libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
       platform = {};
     };
-  in mapTestOnCross crossSystem windows;
+  in mapTestOnCross crossSystem windowsCommon;
 
 
   /* Linux on the fuloong */
@@ -162,11 +160,7 @@ in
         abi = "n32";
       };
     };
-  in mapTestOnCross crossSystem {
-    coreutils = nativePlatforms;
-    ed = nativePlatforms;
-    patch = nativePlatforms;
-  };
+  in mapTestOnCross crossSystem linuxCommon;
 
 
   /* Linux on Raspberrypi */
@@ -188,10 +182,7 @@ in
         abi = "aapcs-linux";
       };
     };
-  in mapTestOnCross crossSystem {
-    coreutils = nativePlatforms;
-    ed = nativePlatforms;
-    patch = nativePlatforms;
+  in mapTestOnCross crossSystem (linuxCommon // {
     vim = nativePlatforms;
     unzip = nativePlatforms;
     ddrescue = nativePlatforms;
@@ -199,7 +190,7 @@ in
     patchelf = nativePlatforms;
     buildPackages.binutils = nativePlatforms;
     mpg123 = nativePlatforms;
-  };
+  });
 
 
   /* Cross-built bootstrap tools for every supported platform */