Unverified Commit 659f35f7 authored by Toma's avatar Toma Committed by GitHub
Browse files

zcash: don't use custom vendoring logic (#403693)

parents e9fad199 5961e444
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
  libevent,
  libsodium,
  makeWrapper,
  rustc,
  rustPlatform,
  pkg-config,
  Security,
@@ -25,7 +26,7 @@
  zeromq,
}:

rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
stdenv.mkDerivation rec {
  pname = "zcash";
  version = "5.4.2";

@@ -36,14 +37,16 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
    hash = "sha256-XGq/cYUo43FcpmRDO2YiNLCuEQLsTFLBFC4M1wM29l8=";
  };

  prePatch = lib.optionalString stdenv.hostPlatform.isAarch64 ''
    substituteInPlace .cargo/config.offline \
      --replace "[target.aarch64-unknown-linux-gnu]" "" \
      --replace "linker = \"aarch64-linux-gnu-gcc\"" ""
  '';
  patches = [
    # upstream has a custom way of specifying a cargo vendor-directory
    # we'll remove that logic, since cargoSetupHook from nixpkgs works better
    ./dont-use-custom-vendoring-logic.patch
  ];

  useFetchCargoVendor = true;
  cargoHash = "sha256-VBqasLpxqI4kr73Mr7OVuwb2OIhUwnY9CTyZZOyEElU=";
  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit pname version src;
    hash = "sha256-VBqasLpxqI4kr73Mr7OVuwb2OIhUwnY9CTyZZOyEElU=";
  };

  nativeBuildInputs = [
    autoreconfHook
@@ -53,6 +56,8 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
    hexdump
    makeWrapper
    pkg-config
    rustc
    rustPlatform.cargoSetupHook
  ];

  buildInputs =
@@ -69,19 +74,6 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec {
      Security
    ];

  # Use the stdenv default phases (./configure; make) instead of the
  # ones from buildRustPackage.
  configurePhase = "configurePhase";
  dontCargoBuild = true;
  dontCargoCheck = true;
  dontCargoInstall = true;

  postPatch = ''
    # Have to do this here instead of in preConfigure because
    # cargoDepsCopy gets unset after postPatch.
    configureFlagsArray+=("RUST_VENDORED_SOURCES=$cargoDepsCopy")
  '';

  CXXFLAGS = [
    "-I${lib.getDev utf8cpp}/include/utf8cpp"
    "-I${lib.getDev cxx-rs}/include"
+16 −0
Original line number Diff line number Diff line
diff --git a/src/Makefile.am b/src/Makefile.am
index 8b14284..e614755 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -121,10 +121,7 @@ else
 RUST_BUILD_OPTS += --locked --offline
 
 CARGO_CONFIGURED = $(top_srcdir)/.cargo/.configured-for-offline
-$(CARGO_CONFIGURED): $(top_srcdir)/.cargo/config.offline
-	$(AM_V_at)rm -f $(top_srcdir)/.cargo/.configured-for-online
-	$(AM_V_at)cp $< $(top_srcdir)/.cargo/config
-	$(AM_V_at)echo "directory = \"$(RUST_VENDORED_SOURCES)\"" >>$(top_srcdir)/.cargo/config
+$(CARGO_CONFIGURED):
 	$(AM_V_at)touch $@
 endif
 if ENABLE_SHANI