From f77650a6ac0eb0336c7f34e63f9b3463bdd115b2 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 13 Apr 2018 21:42:50 -0600 Subject: [PATCH] depends: Configure librustzcash for cross-compiling --- depends/packages/librustzcash.mk | 15 +++++++++++++-- depends/patches/librustzcash/cargo.config | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/depends/packages/librustzcash.mk b/depends/packages/librustzcash.mk index 46cf909f1..728378732 100644 --- a/depends/packages/librustzcash.mk +++ b/depends/packages/librustzcash.mk @@ -8,18 +8,29 @@ $(package)_git_commit=f5d2afb4eabac29b1b1cc860d66e45a5b48b4f88 $(package)_dependencies=rust $(rust_crates) $(package)_patches=cargo.config +ifeq ($(host_os),mingw32) +$(package)_library_file=target/x86_64-pc-windows-gnu/release/rustzcash.lib +else +$(package)_library_file=target/release/librustzcash.a +endif + +define $(package)_set_vars +$(package)_build_opts=--frozen --release +$(package)_build_opts_mingw32=--target=x86_64-pc-windows-gnu +endef + define $(package)_preprocess_cmds mkdir .cargo && \ cat $($(package)_patch_dir)/cargo.config | sed 's|CRATE_REGISTRY|$(host_prefix)/$(CRATE_REGISTRY)|' > .cargo/config endef define $(package)_build_cmds - cargo build --frozen --release + cargo build $($(package)_build_opts) endef define $(package)_stage_cmds mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \ mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \ - cp target/release/librustzcash.a $($(package)_staging_dir)$(host_prefix)/lib/ && \ + cp $($(package)_library_file) $($(package)_staging_dir)$(host_prefix)/lib/ && \ cp include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/ endef diff --git a/depends/patches/librustzcash/cargo.config b/depends/patches/librustzcash/cargo.config index 7696632a1..a54c9a4a8 100644 --- a/depends/patches/librustzcash/cargo.config +++ b/depends/patches/librustzcash/cargo.config @@ -13,3 +13,6 @@ replace-with = "vendored-sources" [source.vendored-sources] directory = "CRATE_REGISTRY" + +[target.x86_64-pc-windows-gnu] +linker = "x86_64-w64-mingw32-gcc"