1################################################################################
2#
3# rust-bin
4#
5################################################################################
6
7# When updating this version, check whether support/download/cargo-post-process
8# still generates the same archives.
9RUST_BIN_VERSION = 1.74.1
10RUST_BIN_SITE = https://static.rust-lang.org/dist
11RUST_BIN_LICENSE = Apache-2.0 or MIT
12RUST_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
13
14HOST_RUST_BIN_PROVIDES = host-rustc
15
16HOST_RUST_BIN_SOURCE = rust-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
17
18ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
19HOST_RUST_BIN_EXTRA_DOWNLOADS += rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME).tar.xz
20endif
21
22HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUSTC_HOST_NAME)
23
24define HOST_RUST_BIN_LIBSTD_EXTRACT
25	mkdir -p $(@D)/std
26	$(foreach f,$(HOST_RUST_BIN_EXTRA_DOWNLOADS), \
27		$(call suitable-extractor,$(f)) $(HOST_RUST_BIN_DL_DIR)/$(f) | \
28			$(TAR) -C $(@D)/std $(TAR_OPTIONS) -
29	)
30	mkdir -p $(@D)/rustc/lib/rustlib/$(RUSTC_HOST_NAME)/lib
31	cd $(@D)/rustc/lib/rustlib/$(RUSTC_HOST_NAME)/lib; \
32		ln -sf ../../../../../$(HOST_RUST_BIN_LIBSTD_HOST_PREFIX)/lib/rustlib/$(RUSTC_HOST_NAME)/lib/* .
33endef
34
35HOST_RUST_BIN_POST_EXTRACT_HOOKS += HOST_RUST_BIN_LIBSTD_EXTRACT
36
37HOST_RUST_BIN_INSTALL_COMMON_OPTS = \
38	--prefix=$(HOST_DIR) \
39	--disable-ldconfig
40
41HOST_RUST_BIN_INSTALL_OPTS = \
42	$(HOST_RUST_BIN_INSTALL_COMMON_OPTS) \
43	--components=rustc,cargo,rust-std-$(RUSTC_HOST_NAME)
44
45define HOST_RUST_BIN_INSTALL_RUSTC
46	(cd $(@D); \
47		./install.sh $(HOST_RUST_BIN_INSTALL_OPTS))
48endef
49
50ifeq ($(BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS),y)
51define HOST_RUST_BIN_INSTALL_LIBSTD_TARGET
52	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME); \
53		./install.sh $(HOST_RUST_BIN_INSTALL_COMMON_OPTS))
54endef
55endif
56
57define HOST_RUST_BIN_INSTALL_CMDS
58	$(HOST_RUST_BIN_INSTALL_RUSTC)
59	$(HOST_RUST_BIN_INSTALL_LIBSTD_TARGET)
60endef
61
62HOST_RUST_BIN_POST_INSTALL_HOOKS += HOST_RUST_INSTALL_CARGO_CONFIG
63
64$(eval $(host-generic-package))
65