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 let inherit (stdenv.lib) optional optionalString; in
@ -16,7 +19,8 @@ let self = stdenv.mkDerivation rec {
outputs = [ "out" "dev" "info" ]; outputs = [ "out" "dev" "info" ];
passthru.static = self.out; passthru.static = self.out;
nativeBuildInputs = [ m4 ]; nativeBuildInputs = [ m4 ]
++ stdenv.lib.optional (buildPlatform != hostPlatform) buildPackages.stdenv.cc;
configureFlags = configureFlags =
# Build a "fat binary", with routines for several sub-architectures # Build a "fat binary", with routines for several sub-architectures
@ -39,7 +43,7 @@ let self = stdenv.mkDerivation rec {
configureFlagsArray+=("--build=$(./configfsf.guess)") configureFlagsArray+=("--build=$(./configfsf.guess)")
''; '';
doCheck = true; doCheck = buildPlatform == hostPlatform;
dontDisableStatic = withStatic; dontDisableStatic = withStatic;

View File

@ -5,6 +5,9 @@
, unicode ? true , unicode ? true
, gpm , gpm
, buildPlatform, hostPlatform
, buildPackages
}: }:
let let
version = if abiVersion == "5" then "5.9" else "6.0"; 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: # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED"; 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; buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
preConfigure = '' preConfigure = ''
@ -58,7 +65,8 @@ stdenv.mkDerivation rec {
sed -i -e 's,LIB_SUFFIX="t,LIB_SUFFIX=",' configure 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; enableParallelBuilding = true;

View File

@ -12,31 +12,29 @@ with import ./release-lib.nix { inherit supportedSystems scrubJobs; };
let let
nativePlatforms = linux; nativePlatforms = linux;
/* Basic list of packages to cross-build */ common = {
basicCrossDrv = { buildPackages.binutils = nativePlatforms;
gmp = nativePlatforms;
};
gnuCommon = common // {
buildPackages.gccCrossStageFinal = nativePlatforms;
coreutils = nativePlatforms;
};
linuxCommon = gnuCommon // {
buildPackages.gdbCross = nativePlatforms;
bison = nativePlatforms; bison = nativePlatforms;
busybox = nativePlatforms; busybox = nativePlatforms;
coreutils = nativePlatforms;
dropbear = nativePlatforms; dropbear = nativePlatforms;
ed = nativePlatforms;
ncurses = nativePlatforms;
patch = nativePlatforms;
}; };
/* Basic list of packages to be natively built, windowsCommon = gnuCommon // {
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;
boehmgc = nativePlatforms; boehmgc = nativePlatforms;
gmp = nativePlatforms;
guile_1_8 = nativePlatforms; guile_1_8 = nativePlatforms;
libffi = nativePlatforms; libffi = nativePlatforms;
libtool = nativePlatforms; libtool = nativePlatforms;
@ -44,6 +42,10 @@ let
windows.wxMSW = nativePlatforms; windows.wxMSW = nativePlatforms;
}; };
darwinCommon = {
buildPackages.binutils = darwin;
};
in in
{ {
@ -92,9 +94,7 @@ in
arch = "arm64"; arch = "arm64";
libc = "libSystem"; libc = "libSystem";
}; };
in mapTestOnCross crossSystem { in mapTestOnCross crossSystem darwinCommon;
buildPackages.binutils = darwin;
};
darwinToArm = let darwinToArm = let
crossSystem = { crossSystem = {
@ -102,9 +102,7 @@ in
arch = "armv7-a"; arch = "armv7-a";
libc = "libSystem"; libc = "libSystem";
}; };
in mapTestOnCross crossSystem { in mapTestOnCross crossSystem darwinCommon;
buildPackages.binutils = darwin;
};
/* Test some cross builds to the Sheevaplug */ /* Test some cross builds to the Sheevaplug */
crossSheevaplugLinux = let crossSheevaplugLinux = let
@ -118,7 +116,7 @@ in
libc = "glibc"; libc = "glibc";
openssl.system = "linux-generic32"; openssl.system = "linux-generic32";
}; };
in mapTestOnCross crossSystem (basic // { in mapTestOnCross crossSystem (linuxCommon // {
ubootSheevaplug = nativePlatforms; ubootSheevaplug = nativePlatforms;
}); });
@ -131,7 +129,7 @@ in
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {}; platform = {};
}; };
in mapTestOnCross crossSystem windows; in mapTestOnCross crossSystem windowsCommon;
/* Test some cross builds on 64 bit mingw-w64 */ /* Test some cross builds on 64 bit mingw-w64 */
@ -143,7 +141,7 @@ in
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {}; platform = {};
}; };
in mapTestOnCross crossSystem windows; in mapTestOnCross crossSystem windowsCommon;
/* Linux on the fuloong */ /* Linux on the fuloong */
@ -162,11 +160,7 @@ in
abi = "n32"; abi = "n32";
}; };
}; };
in mapTestOnCross crossSystem { in mapTestOnCross crossSystem linuxCommon;
coreutils = nativePlatforms;
ed = nativePlatforms;
patch = nativePlatforms;
};
/* Linux on Raspberrypi */ /* Linux on Raspberrypi */
@ -188,10 +182,7 @@ in
abi = "aapcs-linux"; abi = "aapcs-linux";
}; };
}; };
in mapTestOnCross crossSystem { in mapTestOnCross crossSystem (linuxCommon // {
coreutils = nativePlatforms;
ed = nativePlatforms;
patch = nativePlatforms;
vim = nativePlatforms; vim = nativePlatforms;
unzip = nativePlatforms; unzip = nativePlatforms;
ddrescue = nativePlatforms; ddrescue = nativePlatforms;
@ -199,7 +190,7 @@ in
patchelf = nativePlatforms; patchelf = nativePlatforms;
buildPackages.binutils = nativePlatforms; buildPackages.binutils = nativePlatforms;
mpg123 = nativePlatforms; mpg123 = nativePlatforms;
}; });
/* Cross-built bootstrap tools for every supported platform */ /* Cross-built bootstrap tools for every supported platform */