Auto merge of #4129 - str4d:librustzcash-dev-tooling, r=Eirik0
Developer tooling for librustzcash Closes #4106.
This commit is contained in:
commit
f25d36b9e8
|
@ -15,6 +15,8 @@ DOWNLOAD_CONNECT_TIMEOUT:=10
|
|||
DOWNLOAD_RETRIES:=3
|
||||
CRATE_REGISTRY:=vendored-sources
|
||||
|
||||
LIBRUSTZCASH_OVERRIDE ?=
|
||||
|
||||
host:=$(BUILD)
|
||||
ifneq ($(HOST),)
|
||||
host:=$(HOST)
|
||||
|
|
|
@ -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
|
||||
NO_WALLET: Don't download/build/cache libs needed to enable the wallet
|
||||
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
|
||||
options will be passed to bitcoin's configure. In this case, `--disable-wallet`.
|
||||
|
|
|
@ -40,7 +40,7 @@ endef
|
|||
|
||||
define vendor_crate_source
|
||||
mkdir -p $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY) && \
|
||||
cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_name) && \
|
||||
cp -r $($(1)_extract_dir) $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \
|
||||
cd $($(1)_staging_prefix_dir)/$(CRATE_REGISTRY)/$($(1)_crate_versioned_name) && \
|
||||
rm -r `basename $($(1)_patch_dir)` .stamp_* .$($(1)_file_name).hash
|
||||
endef
|
||||
|
|
|
@ -5,8 +5,11 @@ $(package)_file_name=$(package)-$($(package)_git_commit).tar.gz
|
|||
$(package)_download_file=$($(package)_git_commit).tar.gz
|
||||
$(package)_sha256_hash=9909ec59fa7a411c2071d6237b3363a0bc6e5e42358505cf64b7da0f58a7ff5a
|
||||
$(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
|
||||
endif
|
||||
|
||||
$(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
|
||||
|
||||
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))
|
||||
$(package)_build_opts+=--target=$($(package)_rust_target)
|
||||
endif
|
||||
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
|
||||
patch -p1 -d pairing < $($(package)_patch_dir)/0001-Start-using-cargo-clippy-for-CI.patch && \
|
||||
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 librustzcash/include/librustzcash.h $($(package)_staging_dir)$(host_prefix)/include/
|
||||
endef
|
||||
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package=crate_CRATEFILE
|
||||
$(package)_crate_name=CRATENAME
|
||||
$(package)_version=CRATEVER
|
||||
$(package)_download_path=https://static.crates.io/crates/$($(package)_crate_name)
|
||||
$(package)_file_name=$($(package)_crate_name)-$($(package)_version).crate
|
||||
$(package)_sha256_hash=CRATEHASH
|
||||
$(package)_crate_versioned_name=$($(package)_crate_name)
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
$(call generate_crate_checksum,$(package))
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(call vendor_crate_source,$(package))
|
||||
endef
|
|
@ -0,0 +1,12 @@
|
|||
pkgdir=$(dirname $0)
|
||||
|
||||
cratefile=$(echo "$1" | tr '-' '_')
|
||||
cratename=$1
|
||||
cratever=$2
|
||||
cratehash=$(curl "https://static.crates.io/crates/$cratename/$cratename-$cratever.crate" | sha256sum | awk '{print $1}')
|
||||
|
||||
cat "$pkgdir/vendorcrate.mk" |
|
||||
sed "s/CRATEFILE/$cratefile/g" |
|
||||
sed "s/CRATENAME/$cratename/g" |
|
||||
sed "s/CRATEVER/$cratever/g" |
|
||||
sed "s/CRATEHASH/$cratehash/g" > "$pkgdir/crate_$cratefile.mk"
|
Loading…
Reference in New Issue