Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / tezos-rust-libs / default.nix
blobe59e5858eaacdf3c42945857189116e2094177ed
1 { lib, fetchFromGitLab, stdenv, llvmPackages_12, cargo, libiconv }:
3 stdenv.mkDerivation rec {
4   version = "1.5";
5   pname = "tezos-rust-libs";
6   src = fetchFromGitLab {
7     owner = "tezos";
8     repo = "tezos-rust-libs";
9     rev = "v${version}";
10     sha256 = "sha256-SuCqDZDXmWdGI/GN+3nYcUk66jnW5FQQaeTB76/rvaw=";
11   };
13   nativeBuildInputs = [ llvmPackages_12.llvm cargo ];
14   propagatedBuildDeps = [ llvmPackages_12.libllvm ];
15   buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
17   buildPhase = ''
18     runHook preBuild
20     cargo build \
21       --target-dir target-librustzcash \
22       --package librustzcash \
23       --release
25     cargo build \
26       --target-dir target-wasmer \
27       --package wasmer-c-api \
28       --no-default-features \
29       --features singlepass,cranelift,wat,middlewares,universal \
30       --release
32     runHook postBuild
33   '';
35   installPhase = ''
36     runHook preInstall
38     mkdir -p $out/lib/tezos-rust-libs/rust
39     cp "librustzcash/include/librustzcash.h" \
40         "target-librustzcash/release/librustzcash.a" \
41         "wasmer-2.3.0/lib/c-api/wasm.h" \
42         "wasmer-2.3.0/lib/c-api/wasmer.h" \
43         "target-wasmer/release/libwasmer.a" \
44         "$out/lib/tezos-rust-libs"
45     cp -r "librustzcash/include/rust" "$out/lib/tezos-rust-libs"
47     runHook postInstall
48   '';
50   cargoVendorDir = "./vendor";