Skip to content

Commit

Permalink
Merge pull request #225360 from amjoseph-nixpkgs/pr/fixcross/rav1e-an…
Browse files Browse the repository at this point in the history
…d-dont-spam-everybody
  • Loading branch information
Artturin committed Apr 15, 2023
2 parents 9d42684 + 4aa036f commit 1bb2362
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion pkgs/tools/video/rav1e/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,29 @@
, zlib
, libiconv
, Security
, buildPackages
}:

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.3";
Expand All @@ -38,11 +57,13 @@ in rustPlatform.buildRustPackage rec {

checkType = "debug";

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

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

Expand Down

0 comments on commit 1bb2362

Please sign in to comment.