2023-05-24 13:37:59 +00:00
|
|
|
{ lib, fetchFromGitLab, stdenv, llvmPackages_12, cargo, libiconv }:
|
2021-07-16 19:40:57 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "1.5";
|
2021-07-16 19:40:57 +00:00
|
|
|
pname = "tezos-rust-libs";
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "tezos";
|
|
|
|
repo = "tezos-rust-libs";
|
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-SuCqDZDXmWdGI/GN+3nYcUk66jnW5FQQaeTB76/rvaw=";
|
2021-07-16 19:40:57 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
nativeBuildInputs = [ llvmPackages_12.llvm cargo ];
|
|
|
|
propagatedBuildDeps = [ llvmPackages_12.libllvm ];
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
2021-07-16 19:40:57 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
cargo build \
|
|
|
|
--target-dir target-librustzcash \
|
|
|
|
--package librustzcash \
|
|
|
|
--release
|
|
|
|
|
|
|
|
cargo build \
|
|
|
|
--target-dir target-wasmer \
|
|
|
|
--package wasmer-c-api \
|
|
|
|
--no-default-features \
|
|
|
|
--features singlepass,cranelift,wat,middlewares,universal \
|
|
|
|
--release
|
2021-07-16 19:40:57 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
runHook postBuild
|
2021-07-16 19:40:57 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2021-07-16 19:40:57 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
mkdir -p $out/lib/tezos-rust-libs/rust
|
|
|
|
cp "librustzcash/include/librustzcash.h" \
|
|
|
|
"target-librustzcash/release/librustzcash.a" \
|
|
|
|
"wasmer-2.3.0/lib/c-api/wasm.h" \
|
|
|
|
"wasmer-2.3.0/lib/c-api/wasmer.h" \
|
|
|
|
"target-wasmer/release/libwasmer.a" \
|
|
|
|
"$out/lib/tezos-rust-libs"
|
|
|
|
cp -r "librustzcash/include/rust" "$out/lib/tezos-rust-libs"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
cargoVendorDir = "./vendor";
|
2021-07-16 19:40:57 +00:00
|
|
|
}
|