1################################################################################ 2# 3# rust 4# 5################################################################################ 6 7RUST_VERSION = 1.54.0 8RUST_SOURCE = rustc-$(RUST_VERSION)-src.tar.xz 9RUST_SITE = https://static.rust-lang.org/dist 10RUST_LICENSE = Apache-2.0 or MIT 11RUST_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT 12 13HOST_RUST_PROVIDES = host-rustc 14 15HOST_RUST_DEPENDENCIES = \ 16 toolchain \ 17 host-rust-bin \ 18 host-openssl \ 19 $(BR2_CMAKE_HOST_DEPENDENCY) 20 21ifeq ($(BR2_PACKAGE_PYTHON3),y) 22HOST_RUST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR) 23HOST_RUST_DEPENDENCIES += host-python3 24else 25HOST_RUST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR) 26HOST_RUST_DEPENDENCIES += host-python 27endif 28 29HOST_RUST_VERBOSITY = $(if $(VERBOSE),2,0) 30 31# Some vendor crates contain Cargo.toml.orig files. The associated 32# .cargo-checksum.json file will contain a checksum for Cargo.toml.orig but 33# support/scripts/apply-patches.sh will delete them. This will cause the build 34# to fail, as Cargo will not be able to find the file and verify the checksum. 35# So, remove all Cargo.toml.orig entries from the affected .cargo-checksum.json 36# files 37define HOST_RUST_EXCLUDE_ORIG_FILES 38 for file in $$(find $(@D) -name '*.orig'); do \ 39 crate=$$(dirname $${file}); \ 40 fn=$${crate}/.cargo-checksum.json; \ 41 sed -i -e 's/"Cargo.toml.orig":"[a-z0-9]\+",//g' $${fn}; \ 42 done 43endef 44 45HOST_RUST_POST_EXTRACT_HOOKS += HOST_RUST_EXCLUDE_ORIG_FILES 46 47define HOST_RUST_CONFIGURE_CMDS 48 ( \ 49 echo '[build]'; \ 50 echo 'target = ["$(RUSTC_TARGET_NAME)"]'; \ 51 echo 'cargo = "$(HOST_RUST_BIN_DIR)/cargo/bin/cargo"'; \ 52 echo 'rustc = "$(HOST_RUST_BIN_DIR)/rustc/bin/rustc"'; \ 53 echo 'python = "$(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION)"'; \ 54 echo 'submodules = false'; \ 55 echo 'vendor = true'; \ 56 echo 'extended = true'; \ 57 echo 'tools = ["cargo"]'; \ 58 echo 'compiler-docs = false'; \ 59 echo 'docs = false'; \ 60 echo 'verbose = $(HOST_RUST_VERBOSITY)'; \ 61 echo '[install]'; \ 62 echo 'prefix = "$(HOST_DIR)"'; \ 63 echo 'sysconfdir = "$(HOST_DIR)/etc"'; \ 64 echo '[rust]'; \ 65 echo 'channel = "stable"'; \ 66 echo '[target.$(RUSTC_TARGET_NAME)]'; \ 67 echo 'cc = "$(TARGET_CROSS)gcc"'; \ 68 echo '[llvm]'; \ 69 echo 'ninja = false'; \ 70 ) > $(@D)/config.toml 71endef 72 73define HOST_RUST_BUILD_CMDS 74 cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION) x.py build 75endef 76 77define HOST_RUST_INSTALL_CMDS 78 cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION) x.py dist 79 cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION) x.py install 80endef 81 82$(eval $(host-generic-package)) 83