Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix arm cross compilation with ghc 8.6.5 #654

Merged
merged 3 commits into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nix-tools/regenerate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ in
];
}];
}).nix-tools.components.exes.plan-to-nix;
bootstrap = if pkgs.targetPlatform.isAarch64
bootstrap = if pkgs.targetPlatform.isAarch64 && pkgs.buildPlatform.isAarch64
then haskell-nix.bootstrap.compiler.ghc882
else haskell-nix.bootstrap.compiler.ghc844;
in
Expand Down
29 changes: 13 additions & 16 deletions overlays/bootstrap.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,21 @@ let
# - What GHC version we should use for bootstrapping.
# - What Happy version we should use for bootstrapping.
buildBootstrapper =
if final.targetPlatform.isAarch64
if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
then {
ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc882;
compilerNixName = "ghc882";
happyVersion = "1.19.12";
}
else {
ghc = final.buildPackages.haskell-nix.bootstrap.compiler.ghc844;
compilerNixName = "ghc844";
happyVersion = "1.19.11";
};
# For buildPackages.buildPackages, we just care about the GHC version:
buildBuildBootstrapper =
if final.targetPlatform.isAarch64
then final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler.ghc882
else final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler.ghc844;
in {
haskell-nix = prev.haskell-nix // {
# Use this to disable the existing haskell infra structure for testing purposes
compiler =
let bootPkgs = with final.buildPackages; {
ghc = buildBuildBootstrapper;
ghc = final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
alex = final.haskell-nix.bootstrap.packages.alex-tool {
checkMaterialization = false;
};
Expand Down Expand Up @@ -338,9 +333,9 @@ in {
'' + installDeps targetPrefix);
})));

# Need to use something from 8.8.x as the default on aarch64:
# Need to use something from 8.8.x as the default to build aarch64 native compiler:
defaultCompilerNixName =
if final.targetPlatform.isAarch64
if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
then "ghc883"
else "ghc865";
ghc = final.haskell-nix.compiler."${final.haskell-nix.defaultCompilerNixName}";
Expand Down Expand Up @@ -426,7 +421,7 @@ in {
} // args);
alex = final.buildPackages.haskell-nix.alex-tool {};
happy-tool = args: final.haskell-nix.tool "happy" ({
version = buildBootstrapper.happyVersion;
version = "1.19.12";
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized + "/${
args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName
Expand Down Expand Up @@ -460,7 +455,9 @@ in {


# the bootstrap infra structure (pre-compiled ghc; bootstrapped cabal-install, ...)
bootstrap = with final.haskell-nix; let ghc = buildBootstrapper.ghc; in {
bootstrap = with final.haskell-nix;
let ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
in {
# XXX: import ../. will throw away all other overlays, config values, ...
# this is not ideal!
# get binary compilers for bootstrapping. We'll put the eventual proper
Expand Down Expand Up @@ -492,7 +489,7 @@ in {
# Only a boot compiler is suitable here
ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized/bootstrap/alex;
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
} // args);
alex = bootstrap.packages.alex-tool {};
happy-tool = args: tool "happy" ({
Expand All @@ -501,7 +498,7 @@ in {
ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
inherit (bootstrap.packages) cabal-install nix-tools hpack;
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized/bootstrap/happy;
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${buildBootstrapper.happyVersion}";
} // args);
happy = bootstrap.packages.happy-tool {};
hscolour-tool = args: (hackage-package ({
Expand All @@ -510,7 +507,7 @@ in {
# Only a boot compiler is suitable here
ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
index-state = final.haskell-nix.internalHackageIndexState;
materialized = ../materialized/bootstrap/hscolour;
materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
} // args)).components.exes.HsColour;
hscolour = bootstrap.packages.hscolour-tool {};
};
Expand Down
2 changes: 1 addition & 1 deletion overlays/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ final: prev: {
snapshots = import ../snapshots.nix { inherit (final) lib ghc-boot-packages; inherit mkPkgSet stackage excludeBootPackages; };
# Pick a recent LTS snapshot to be our "default" package set.
haskellPackages =
if final.targetPlatform.isAarch64
if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64
then snapshots."lts-15.13"
else snapshots."lts-14.13";

Expand Down