haskell infra: Adds buildFlags logic

This commit is contained in:
Moritz Angermann 2018-03-17 16:55:39 +08:00 committed by John Ericson
parent affeb0cb80
commit 87afa66a63
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,7 @@ in
, buildTarget ? ""
, buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? [], benchmarkToolDepends ? []
, configureFlags ? []
, buildFlags ? []
, description ? ""
, doCheck ? !isCross && stdenv.lib.versionOlder "7.4" ghc.version
, doBenchmark ? false
@ -130,6 +131,8 @@ let
crossCabalFlagsString =
stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags);
defaultConfigureFlags = [
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
@ -345,7 +348,7 @@ stdenv.mkDerivation ({
buildPhase = ''
runHook preBuild
${setupCommand} build ${buildTarget}${crossCabalFlagsString}
${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString}
runHook postBuild
'';

View File

@ -131,6 +131,8 @@ rec {
*/
appendConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = (drv.configureFlags or []) ++ [x]; });
appendBuildFlag = drv: x: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ [x]; });
appendBuildFlags = drv: xs: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ xs; });
/* removeConfigureFlag drv x is a Haskell package like drv, but with
all cabal configure arguments that are equal to x removed.