From 3584ce2fa914cd85da2b89a75d3fd4fe4ba575da Mon Sep 17 00:00:00 2001 From: Ulrik Strid Date: Tue, 2 May 2023 10:42:43 +0200 Subject: [PATCH] tezos-rust-libs: 1.0 -> 1.5 --- .../libraries/tezos-rust-libs/default.nix | 59 +++++++++++-------- .../ocaml-modules/bls12-381/legacy.nix | 40 ------------- pkgs/top-level/ocaml-packages.nix | 1 - 3 files changed, 36 insertions(+), 64 deletions(-) delete mode 100644 pkgs/development/ocaml-modules/bls12-381/legacy.nix diff --git a/pkgs/development/libraries/tezos-rust-libs/default.nix b/pkgs/development/libraries/tezos-rust-libs/default.nix index 67826f07a43..72163acba83 100644 --- a/pkgs/development/libraries/tezos-rust-libs/default.nix +++ b/pkgs/development/libraries/tezos-rust-libs/default.nix @@ -1,37 +1,50 @@ -{ lib, fetchFromGitLab, rustPlatform }: +{ lib, fetchFromGitLab, stdenv, llvmPackages_12, cargo }: -rustPlatform.buildRustPackage rec { +stdenv.mkDerivation rec { + version = "1.5"; pname = "tezos-rust-libs"; - version = "1.0"; - src = fetchFromGitLab { owner = "tezos"; repo = "tezos-rust-libs"; rev = "v${version}"; - sha256 = "1ffkzbvb0ls4wk9205g3xh2c26cmwnl68x43gh6dm9z4xsic94v5"; + sha256 = "sha256-SuCqDZDXmWdGI/GN+3nYcUk66jnW5FQQaeTB76/rvaw="; }; - cargoSha256 = "0dgyqfr3dvvdwdi1wvpd7v9j21740jy4zwrwiwknw7csb4bq9wfx"; + nativeBuildInputs = [ llvmPackages_12.llvm cargo ]; + propagatedBuildDeps = [ llvmPackages_12.libllvm ]; - preBuild = '' - mkdir .cargo - mv cargo-config .cargo/config + 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 + + runHook postBuild ''; - postInstall = '' - cp -r rustc-bls12-381/include $out/include - cp -r librustzcash/include $out - cp -r $out/lib $out/tmp - mkdir $out/lib/tezos-rust-libs - mv $out/tmp/ $out/lib/tezos-rust-libs/ + installPhase = '' + runHook preInstall + + 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 ''; - doCheck = true; - - meta = { - homepage = "https://gitlab.com/tezos/tezos-rust-libs"; - description = "Tezos: all rust dependencies and their dependencies"; - license = lib.licenses.mit; - maintainers = [ lib.maintainers.ulrikstrid ]; - }; + cargoVendorDir = "./vendor"; } diff --git a/pkgs/development/ocaml-modules/bls12-381/legacy.nix b/pkgs/development/ocaml-modules/bls12-381/legacy.nix deleted file mode 100644 index 596001da06a..00000000000 --- a/pkgs/development/ocaml-modules/bls12-381/legacy.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ lib -, buildDunePackage -, fetchFromGitLab -, bls12-381-gen -, ctypes -, ff-pbt -, ff-sig -, tezos-rust-libs -, zarith -, alcotest -}: - -buildDunePackage rec { - pname = "bls12-381-legacy"; - - inherit (bls12-381-gen) version src doCheck; - - duneVersion = "3"; - - minimalOCamlVersion = "4.08"; - - propagatedBuildInputs = [ - bls12-381-gen - ctypes - ff-pbt - ff-sig - tezos-rust-libs - zarith - ]; - - checkInputs = [ - alcotest - ]; - - meta = { - homepage = "https://gitlab.com/dannywillems/ocaml-bls12-381"; - description = "UNIX version of BLS12-381 primitives, not implementating the virtual package bls12-381"; - license = lib.licenses.mit; - }; -} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index e5fb318a1de..e17454d9dd6 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -104,7 +104,6 @@ let bls12-381 = callPackage ../development/ocaml-modules/bls12-381 { }; bls12-381-gen = callPackage ../development/ocaml-modules/bls12-381/gen.nix { }; - bls12-381-hash = callPackage ../development/ocaml-modules/bls12-381-hash { }; bls12-381-signature = callPackage ../development/ocaml-modules/bls12-381-signature { };