Merge pull request #91050 from primeos/rav1e-cargo-c

Add cargo-c and a C-API for rav1e
This commit is contained in:
Michael Weiss 2020-08-11 16:22:47 +02:00 committed by GitHub
commit 7a01d5aa42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 2 deletions

View file

@ -0,0 +1,48 @@
{ rustPlatform, stdenv, lib, fetchFromGitHub, fetchurl
, pkg-config, openssl
}:
rustPlatform.buildRustPackage rec {
pname = "cargo-c";
version = "0.6.7";
src = stdenv.mkDerivation rec {
name = "${pname}-source-${version}";
src = fetchFromGitHub {
owner = "lu-zero";
repo = pname;
rev = "v${version}";
sha256 = "0n52xh4qg12bvvp2dgx5wfj5f31qijdqahasa3qfa3c3aqq7cvvg";
};
cargoLock = fetchurl {
url = "https://github.com/lu-zero/${pname}/releases/download/v${version}/Cargo.lock";
sha256 = "0296187hsaxxmqhsrrva4qf313jwh3z08j1vxcbislxdq8xg32qb";
};
installPhase = ''
mkdir -p $out
cp -R ./* $out/
cp ${cargoLock} $out/Cargo.lock
'';
};
cargoSha256 = "1gwyszpcmss2d0lm5hvf3b48jy7b0fm7xizhrl3wd6rzw7pg06zd";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
meta = with lib; {
description = "A cargo subcommand to build and install C-ABI compatibile dynamic and static libraries";
longDescription = ''
Cargo C-ABI helpers. A cargo applet that produces and installs a correct
pkg-config file, a static library and a dynamic library, and a C header
to be used by any C (and C-compatible) software.
'';
homepage = "https://github.com/lu-zero/cargo-c";
changelog = "https://github.com/lu-zero/cargo-c/releases/tag/v${version}";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ primeos ];
};
}

View file

@ -1,4 +1,4 @@
{ rustPlatform, fetchFromGitHub, lib, nasm }:
{ rustPlatform, fetchFromGitHub, lib, nasm, cargo-c }:
rustPlatform.buildRustPackage rec {
pname = "rav1e";
@ -13,7 +13,15 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "1xaincrmpicp0skf9788w5631x1hxvifvq06hh5ribdz79zclzx3";
nativeBuildInputs = [ nasm ];
nativeBuildInputs = [ nasm cargo-c ];
postBuild = ''
cargo cbuild --release --frozen --prefix=${placeholder "out"}
'';
postInstall = ''
cargo cinstall --release --frozen --prefix=${placeholder "out"}
'';
meta = with lib; {
description = "The fastest and safest AV1 encoder";

View file

@ -9407,6 +9407,7 @@ in
cargo-audit = callPackage ../tools/package-management/cargo-audit {
inherit (darwin.apple_sdk.frameworks) Security;
};
cargo-c = callPackage ../development/tools/rust/cargo-c { };
cargo-deb = callPackage ../tools/package-management/cargo-deb {
inherit (darwin.apple_sdk.frameworks) Security;
};