Skip to content

Commit

Permalink
rav1e: use rust.envVars
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Joseph authored and alyssais committed Sep 26, 2023
1 parent 6b4ae0e commit 33c0b7f
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions pkgs/tools/video/rav1e/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@
let
rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform;

# TODO: if another package starts using cargo-c (seems likely),
# factor this out into a makeCargoChook expression in
# pkgs/build-support/rust/hooks/default.nix
ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform;
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
setEnvVars = ''
env \
"CC_${rustBuildPlatform}"="${ccForBuild}" \
"CXX_${rustBuildPlatform}"="${cxxForBuild}" \
"CC_${rustTargetPlatform}"="${ccForHost}" \
"CXX_${rustTargetPlatform}"="${cxxForHost}" \
'';

in rustPlatform.buildRustPackage rec {
pname = "rav1e";
version = "0.6.6";
Expand Down Expand Up @@ -64,13 +47,11 @@ in rustPlatform.buildRustPackage rec {
checkType = "debug";

postBuild = ''
${setEnvVars} \
cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
'';

postInstall = ''
${setEnvVars} \
cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec}
'';

meta = with lib; {
Expand Down

0 comments on commit 33c0b7f

Please sign in to comment.