Add haskell packages set for cross ghc
This commit is contained in:
parent
247d7c88d2
commit
64ec4dd87b
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, fetchgit, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils
|
{ stdenv, fetchgit, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils
|
||||||
, autoconf, automake, happy, alex, cross ? null
|
, autoconf, automake, happy, alex, crossSystem, selfPkgs, cross ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -70,6 +70,11 @@ in stdenv.mkDerivation (rec {
|
|||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit bootPkgs;
|
inherit bootPkgs;
|
||||||
|
} // stdenv.lib.optionalAttrs (crossSystem != null) {
|
||||||
|
crossCompiler = selfPkgs.ghc.override {
|
||||||
|
cross = crossSystem;
|
||||||
|
bootPkgs = selfPkgs;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -90,11 +95,24 @@ in stdenv.mkDerivation (rec {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"CC=${cross.config}-cc"
|
"CC=${stdenv.ccCross}/bin/${cross.config}-cc"
|
||||||
|
"LD=${stdenv.binutilsCross}/bin/${cross.config}-ld"
|
||||||
|
"AR=${stdenv.binutilsCross}/bin/${cross.config}-ar"
|
||||||
|
"NM=${stdenv.binutilsCross}/bin/${cross.config}-nm"
|
||||||
|
"RANLIB=${stdenv.binutilsCross}/bin/${cross.config}-ranlib"
|
||||||
"--target=${cross.config}"
|
"--target=${cross.config}"
|
||||||
|
"--enable-bootstrap-with-devel-snapshot"
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutilsCross ];
|
buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutilsCross ];
|
||||||
|
|
||||||
dontSetConfigureCross = true;
|
dontSetConfigureCross = true;
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit bootPkgs cross;
|
||||||
|
|
||||||
|
cc = "${stdenv.ccCross}/bin/${cross.config}-cc";
|
||||||
|
|
||||||
|
ld = "${stdenv.binutilsCross}/bin/${cross.config}-ld";
|
||||||
|
};
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
|
{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
|
||||||
, jailbreak-cabal, hscolour, cpphs, nodePackages
|
, jailbreak-cabal, hscolour, cpphs, nodePackages
|
||||||
}:
|
}: let isCross = (ghc.cross or null) != null; in
|
||||||
|
|
||||||
{ pname
|
{ pname
|
||||||
, dontStrip ? (ghc.isGhcjs or false)
|
, dontStrip ? (ghc.isGhcjs or false)
|
||||||
@ -12,13 +12,14 @@
|
|||||||
, buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? []
|
, buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? []
|
||||||
, configureFlags ? []
|
, configureFlags ? []
|
||||||
, description ? ""
|
, description ? ""
|
||||||
, doCheck ? stdenv.lib.versionOlder "7.4" ghc.version
|
, doCheck ? !isCross && (stdenv.lib.versionOlder "7.4" ghc.version)
|
||||||
, doHoogle ? true
|
, doHoogle ? true
|
||||||
, editedCabalFile ? null
|
, editedCabalFile ? null
|
||||||
, enableLibraryProfiling ? false
|
, enableLibraryProfiling ? false
|
||||||
, enableExecutableProfiling ? false
|
, enableExecutableProfiling ? false
|
||||||
, enableSharedExecutables ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
|
# TODO enable shared libs for cross-compiling
|
||||||
, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
|
, enableSharedExecutables ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version))
|
||||||
|
, enableSharedLibraries ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version))
|
||||||
, enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013
|
, enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013
|
||||||
, enableStaticLibraries ? true
|
, enableStaticLibraries ? true
|
||||||
, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
|
, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
|
||||||
@ -30,7 +31,8 @@
|
|||||||
, jailbreak ? false
|
, jailbreak ? false
|
||||||
, license
|
, license
|
||||||
, maintainers ? []
|
, maintainers ? []
|
||||||
, doHaddock ? !stdenv.isDarwin || stdenv.lib.versionAtLeast ghc.version "7.8"
|
# TODO Do we care about haddock when cross-compiling?
|
||||||
|
, doHaddock ? !isCross && (!stdenv.isDarwin || stdenv.lib.versionAtLeast ghc.version "7.8")
|
||||||
, passthru ? {}
|
, passthru ? {}
|
||||||
, pkgconfigDepends ? [], libraryPkgconfigDepends ? [], executablePkgconfigDepends ? [], testPkgconfigDepends ? []
|
, pkgconfigDepends ? [], libraryPkgconfigDepends ? [], executablePkgconfigDepends ? [], testPkgconfigDepends ? []
|
||||||
, testDepends ? [], testHaskellDepends ? [], testSystemDepends ? []
|
, testDepends ? [], testHaskellDepends ? [], testSystemDepends ? []
|
||||||
@ -57,14 +59,12 @@ let
|
|||||||
inherit (stdenv.lib) optional optionals optionalString versionOlder
|
inherit (stdenv.lib) optional optionals optionalString versionOlder
|
||||||
concatStringsSep enableFeature optionalAttrs toUpper;
|
concatStringsSep enableFeature optionalAttrs toUpper;
|
||||||
|
|
||||||
isCross = ghc.isCross or false;
|
|
||||||
isGhcjs = ghc.isGhcjs or false;
|
isGhcjs = ghc.isGhcjs or false;
|
||||||
packageDbFlag = if isGhcjs || versionOlder "7.6" ghc.version
|
packageDbFlag = if isGhcjs || versionOlder "7.6" ghc.version
|
||||||
then "package-db"
|
then "package-db"
|
||||||
else "package-conf";
|
else "package-conf";
|
||||||
|
|
||||||
nativeGhc = if isCross then ghc.bootPkgs.ghc else ghc;
|
nativeGhc = if isCross || isGhcjs then ghc.bootPkgs.ghc else ghc;
|
||||||
nativeIsCross = nativeGhc.isCross or false;
|
|
||||||
nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version
|
nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version
|
||||||
then "package-db"
|
then "package-db"
|
||||||
else "package-conf";
|
else "package-conf";
|
||||||
@ -88,6 +88,17 @@ let
|
|||||||
# details are at <https://github.com/peti/ghc-library-id-bug>.
|
# details are at <https://github.com/peti/ghc-library-id-bug>.
|
||||||
enableParallelBuilding = versionOlder "7.8" ghc.version && !hasActiveLibrary;
|
enableParallelBuilding = versionOlder "7.8" ghc.version && !hasActiveLibrary;
|
||||||
|
|
||||||
|
crossCabalFlags = [
|
||||||
|
"--with-ghc=${ghc.cross.config}-ghc"
|
||||||
|
"--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
|
||||||
|
"--with-gcc=${ghc.cc}"
|
||||||
|
"--with-ld=${ghc.ld}"
|
||||||
|
"--hsc2hs-options=--cross-compile"
|
||||||
|
];
|
||||||
|
|
||||||
|
crossCabalFlagsString =
|
||||||
|
stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
|
||||||
|
|
||||||
defaultConfigureFlags = [
|
defaultConfigureFlags = [
|
||||||
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
|
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
|
||||||
"--with-gcc=$CC" # Clang won't work without that extra information.
|
"--with-gcc=$CC" # Clang won't work without that extra information.
|
||||||
@ -106,7 +117,9 @@ let
|
|||||||
] ++ optionals isGhcjs [
|
] ++ optionals isGhcjs [
|
||||||
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
|
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
|
||||||
"--ghcjs"
|
"--ghcjs"
|
||||||
];
|
] ++ optionals isCross ([
|
||||||
|
"--configure-option=--host=${ghc.cross.config}"
|
||||||
|
] ++ crossCabalFlags);
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
||||||
@ -132,9 +145,9 @@ let
|
|||||||
|
|
||||||
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
||||||
|
|
||||||
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
|
setupBuilder = if isCross || isGhcjs then "${nativeGhc}/bin/ghc" else ghcCommand;
|
||||||
setupCommand = "./Setup";
|
setupCommand = "./Setup";
|
||||||
ghcCommand = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand = if isGhcjs then "ghcjs" else if isCross then "${ghc.cross.config}-ghc" else "ghc";
|
||||||
ghcCommandCaps = toUpper ghcCommand;
|
ghcCommandCaps = toUpper ghcCommand;
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -236,7 +249,7 @@ stdenv.mkDerivation ({
|
|||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
${setupCommand} build ${buildTarget}
|
${setupCommand} build ${buildTarget}${crossCabalFlagsString}
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
echo "-target ${prefix} -arch ${arch} -idirafter ${sdk}/usr/include ${if simulator then "-mios-simulator-version-min=7.0" else "-miphoneos-version-min=7.0"}" >> $out/nix-support/cc-cflags
|
echo "-target ${prefix} -arch ${arch} -idirafter ${sdk}/usr/include ${if simulator then "-mios-simulator-version-min=7.0" else "-miphoneos-version-min=7.0"}" >> $out/nix-support/cc-cflags
|
||||||
|
|
||||||
# Purposefully overwrite libc-ldflags-before, cctools ld doesn't know dynamic-linker and cc-wrapper doesn't do cross-compilation well enough to adjust
|
# Purposefully overwrite libc-ldflags-before, cctools ld doesn't know dynamic-linker and cc-wrapper doesn't do cross-compilation well enough to adjust
|
||||||
echo "-arch ${arch} -L${sdk}/usr/lib -L${sdk}/usr/lib/system" > $out/nix-support/libc-ldflags-before
|
echo "-arch ${arch} -L${sdk}/usr/lib -iphoneos_version_min 7.0.0" > $out/nix-support/libc-ldflags-before
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -49,10 +49,8 @@ rec {
|
|||||||
ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
|
ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
|
||||||
bootPkgs = packages.ghc7103;
|
bootPkgs = packages.ghc7103;
|
||||||
inherit (bootPkgs) alex happy;
|
inherit (bootPkgs) alex happy;
|
||||||
};
|
inherit crossSystem;
|
||||||
# TODO: how should we support multiple versions of this?
|
selfPkgs = packages.ghcHEAD;
|
||||||
ghcCross = compiler.ghcHEAD.override {
|
|
||||||
cross = crossSystem;
|
|
||||||
};
|
};
|
||||||
ghcNokinds = callPackage ../development/compilers/ghc/nokinds.nix rec {
|
ghcNokinds = callPackage ../development/compilers/ghc/nokinds.nix rec {
|
||||||
bootPkgs = packages.ghc784;
|
bootPkgs = packages.ghc784;
|
||||||
@ -125,7 +123,11 @@ rec {
|
|||||||
ghc = compiler.ghcHEAD;
|
ghc = compiler.ghcHEAD;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
||||||
};
|
};
|
||||||
# TODO Support for ghcCross here
|
# TODO Support for multiple variants here
|
||||||
|
ghcCross = callPackage ../development/haskell-modules {
|
||||||
|
ghc = compiler.ghcHEAD.crossCompiler;
|
||||||
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
||||||
|
};
|
||||||
ghcNokinds = callPackage ../development/haskell-modules {
|
ghcNokinds = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghcNokinds;
|
ghc = compiler.ghcNokinds;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-nokinds.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-nokinds.nix { };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user