rust-bin.mk 2.0 KB

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