zcashd/depends/packages/native_rust.mk

66 lines
3.9 KiB
Makefile
Raw Normal View History

package=native_rust
2022-07-12 05:07:20 -07:00
# To update the Rust compiler, change the version below and then run the script
# ./contrib/devtools/update-rust-hashes.sh
# The Rust compiler should use the same LLVM version as the Clang compiler; you
# can check this with `rustc --version -v`.
$(package)_version=1.62.1
2018-05-15 15:21:37 -07:00
$(package)_download_path=https://static.rust-lang.org/dist
$(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
2022-07-12 05:07:20 -07:00
$(package)_sha256_hash_linux=dd7d82b8fa8eae59729e1c31fe59a9de6ee61d08ab40ce016185653beebe04d2
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
2022-07-12 05:07:20 -07:00
$(package)_sha256_hash_darwin=0a04dcf2b521239826f3eaa66d77169d91e68087ccc3107b54e8aba7c02c9adf
2019-05-22 05:08:59 -07:00
$(package)_file_name_freebsd=rust-$($(package)_version)-x86_64-unknown-freebsd.tar.gz
2022-07-12 05:07:20 -07:00
$(package)_sha256_hash_freebsd=edea64139d065b3e60e76487bfb7e3e068b3253938f657dd81c5a3d03e46581f
2021-09-04 16:17:02 -07:00
$(package)_file_name_aarch64_linux=rust-$($(package)_version)-aarch64-unknown-linux-gnu.tar.gz
2022-07-12 05:07:20 -07:00
$(package)_sha256_hash_aarch64_linux=1311fa8204f895d054c23a3481de3b158a5cd3b3a6338761fee9cdf4dbf075a5
2021-09-04 16:17:02 -07:00
# Mapping from GCC canonical hosts to Rust targets
# If a mapping is not present, we assume they are identical, unless $host_os is
# "darwin", in which case we assume x86_64-apple-darwin.
$(package)_rust_target_x86_64-pc-linux-gnu=x86_64-unknown-linux-gnu
$(package)_rust_target_x86_64-w64-mingw32=x86_64-pc-windows-gnu
# Mapping from Rust targets to SHA-256 hashes
2022-07-12 05:07:20 -07:00
$(package)_rust_std_sha256_hash_aarch64-unknown-linux-gnu=6af6bac7a3ae1b2e1b9153d5d0bed124122daf8e6a8e90440701cb199c2c95d2
$(package)_rust_std_sha256_hash_x86_64-apple-darwin=c8597ca0924adbdc804014f3a39ffda7c7f98fba4c3b4095a8e67f530f7d6299
$(package)_rust_std_sha256_hash_x86_64-pc-windows-gnu=a1a7a6a6a00ee43c633d65b6d0aea643e66c11a025a3c640bff8c089c477b155
$(package)_rust_std_sha256_hash_x86_64-unknown-freebsd=04f1d52ecafba78750d384d720a6ee9c3dad2e8fb0a16f37cbd69f5b28fc8da2
define rust_target
$(if $($(1)_rust_target_$(2)),$($(1)_rust_target_$(2)),$(if $(findstring darwin,$(3)),x86_64-apple-darwin,$(if $(findstring freebsd,$(3)),x86_64-unknown-freebsd,$(2))))
endef
ifneq ($(canonical_host),$(build))
$(package)_rust_target=$(call rust_target,$(package),$(canonical_host),$(host_os))
$(package)_exact_file_name=rust-std-$($(package)_version)-$($(package)_rust_target).tar.gz
$(package)_exact_sha256_hash=$($(package)_rust_std_sha256_hash_$($(package)_rust_target))
$(package)_build_subdir=buildos
$(package)_extra_sources=$($(package)_file_name_$(build_os))
define $(package)_fetch_cmds
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_download_file),$($(package)_file_name),$($(package)_sha256_hash)) && \
$(call fetch_file,$(package),$($(package)_download_path),$($(package)_file_name_$(build_os)),$($(package)_file_name_$(build_os)),$($(package)_sha256_hash_$(build_os)))
endef
define $(package)_extract_cmds
mkdir -p $($(package)_extract_dir) && \
echo "$($(package)_sha256_hash) $($(package)_source)" > $($(package)_extract_dir)/.$($(package)_file_name).hash && \
echo "$($(package)_sha256_hash_$(build_os)) $($(package)_source_dir)/$($(package)_file_name_$(build_os))" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
mkdir $(canonical_host) && \
tar --strip-components=1 -xf $($(package)_source) -C $(canonical_host) && \
mkdir buildos && \
tar --strip-components=1 -xf $($(package)_source_dir)/$($(package)_file_name_$(build_os)) -C buildos
endef
define $(package)_stage_cmds
bash ./install.sh --without=rust-docs --destdir=$($(package)_staging_dir) --prefix=$(build_prefix) --disable-ldconfig && \
../$(canonical_host)/install.sh --destdir=$($(package)_staging_dir) --prefix=$(build_prefix) --disable-ldconfig
endef
else
define $(package)_stage_cmds
bash ./install.sh --without=rust-docs --destdir=$($(package)_staging_dir) --prefix=$(build_prefix) --disable-ldconfig
endef
endif