depends: Add flag for building with a local librustzcash repo

Usage:
$ ./zcutil/build.sh LIBRUSTZCASH_OVERRIDE=/path/to/librustzcash
This commit is contained in:
Jack Grigg 2019-09-07 04:05:56 -04:00
parent 8c1f5fa729
commit 1822eb333f
No known key found for this signature in database
GPG Key ID: 9E8255172BBF9898
3 changed files with 35 additions and 2 deletions

View File

@ -15,6 +15,8 @@ DOWNLOAD_CONNECT_TIMEOUT:=10
DOWNLOAD_RETRIES:=3 DOWNLOAD_RETRIES:=3
CRATE_REGISTRY:=vendored-sources CRATE_REGISTRY:=vendored-sources
LIBRUSTZCASH_OVERRIDE ?=
host:=$(BUILD) host:=$(BUILD)
ifneq ($(HOST),) ifneq ($(HOST),)
host:=$(HOST) host:=$(HOST)

View File

@ -36,6 +36,7 @@ The following can be set when running make: make FOO=bar
PRIORITY_DOWNLOAD_PATH: Try fetching source files from here before using their own URLs PRIORITY_DOWNLOAD_PATH: Try fetching source files from here before using their own URLs
NO_WALLET: Don't download/build/cache libs needed to enable the wallet NO_WALLET: Don't download/build/cache libs needed to enable the wallet
DEBUG: disable some optimizations and enable more runtime checking DEBUG: disable some optimizations and enable more runtime checking
LIBRUSTZCASH_OVERRIDE: Path to a local librustzcash repository
If some packages are not built, for example `make NO_WALLET=1`, the appropriate If some packages are not built, for example `make NO_WALLET=1`, the appropriate
options will be passed to bitcoin's configure. In this case, `--disable-wallet`. options will be passed to bitcoin's configure. In this case, `--disable-wallet`.

View File

@ -5,8 +5,11 @@ $(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
$(package)_download_file=$($(package)_git_commit).tar.gz $(package)_download_file=$($(package)_git_commit).tar.gz
$(package)_sha256_hash=9909ec59fa7a411c2071d6237b3363a0bc6e5e42358505cf64b7da0f58a7ff5a $(package)_sha256_hash=9909ec59fa7a411c2071d6237b3363a0bc6e5e42358505cf64b7da0f58a7ff5a
$(package)_git_commit=06da3b9ac8f278e5d4ae13088cf0a4c03d2c13f5 $(package)_git_commit=06da3b9ac8f278e5d4ae13088cf0a4c03d2c13f5
$(package)_dependencies=rust $(rust_crates) $(package)_dependencies=rust
ifeq ($(LIBRUSTZCASH_OVERRIDE),)
$(package)_dependencies+=$(rust_crates)
$(package)_patches=cargo.config 0001-Start-using-cargo-clippy-for-CI.patch remove-dev-dependencies.diff $(package)_patches=cargo.config 0001-Start-using-cargo-clippy-for-CI.patch remove-dev-dependencies.diff
endif
$(package)_rust_target=$(if $(rust_rust_target_$(canonical_host)),$(rust_rust_target_$(canonical_host)),$(canonical_host)) $(package)_rust_target=$(if $(rust_rust_target_$(canonical_host)),$(rust_rust_target_$(canonical_host)),$(canonical_host))
@ -19,12 +22,37 @@ $(package)_library_file=target/release/librustzcash.a
endif endif
define $(package)_set_vars define $(package)_set_vars
$(package)_build_opts=--frozen --release $(package)_build_opts=--release
ifeq ($(LIBRUSTZCASH_OVERRIDE),)
$(package)_build_opts+=--frozen
endif
ifneq ($(canonical_host),$(build)) ifneq ($(canonical_host),$(build))
$(package)_build_opts+=--target=$($(package)_rust_target) $(package)_build_opts+=--target=$($(package)_rust_target)
endif endif
endef endef
ifneq ($(LIBRUSTZCASH_OVERRIDE),)
define $(package)_fetch_cmds
endef
define $(package)_extract_cmds
endef
define $(package)_build_cmds
cd $(LIBRUSTZCASH_OVERRIDE) && \
$(host_prefix)/native/bin/cargo build --package librustzcash $($(package)_build_opts)
endef
define $(package)_stage_cmds
mkdir $($(package)_staging_dir)$(host_prefix)/lib/ && \
mkdir $($(package)_staging_dir)$(host_prefix)/include/ && \
cp $(LIBRUSTZCASH_OVERRIDE)/$($(package)_library_file) $($(package)_staging_dir)$(host_prefix)/lib/ && \
cp $(LIBRUSTZCASH_OVERRIDE)/librustzcash/include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
endef
else
define $(package)_preprocess_cmds define $(package)_preprocess_cmds
patch -p1 -d pairing < $($(package)_patch_dir)/0001-Start-using-cargo-clippy-for-CI.patch && \ patch -p1 -d pairing < $($(package)_patch_dir)/0001-Start-using-cargo-clippy-for-CI.patch && \
patch -p1 < $($(package)_patch_dir)/remove-dev-dependencies.diff && \ patch -p1 < $($(package)_patch_dir)/remove-dev-dependencies.diff && \
@ -42,3 +70,5 @@ define $(package)_stage_cmds
cp $($(package)_library_file) $($(package)_staging_dir)$(host_prefix)/lib/ && \ cp $($(package)_library_file) $($(package)_staging_dir)$(host_prefix)/lib/ && \
cp librustzcash/include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/ cp librustzcash/include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
endef endef
endif