From 97ea621a560b779307cc3121992089707a984236 Mon Sep 17 00:00:00 2001 From: volth Date: Sun, 14 Jul 2019 22:15:57 +0000 Subject: [PATCH] perlPackages.buildPerlModule: allow pre/post hooks buildPerlModule did not allow to specify hooks like preCheck or postInstall it also did not allow to override buildPhase or installPhase --- pkgs/top-level/perl-packages.nix | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index f78cacd08be..dd75f4e5b20 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -41,13 +41,29 @@ let }; # Helper functions for packages that use Module::Build to build. - buildPerlModule = { buildInputs ? [], ... } @ args: - buildPerlPackage (args // { - buildInputs = buildInputs ++ [ ModuleBuild ]; - preConfigure = "touch Makefile.PL"; - buildPhase = "perl Build.PL --prefix=$out; ./Build build"; - installPhase = "./Build install"; - checkPhase = "./Build test"; + buildPerlModule = args: + buildPerlPackage ({ + buildPhase = '' + runHook preBuild + perl Build.PL --prefix=$out; ./Build build + runHook postBuild + ''; + installPhase = '' + runHook preInstall + ./Build install + runHook postInstall + ''; + checkPhase = '' + runHook preCheck + ./Build test + runHook postCheck + ''; + } // args // { + preConfigure = '' + touch Makefile.PL + ${args.preConfigure or ""} + ''; + buildInputs = (args.buildInputs or []) ++ [ ModuleBuild ]; }); /* Construct a perl search path (such as $PERL5LIB) @@ -432,10 +448,6 @@ let buildInputs = [ pkgs.curl FileWhich IOAll ModuleBuildTiny PathClass TestException TestNoWarnings TestOutput TestSpec TestTempDirTiny ]; propagatedBuildInputs = [ CPANPerlReleases CaptureTiny DevelPatchPerl locallib ]; - preConfigure = '' - patchShebangs . - ''; - doCheck = false; meta = { @@ -6119,7 +6131,7 @@ let sha256 = "c065fcd3e2f22ae769937bcc971b91f80294d5009fac140bfba83bf7d35305e3"; }; configurePhase = '' - preConfigure || true + runHook preConfigure perl Build.PL PREFIX="$out" prefix="$out" ''; propagatedBuildInputs = [ IPCSystemSimple ];