haskell infra: nativeGhc != ghc.bootPkgs.ghc
There's no reason to wait for non-binary native to *build* cross ghc, but we want a nix-built GHC for Setup.hs or things won't work.
This commit is contained in:
parent
8560c025bc
commit
81553124cf
@ -1,4 +1,5 @@
|
|||||||
{ pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes
|
{ pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes
|
||||||
|
, buildHaskellPackages
|
||||||
, compilerConfig ? (self: super: {})
|
, compilerConfig ? (self: super: {})
|
||||||
, packageSetConfig ? (self: super: {})
|
, packageSetConfig ? (self: super: {})
|
||||||
, overrides ? (self: super: {})
|
, overrides ? (self: super: {})
|
||||||
@ -14,7 +15,7 @@ let
|
|||||||
|
|
||||||
haskellPackages = pkgs.callPackage makePackageSet {
|
haskellPackages = pkgs.callPackage makePackageSet {
|
||||||
package-set = initialPackages;
|
package-set = initialPackages;
|
||||||
inherit stdenv haskellLib ghc extensible-self;
|
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self;
|
||||||
};
|
};
|
||||||
|
|
||||||
commonConfiguration = configurationCommon { inherit pkgs haskellLib; };
|
commonConfiguration = configurationCommon { inherit pkgs haskellLib; };
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ stdenv, buildPackages, ghc
|
{ stdenv, buildPackages, buildHaskellPackages, ghc
|
||||||
, jailbreak-cabal, hscolour, cpphs, nodejs
|
, jailbreak-cabal, hscolour, cpphs, nodejs
|
||||||
, buildPlatform, hostPlatform
|
, buildPlatform, hostPlatform
|
||||||
}:
|
}:
|
||||||
@ -81,7 +81,11 @@ let
|
|||||||
then "package-db"
|
then "package-db"
|
||||||
else "package-conf";
|
else "package-conf";
|
||||||
|
|
||||||
nativeGhc = if isCross || isGhcjs then ghc.bootPkgs.ghc else ghc;
|
# GHC used for building Setup.hs
|
||||||
|
#
|
||||||
|
# Same as our GHC, unless we're cross, in which case it is native GHC with the
|
||||||
|
# same version, or ghcjs, in which case its the ghc used to build ghcjs.
|
||||||
|
nativeGhc = buildHaskellPackages.ghc;
|
||||||
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";
|
||||||
@ -147,8 +151,7 @@ let
|
|||||||
] ++ crossCabalFlags);
|
] ++ crossCabalFlags);
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$packageConfDir")
|
||||||
(optionalString isGhcjs "-build-runner")
|
|
||||||
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||||
# https://github.com/haskell/cabal/issues/2398
|
# https://github.com/haskell/cabal/issues/2398
|
||||||
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
||||||
@ -160,14 +163,12 @@ let
|
|||||||
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
|
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
|
||||||
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
|
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
|
||||||
|
|
||||||
nativeBuildInputs = [ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
|
nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
|
||||||
buildTools ++ libraryToolDepends ++ executableToolDepends;
|
buildTools ++ libraryToolDepends ++ executableToolDepends;
|
||||||
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
|
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
|
||||||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
|
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
|
||||||
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
|
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
|
||||||
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
|
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
|
||||||
# ghcjs's hsc2hs calls out to the native hsc2hs
|
|
||||||
optional isGhcjs nativeGhc ++
|
|
||||||
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
|
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
|
||||||
allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
|
allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
|
||||||
|
|
||||||
@ -176,12 +177,14 @@ let
|
|||||||
|
|
||||||
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
|
||||||
|
|
||||||
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
|
|
||||||
setupCommand = "./Setup";
|
setupCommand = "./Setup";
|
||||||
|
|
||||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||||
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||||
ghcCommandCaps= toUpper ghcCommand';
|
ghcCommandCaps= toUpper ghcCommand';
|
||||||
|
|
||||||
|
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
assert allPkgconfigDepends != [] -> pkgconfig != null;
|
assert allPkgconfigDepends != [] -> pkgconfig != null;
|
||||||
@ -270,7 +273,7 @@ stdenv.mkDerivation ({
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo setupCompileFlags: $setupCompileFlags
|
echo setupCompileFlags: $setupCompileFlags
|
||||||
${setupBuilder} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
|
||||||
|
|
||||||
runHook postCompileBuildDriver
|
runHook postCompileBuildDriver
|
||||||
'';
|
'';
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
{ # package-set used for build tools (all of nixpkgs)
|
{ # package-set used for build tools (all of nixpkgs)
|
||||||
buildPackages
|
buildPackages
|
||||||
|
|
||||||
|
, # A haskell package set for Setup.hs, compiler plugins, and similar
|
||||||
|
# build-time uses.
|
||||||
|
buildHaskellPackages
|
||||||
|
|
||||||
, # package-set used for non-haskell dependencies (all of nixpkgs)
|
, # package-set used for non-haskell dependencies (all of nixpkgs)
|
||||||
pkgs
|
pkgs
|
||||||
|
|
||||||
@ -18,8 +22,8 @@
|
|||||||
, # compiler to use
|
, # compiler to use
|
||||||
ghc
|
ghc
|
||||||
|
|
||||||
, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and `self`
|
, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and
|
||||||
# as second, and returns a set of haskell packages
|
# `self` as second, and returns a set of haskell packages
|
||||||
package-set
|
package-set
|
||||||
|
|
||||||
, # The final, fully overriden package set usable with the nixpkgs fixpoint
|
, # The final, fully overriden package set usable with the nixpkgs fixpoint
|
||||||
@ -36,15 +40,12 @@ let
|
|||||||
inherit (stdenv.lib) fix' extends makeOverridable;
|
inherit (stdenv.lib) fix' extends makeOverridable;
|
||||||
inherit (haskellLib) overrideCabal;
|
inherit (haskellLib) overrideCabal;
|
||||||
|
|
||||||
buildHaskellPackages = if hostPlatform != buildPlatform
|
|
||||||
then self.ghc.bootPkgs
|
|
||||||
else self;
|
|
||||||
|
|
||||||
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
nodejs = buildPackages.nodejs-slim;
|
nodejs = buildPackages.nodejs-slim;
|
||||||
inherit (buildHaskellPackages) jailbreak-cabal;
|
inherit buildHaskellPackages;
|
||||||
inherit (self) ghc;
|
inherit (self) ghc;
|
||||||
|
inherit (buildHaskellPackages) jailbreak-cabal;
|
||||||
hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
|
hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
|
||||||
isLibrary = false;
|
isLibrary = false;
|
||||||
doHaddock = false;
|
doHaddock = false;
|
||||||
|
@ -128,48 +128,58 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Always get compilers from `buildPackages`
|
# Always get compilers from `buildPackages`
|
||||||
packages = let inherit (buildPackages.haskell) compiler; in {
|
packages = let bh = buildPackages.haskell; in {
|
||||||
|
|
||||||
ghc7103 = callPackage ../development/haskell-modules {
|
ghc7103 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc7103;
|
buildHaskellPackages = bh.packages.ghc7103;
|
||||||
|
ghc = bh.compiler.ghc7103;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
||||||
};
|
};
|
||||||
ghc7103Binary = callPackage ../development/haskell-modules {
|
ghc7103Binary = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc7103Binary;
|
buildHaskellPackages = bh.packages.ghc7103Binary;
|
||||||
|
ghc = bh.compiler.ghc7103Binary;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
||||||
};
|
};
|
||||||
ghc802 = callPackage ../development/haskell-modules {
|
ghc802 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc802;
|
buildHaskellPackages = bh.packages.ghc802;
|
||||||
|
ghc = bh.compiler.ghc802;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
||||||
};
|
};
|
||||||
ghc822 = callPackage ../development/haskell-modules {
|
ghc821Binary = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc822;
|
buildHaskellPackages = bh.packages.ghc821Binary;
|
||||||
|
ghc = bh.compiler.ghc821Binary;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
||||||
};
|
};
|
||||||
ghc821Binary = callPackage ../development/haskell-modules {
|
ghc822 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc821Binary;
|
buildHaskellPackages = bh.packages.ghc822;
|
||||||
|
ghc = bh.compiler.ghc822;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
|
||||||
};
|
};
|
||||||
ghc841 = callPackage ../development/haskell-modules {
|
ghc841 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghc841;
|
buildHaskellPackages = bh.packages.ghc841;
|
||||||
|
ghc = bh.compiler.ghc841;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { };
|
||||||
};
|
};
|
||||||
ghcHEAD = callPackage ../development/haskell-modules {
|
ghcHEAD = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghcHEAD;
|
buildHaskellPackages = bh.packages.ghcHEAD;
|
||||||
|
ghc = bh.compiler.ghcHEAD;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
|
||||||
};
|
};
|
||||||
ghcjs = callPackage ../development/haskell-modules {
|
ghcjs = callPackage ../development/haskell-modules rec {
|
||||||
ghc = compiler.ghcjs;
|
buildHaskellPackages = ghc.bootPkgs;
|
||||||
|
ghc = bh.compiler.ghcjs;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
|
||||||
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
||||||
};
|
};
|
||||||
ghcjsHEAD = callPackage ../development/haskell-modules {
|
ghcjsHEAD = callPackage ../development/haskell-modules rec {
|
||||||
ghc = compiler.ghcjsHEAD;
|
buildHaskellPackages = ghc.bootPkgs;
|
||||||
|
ghc = bh.compiler.ghcjsHEAD;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
|
||||||
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
||||||
};
|
};
|
||||||
ghcHaLVM240 = callPackage ../development/haskell-modules {
|
ghcHaLVM240 = callPackage ../development/haskell-modules {
|
||||||
ghc = compiler.ghcHaLVM240;
|
buildHaskellPackages = bh.packages.ghcHaLVM240;
|
||||||
|
ghc = bh.compiler.ghcHaLVM240;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-halvm-2.4.0.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-halvm-2.4.0.nix { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user