haskell-generic-builder: update and jailbreak cabal files before patchPhase is run

The updated and jailbroken Cabal file must be in place before the
'patchPhase' hook is run, otherwise we cannot use that hook to patch the
Cabal file! Resolves https://github.com/NixOS/nixpkgs/issues/5922.

As an added bonus, this change makes the "jailbreakPhase" obsolete.
This commit is contained in:
Peter Simons 2015-02-25 20:15:26 +01:00
parent d732039ecc
commit 3021f2f529
1 changed files with 9 additions and 16 deletions

View File

@ -111,7 +111,7 @@ stdenv.mkDerivation ({
name = "${optionalString hasActiveLibrary "haskell-"}${pname}-${version}"; name = "${optionalString hasActiveLibrary "haskell-"}${pname}-${version}";
prePhases = ["setupCompilerEnvironmentPhase"]; prePhases = ["setupCompilerEnvironmentPhase"];
preConfigurePhases = ["jailbreakPhase" "compileBuildDriverPhase"]; preConfigurePhases = ["compileBuildDriverPhase"];
preInstallPhases = ["haddockPhase"]; preInstallPhases = ["haddockPhase"];
inherit src; inherit src;
@ -121,6 +121,14 @@ stdenv.mkDerivation ({
LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase. LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.
prePatch = optionalString (editedCabalFile != null) ''
echo "Replacing Cabal file with edited version ${newCabalFile}."
cp ${newCabalFile} ${pname}.cabal
'' + optionalString jailbreak ''
echo "Running jailbreak-cabal to lift version restrictions on build inputs."
${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
'' + prePatch;
setupCompilerEnvironmentPhase = '' setupCompilerEnvironmentPhase = ''
runHook preSetupCompilerEnvironment runHook preSetupCompilerEnvironment
@ -155,20 +163,6 @@ stdenv.mkDerivation ({
runHook postSetupCompilerEnvironment runHook postSetupCompilerEnvironment
''; '';
jailbreakPhase = ''
runHook preJailbreak
${optionalString (editedCabalFile != null) ''
echo "Replacing Cabal file with edited version ${newCabalFile}."
cp ${newCabalFile} ${pname}.cabal
''}${optionalString jailbreak ''
echo "Running jailbreak-cabal to lift version restrictions on build inputs."
${jailbreak-cabal}/bin/jailbreak-cabal ${pname}.cabal
''}
runHook postJailbreak
'';
compileBuildDriverPhase = '' compileBuildDriverPhase = ''
runHook preCompileBuildDriver runHook preCompileBuildDriver
@ -281,7 +275,6 @@ stdenv.mkDerivation ({
// optionalAttrs (configureFlags != []) { inherit configureFlags; } // optionalAttrs (configureFlags != []) { inherit configureFlags; }
// optionalAttrs (patches != []) { inherit patches; } // optionalAttrs (patches != []) { inherit patches; }
// optionalAttrs (patchPhase != "") { inherit patchPhase; } // optionalAttrs (patchPhase != "") { inherit patchPhase; }
// optionalAttrs (prePatch != "") { inherit prePatch; }
// optionalAttrs (postPatch != "") { inherit postPatch; } // optionalAttrs (postPatch != "") { inherit postPatch; }
// optionalAttrs (preConfigure != "") { inherit preConfigure; } // optionalAttrs (preConfigure != "") { inherit preConfigure; }
// optionalAttrs (postConfigure != "") { inherit postConfigure; } // optionalAttrs (postConfigure != "") { inherit postConfigure; }