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.
wip/yesman
John Ericson 7 years ago
parent 8560c025bc
commit 81553124cf
  1. 3
      pkgs/development/haskell-modules/default.nix
  2. 21
      pkgs/development/haskell-modules/generic-builder.nix
  3. 15
      pkgs/development/haskell-modules/make-package-set.nix
  4. 40
      pkgs/top-level/haskell-packages.nix

@ -1,4 +1,5 @@
{ pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes
, buildHaskellPackages
, compilerConfig ? (self: super: {})
, packageSetConfig ? (self: super: {})
, overrides ? (self: super: {})
@ -14,7 +15,7 @@ let
haskellPackages = pkgs.callPackage makePackageSet {
package-set = initialPackages;
inherit stdenv haskellLib ghc extensible-self;
inherit stdenv haskellLib ghc buildHaskellPackages extensible-self;
};
commonConfiguration = configurationCommon { inherit pkgs haskellLib; };

@ -1,4 +1,4 @@
{ stdenv, buildPackages, ghc
{ stdenv, buildPackages, buildHaskellPackages, ghc
, jailbreak-cabal, hscolour, cpphs, nodejs
, buildPlatform, hostPlatform
}:
@ -81,7 +81,11 @@ let
then "package-db"
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
then "package-db"
else "package-conf";
@ -147,8 +151,7 @@ let
] ++ crossCabalFlags);
setupCompileFlags = [
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
(optionalString isGhcjs "-build-runner")
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$packageConfDir")
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
# https://github.com/haskell/cabal/issues/2398
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
@ -160,14 +163,12 @@ let
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
nativeBuildInputs = [ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
buildTools ++ libraryToolDepends ++ executableToolDepends;
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
# ghcjs's hsc2hs calls out to the native hsc2hs
optional isGhcjs nativeGhc ++
optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
@ -176,12 +177,14 @@ let
ghcEnv = ghc.withPackages (p: haskellBuildInputs);
setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand;
setupCommand = "./Setup";
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
ghcCommandCaps= toUpper ghcCommand';
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
in
assert allPkgconfigDepends != [] -> pkgconfig != null;
@ -270,7 +273,7 @@ stdenv.mkDerivation ({
done
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
'';

@ -4,6 +4,10 @@
{ # package-set used for build tools (all of nixpkgs)
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)
pkgs
@ -18,8 +22,8 @@
, # compiler to use
ghc
, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and `self`
# as second, and returns a set of haskell packages
, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and
# `self` as second, and returns a set of haskell packages
package-set
, # The final, fully overriden package set usable with the nixpkgs fixpoint
@ -36,15 +40,12 @@ let
inherit (stdenv.lib) fix' extends makeOverridable;
inherit (haskellLib) overrideCabal;
buildHaskellPackages = if hostPlatform != buildPlatform
then self.ghc.bootPkgs
else self;
mkDerivationImpl = pkgs.callPackage ./generic-builder.nix {
inherit stdenv;
nodejs = buildPackages.nodejs-slim;
inherit (buildHaskellPackages) jailbreak-cabal;
inherit buildHaskellPackages;
inherit (self) ghc;
inherit (buildHaskellPackages) jailbreak-cabal;
hscolour = overrideCabal buildHaskellPackages.hscolour (drv: {
isLibrary = false;
doHaddock = false;

@ -128,48 +128,58 @@ in rec {
};
# Always get compilers from `buildPackages`
packages = let inherit (buildPackages.haskell) compiler; in {
packages = let bh = buildPackages.haskell; in {
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 { };
};
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 { };
};
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 { };
};
ghc822 = callPackage ../development/haskell-modules {
ghc = compiler.ghc822;
ghc821Binary = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc821Binary;
ghc = bh.compiler.ghc821Binary;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
};
ghc821Binary = callPackage ../development/haskell-modules {
ghc = compiler.ghc821Binary;
ghc822 = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc822;
ghc = bh.compiler.ghc822;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
};
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 { };
};
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 { };
};
ghcjs = callPackage ../development/haskell-modules {
ghc = compiler.ghcjs;
ghcjs = callPackage ../development/haskell-modules rec {
buildHaskellPackages = ghc.bootPkgs;
ghc = bh.compiler.ghcjs;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
};
ghcjsHEAD = callPackage ../development/haskell-modules {
ghc = compiler.ghcjsHEAD;
ghcjsHEAD = callPackage ../development/haskell-modules rec {
buildHaskellPackages = ghc.bootPkgs;
ghc = bh.compiler.ghcjsHEAD;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
};
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 { };
};

Loading…
Cancel
Save