yara-x: build and install C library (#381813)

This commit is contained in:
Peder Bergebakken Sundt
2025-02-17 00:44:35 +01:00
committed by GitHub
+16 -5
View File
@@ -1,9 +1,11 @@
{
lib,
rust,
stdenv,
fetchFromGitHub,
rustPlatform,
installShellFiles,
cargo-c,
testers,
yara-x,
}:
@@ -24,15 +26,24 @@ rustPlatform.buildRustPackage rec {
nativeBuildInputs = [
installShellFiles
cargo-c
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd yr \
--bash <($out/bin/yr completion bash) \
--fish <($out/bin/yr completion fish) \
--zsh <($out/bin/yr completion zsh)
postBuild = ''
${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
'';
postInstall =
''
${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd yr \
--bash <($out/bin/yr completion bash) \
--fish <($out/bin/yr completion fish) \
--zsh <($out/bin/yr completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = yara-x;
};