From 1dc7345389a2baced186589cab9824cec3dc0281 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Thu, 25 Jan 2024 14:41:37 +0100 Subject: [PATCH] =?UTF-8?q?haskell.compiler.ghc981:=20build=20stage=202=20?= =?UTF-8?q?compiler=20for=20=E2=80=9Cnative=20cross=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we are building compiler for a platform we can execute ourselves, we can build a proper stage2 compiler which unlocks some features that are interesting for e.g. pkgsStatic. The resulting compiler is technically a native compiler that's prefixed. --- pkgs/development/compilers/ghc/common-hadrian.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix index 079bbefbae4c..522bcb10222b 100644 --- a/pkgs/development/compilers/ghc/common-hadrian.nix +++ b/pkgs/development/compilers/ghc/common-hadrian.nix @@ -116,8 +116,11 @@ -- no way to set this via the command line finalStage :: Stage finalStage = ${ - if stdenv.hostPlatform == stdenv.targetPlatform - then "Stage2" # native compiler + # Always build the stage 2 compiler if possible. Note we can currently + # assume hostPlatform == buildPlatform. + # TODO(@sternenseemann): improve this condition when we can cross-compile GHC + if stdenv.hostPlatform.canExecute stdenv.targetPlatform + then "Stage2" # native compiler or “native” cross e.g. pkgsStatic else "Stage1" # cross compiler }