Merge pull request #25867 from obsidiansystems/ghc-deps-cross

Fix cross compilation of some GHC deps
This commit is contained in:
John Ericson 2017-05-17 19:09:00 -04:00 committed by GitHub
commit afec912d81
3 changed files with 46 additions and 43 deletions

View File

@ -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;

View File

@ -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;

View File

@ -12,31 +12,29 @@ with import ./release-lib.nix { inherit supportedSystems scrubJobs; };
let
nativePlatforms = linux;
/* Basic list of packages to cross-build */
basicCrossDrv = {
common = {
buildPackages.binutils = nativePlatforms;
gmp = nativePlatforms;
};
gnuCommon = common // {
buildPackages.gccCrossStageFinal = nativePlatforms;
coreutils = nativePlatforms;
};
linuxCommon = gnuCommon // {
buildPackages.gdbCross = nativePlatforms;
bison = nativePlatforms;
busybox = nativePlatforms;
coreutils = nativePlatforms;
dropbear = nativePlatforms;
ed = nativePlatforms;
ncurses = nativePlatforms;
patch = nativePlatforms;
};
/* Basic list of packages to be natively built,
but need a crossSystem defined to get meaning */
basicNativeDrv = {
buildPackages.binutils = nativePlatforms;
buildPackages.gccCrossStageFinal = nativePlatforms;
buildPackages.gdbCross = nativePlatforms;
};
basic = basicCrossDrv // basicNativeDrv;
windows = {
buildPackages.binutils = nativePlatforms;
buildPackages.gccCrossStageFinal = 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 */