mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-21 13:13:33 +00:00
e3e57b8f18
We need this stuff to be available in lib so make-derivation.nix can access it to construct the Meson cross file. This has a couple of other advantages: - It makes Rust less special. Now figuring out what Rust calls a platform is the same as figuring out what Linux or QEMU call it. - We can unify the schema used to define Rust targets, and the schema used to access those values later. Just like you can set "config" or "system" in a platform definition, and then access those same keys on the elaborated platform, you can now set "rustcTarget" in your crossSystem, and then access "stdenv.hostPlatform.rustcTarget" in your code. "rustcTarget", "rustcTargetSpec", "cargoShortTarget", and "cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because these are not exposed to code by the compiler, and are not standardized. The arch/os/etc. variables are all named to match the forms in the Rust target spec JSON. The new rust.target-family only takes a list, since we don't need to worry about backwards compatibility when that name is used. The old APIs are all still functional with no warning for now, so that it's possible for external code to use a single API on both 23.05 and 23.11. We can introduce the warnings once 23.05 is EOL, and make them hard errors when 23.11 is EOL.
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchCrate
|
|
, cargo-c
|
|
, rust
|
|
, stdenv
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "libdovi";
|
|
version = "3.1.2";
|
|
|
|
src = fetchCrate {
|
|
pname = "dolby_vision";
|
|
inherit version;
|
|
hash = "sha256-eLmGswgxtmqGc9f8l/9qvwSm+8bi06q+Ryvo7Oyr7s0=";
|
|
};
|
|
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
|
|
postPatch = ''
|
|
ln -s ${./Cargo.lock} Cargo.lock
|
|
'';
|
|
|
|
nativeBuildInputs = [ cargo-c ];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
${rust.envVars.setEnv} cargo cbuild -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
${rust.envVars.setEnv} cargo cinstall -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
|
|
runHook postInstall
|
|
'';
|
|
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
${rust.envVars.setEnv} cargo ctest -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget}
|
|
runHook postCheck
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "C library for Dolby Vision metadata parsing and writing";
|
|
homepage = "https://crates.io/crates/dolby_vision";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ kranzes ];
|
|
};
|
|
}
|