haskell.compiler: unify logic determining whether NCG is available
This change only consolidates the logic for the source built GHCs which have used the same logic (at least as long as you'd only use the respective supported version ranges of the expressions as inputs).
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
let
|
||||
version = "8.10.7";
|
||||
in
|
||||
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
@@ -32,8 +36,7 @@
|
||||
libffi ? null,
|
||||
libffi_3_3 ? null,
|
||||
|
||||
useLLVM ?
|
||||
!(stdenv.targetPlatform.isx86 || stdenv.targetPlatform.isPower || stdenv.targetPlatform.isSparc),
|
||||
useLLVM ? !(import ./common-have-ncg.nix { inherit lib stdenv version; }),
|
||||
# LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
@@ -271,7 +274,7 @@ in
|
||||
|
||||
stdenv.mkDerivation (
|
||||
rec {
|
||||
version = "8.10.7";
|
||||
inherit version;
|
||||
pname = "${targetPrefix}ghc${variantSuffix}";
|
||||
|
||||
src = fetchurl {
|
||||
|
||||
@@ -39,11 +39,7 @@
|
||||
, # GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null
|
||||
|
||||
, useLLVM ? !(stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| stdenv.targetPlatform.isAarch64
|
||||
|| stdenv.targetPlatform.isGhcjs
|
||||
|| (lib.versionAtLeast version "9.12" && stdenv.targetPlatform.isRiscV64))
|
||||
, useLLVM ? !(import ./common-have-ncg.nix { inherit lib stdenv version; })
|
||||
, # LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Determines whether the Native Code Generation (NCG) backend of the given
|
||||
# GHC `version` is supported for compiling to `stdenv.targetPlatform`.
|
||||
{
|
||||
version,
|
||||
stdenv,
|
||||
lib,
|
||||
}:
|
||||
|
||||
stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| (lib.versionOlder version "9.4" && stdenv.targetPlatform.isSparc)
|
||||
|| (lib.versionAtLeast version "9.2" && stdenv.targetPlatform.isAarch64)
|
||||
|| (lib.versionAtLeast version "9.6" && stdenv.targetPlatform.isGhcjs)
|
||||
|| (lib.versionAtLeast version "9.12" && stdenv.targetPlatform.isRiscV64)
|
||||
@@ -34,13 +34,8 @@
|
||||
# GHC can be built with system libffi or a bundled one.
|
||||
libffi ? null,
|
||||
|
||||
useLLVM ?
|
||||
!(
|
||||
stdenv.targetPlatform.isx86
|
||||
|| stdenv.targetPlatform.isPower
|
||||
|| (lib.versionOlder version "9.4" && stdenv.targetPlatform.isSparc)
|
||||
|| (lib.versionAtLeast version "9.2" && stdenv.targetPlatform.isAarch64)
|
||||
),
|
||||
useLLVM ? !(import ./common-have-ncg.nix { inherit lib stdenv version; }),
|
||||
|
||||
# LLVM is conceptually a run-time-only dependency, but for
|
||||
# non-x86, we need LLVM to bootstrap later stages, so it becomes a
|
||||
# build-time dependency too.
|
||||
|
||||
Reference in New Issue
Block a user