From 654940f36b5dfa19d87098efca6c4dac44a84eda Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Tue, 1 Mar 2022 23:42:45 +0100 Subject: [PATCH] haskellPackages.mkDerivation: check haddock availability This change makes the haskell builder run the haddockPhase only if the haddock program is availble (for example, it's not when cross-compiling). --- pkgs/development/compilers/ghc/8.10.7.nix | 4 ++++ pkgs/development/compilers/ghc/8.8.4.nix | 4 ++++ pkgs/development/compilers/ghc/9.0.2.nix | 4 ++++ pkgs/development/compilers/ghc/9.2.2.nix | 4 ++++ pkgs/development/compilers/ghc/head.nix | 4 ++++ pkgs/development/haskell-modules/generic-builder.nix | 2 +- 6 files changed, 21 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index a8f05d6f15c..fd14501097c 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -366,6 +366,10 @@ stdenv.mkDerivation (rec { inherit llvmPackages; inherit enableShared; + # This is used by the haskell builder to query + # the presence of the haddock program. + hasHaddock = enableHaddockProgram; + # Our Cabal compiler name haskellCompilerName = "ghc-${version}"; }; diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index 8a352d0e0a9..af01582b108 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -335,6 +335,10 @@ stdenv.mkDerivation (rec { inherit llvmPackages; inherit enableShared; + # This is used by the haskell builder to query + # the presence of the haddock program. + hasHaddock = enableHaddockProgram; + # Our Cabal compiler name haskellCompilerName = "ghc-${version}"; }; diff --git a/pkgs/development/compilers/ghc/9.0.2.nix b/pkgs/development/compilers/ghc/9.0.2.nix index f7624741b68..04e29ed6686 100644 --- a/pkgs/development/compilers/ghc/9.0.2.nix +++ b/pkgs/development/compilers/ghc/9.0.2.nix @@ -331,6 +331,10 @@ stdenv.mkDerivation (rec { inherit llvmPackages; inherit enableShared; + # This is used by the haskell builder to query + # the presence of the haddock program. + hasHaddock = enableHaddockProgram; + # Our Cabal compiler name haskellCompilerName = "ghc-${version}"; }; diff --git a/pkgs/development/compilers/ghc/9.2.2.nix b/pkgs/development/compilers/ghc/9.2.2.nix index 6db6eb3b0eb..0a572bff7ef 100644 --- a/pkgs/development/compilers/ghc/9.2.2.nix +++ b/pkgs/development/compilers/ghc/9.2.2.nix @@ -331,6 +331,10 @@ stdenv.mkDerivation (rec { inherit llvmPackages; inherit enableShared; + # This is used by the haskell builder to query + # the presence of the haddock program. + hasHaddock = enableHaddockProgram; + # Our Cabal compiler name haskellCompilerName = "ghc-${version}"; }; diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 1c4bf3059d5..07ea6bda245 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -347,6 +347,10 @@ stdenv.mkDerivation (rec { inherit llvmPackages; inherit enableShared; + # This is used by the haskell builder to query + # the presence of the haddock program. + hasHaddock = enableHaddockProgram; + # Our Cabal compiler name haskellCompilerName = "ghc-${version}"; }; diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index d8137038f63..04973d3251e 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -55,7 +55,7 @@ in , changelog ? null , mainProgram ? null , doCoverage ? false -, doHaddock ? !(ghc.isHaLVM or false) +, doHaddock ? !(ghc.isHaLVM or false) && (ghc.hasHaddock or true) , doHaddockInterfaces ? doHaddock && lib.versionAtLeast ghc.version "9.0.1" , passthru ? {} , pkg-configDepends ? [], libraryPkgconfigDepends ? [], executablePkgconfigDepends ? [], testPkgconfigDepends ? [], benchmarkPkgconfigDepends ? []