2024-06-20 14:57:18 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
rust,
|
|
|
|
stdenv,
|
|
|
|
rustPlatform,
|
|
|
|
fetchCrate,
|
|
|
|
pkg-config,
|
|
|
|
cargo-c,
|
|
|
|
darwin,
|
|
|
|
libgit2,
|
|
|
|
libiconv,
|
|
|
|
nasm,
|
|
|
|
testers,
|
|
|
|
zlib,
|
|
|
|
rav1e,
|
2022-12-17 10:02:37 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
rustPlatform.buildRustPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "rav1e";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "0.7.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchCrate {
|
|
|
|
inherit pname version;
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-Db7qb7HBAy6lniIiN07iEzURmbfNtuhmgJRv7OUagUM=";
|
2020-11-21 19:51:51 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
cargoHash = "sha256-VyQ6n2kIJ7OjK6Xlf0T0GNsBvgESRETzKZDZzAn8ZuY=";
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
depsBuildBuild = [ pkg-config ];
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cargo-c
|
|
|
|
libgit2
|
|
|
|
nasm
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
2020-08-20 17:08:02 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
buildInputs =
|
|
|
|
[ zlib ]
|
|
|
|
++ lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Darwin uses `llvm-strip`, which results in link errors when using `-x` to strip the asm library
|
|
|
|
# and linking it with cctools ld64.
|
|
|
|
postPatch = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
2024-01-25 14:12:00 +00:00
|
|
|
substituteInPlace build.rs --replace-fail '.arg("-x")' '.arg("-S")'
|
2023-07-15 17:15:38 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
checkType = "debug";
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
postBuild = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
|
2020-08-20 17:08:02 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2023-11-16 04:20:00 +00:00
|
|
|
${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
|
2020-08-20 17:08:02 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion { package = rav1e; };
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Fastest and safest AV1 encoder";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
|
|
|
rav1e is an AV1 video encoder. It is designed to eventually cover all use
|
|
|
|
cases, though in its current form it is most suitable for cases where
|
|
|
|
libaom (the reference encoder) is too slow.
|
|
|
|
Features: https://github.com/xiph/rav1e#features
|
|
|
|
'';
|
2020-11-21 19:51:51 +00:00
|
|
|
homepage = "https://github.com/xiph/rav1e";
|
2020-06-02 18:00:15 +00:00
|
|
|
changelog = "https://github.com/xiph/rav1e/releases/tag/v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
license = lib.licenses.bsd2;
|
|
|
|
maintainers = with lib.maintainers; [ getchoo ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "rav1e";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|