buildRustPackage: add standard package hooks
when overriding build phases also the standard hooks should be called
This commit is contained in:
parent
33cfee8177
commit
be70c02461
@ -27,7 +27,11 @@ in stdenv.mkDerivation (args // {
|
||||
|
||||
buildInputs = [ git rust.cargo rust.rustc ] ++ buildInputs;
|
||||
|
||||
configurePhase = args.configurePhase or "true";
|
||||
configurePhase = args.configurePhase or ''
|
||||
runHook preConfigure
|
||||
# noop
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
postUnpack = ''
|
||||
eval "$cargoDepsHook"
|
||||
@ -94,21 +98,27 @@ in stdenv.mkDerivation (args // {
|
||||
'' + (args.prePatch or "");
|
||||
|
||||
buildPhase = with builtins; args.buildPhase or ''
|
||||
runHook preBuild
|
||||
echo "Running cargo build --release ${concatStringsSep " " cargoBuildFlags}"
|
||||
cargo build --release ${concatStringsSep " " cargoBuildFlags}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
checkPhase = args.checkPhase or ''
|
||||
runHook preCheck
|
||||
echo "Running cargo test"
|
||||
cargo test
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
doCheck = args.doCheck or true;
|
||||
|
||||
installPhase = args.installPhase or ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
for f in $(find target/release -maxdepth 1 -type f); do
|
||||
cp $f $out/bin
|
||||
done;
|
||||
runHook postInstall
|
||||
'';
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user