From 571f3e504bf504844e8705d52f8552d6b6d115d4 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Thu, 18 Nov 2021 16:27:24 +0100 Subject: [PATCH] ghcWithPackages: list missing targets with NCG available Based on https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms, although it sadly doesn't list when the backends were introduced. * PowerPC, x86 (and x86_64) and Sparc have been supported for longer. * aarch64-darwin is new in 9.2.1 and backported to 8.10.5, 8.10.6 and 8.10.7 (check is dumb here since we'll grep for 8.10.7 anyways when upgrading) Fixes ghcWithPackages failing to evaluate on aarch64-darwin because of missing support for the platform in LLVM 9's compiler-rt. --- .../haskell-modules/with-packages-wrapper.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix index 464590fde38c..7b85d01876ed 100644 --- a/pkgs/development/haskell-modules/with-packages-wrapper.nix +++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix @@ -1,5 +1,14 @@ { lib, stdenv, ghc, llvmPackages, packages, symlinkJoin, makeWrapper -, withLLVM ? !(stdenv.targetPlatform.isx86_64 || stdenv.targetPlatform.isPowerPC) +# Include LLVM by default if GHC doesn't have native code generation support +# See https://gitlab.haskell.org/ghc/ghc/-/wikis/platforms +, withLLVM ? !(lib.any lib.id ([ + stdenv.targetPlatform.isx86 + stdenv.targetPlatform.isPowerPC + stdenv.targetPlatform.isSparc + ] ++ lib.optionals (lib.versionAtLeast ghc.version "9.2" || ghc.version == "8.10.7") [ + (stdenv.targetPlatform.isAarch64 && stdenv.targetPlatform.isDarwin) + # TODO(@sternenseemann): Is armv7a supported for iOS? + ])) , postBuild ? "" , ghcLibdir ? null # only used by ghcjs, when resolving plugins }: