haskell: Add notion of cross compiler and define nativeGhc with it

Tested to not change hashes
This commit is contained in:
John Ericson 2016-02-19 08:40:33 -08:00
parent 114cd6765d
commit 51b66ed4d9
2 changed files with 4 additions and 3 deletions

View File

@ -118,8 +118,8 @@ in mkDerivation (rec {
''; '';
passthru = { passthru = {
inherit bootPkgs; inherit bootPkgs;
isCross = true;
isGhcjs = true; isGhcjs = true;
nativeGhc = ghc;
inherit nodejs ghcjsBoot; inherit nodejs ghcjsBoot;
}; };

View File

@ -56,8 +56,9 @@ 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;
nativeGhc = if isGhcjs then ghc.nativeGhc else ghc; nativeGhc = if isCross then ghc.bootPkgs.ghc else ghc;
newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal"; newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal";
newCabalFile = fetchurl { newCabalFile = fetchurl {
@ -97,7 +98,7 @@ let
(optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic")) (optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic"))
(optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests")) (optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests"))
] ++ optionals isGhcjs [ ] ++ optionals isGhcjs [
"--with-hsc2hs=${ghc.nativeGhc}/bin/hsc2hs" "--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
"--ghcjs" "--ghcjs"
]; ];