diff options
| author | Orne Brocaar <info@brocaar.com> | 2023-07-16 01:16:44 +0800 |
|---|---|---|
| committer | Tianling Shen <cnsztl@gmail.com> | 2023-07-18 04:49:50 +0800 |
| commit | f489e019ac4a15e974518d9928ef913a157d135a (patch) | |
| tree | 03268924076cdd29085b9a75d4fcfdb60bf64274 /lang/rust | |
| parent | 5e66a69433e59c5f1089167917364f91b45b91be (diff) | |
rust: compile host package per target
While the compiled binaries are intended to run on the host system, the
rust/host package does include the target matching the configured
OpenWrt target.
If using (for example) ./scripts/env to switch between different
OpenWrt configurations, this will cause issues if the different
configuration is for a different target. In such case there will be a
mismatch between the available Rust target and OpenWrt target and the
following error will be printed:
> error[E0463]: can't find crate for `core`
> note: the `XXX` target may not be installed
This fix will add the RUSTC_TARGET_ARCH as HOST_BUILD_DIR and CARGO_HOME
suffix, such that rust/host will be compiled in case an OpenWrt
configuration change causes the RUSTC_TARGET_ARCH to change.
Fixes: #21530
Signed-off-by: Orne Brocaar <info@brocaar.com>
[Applied Jeffery To's suggestion for build and install path]
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
Diffstat (limited to 'lang/rust')
| -rw-r--r-- | lang/rust/Makefile | 6 | ||||
| -rw-r--r-- | lang/rust/rust-values.mk | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile index 0dedfc16f..3b44e5a4d 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -3,15 +3,16 @@ # Copyright (C) 2023 Luca Barbato and Donald Hoskins include $(TOPDIR)/rules.mk +include ./rust-values.mk PKG_NAME:=rust PKG_VERSION:=1.70.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz PKG_SOURCE_URL:=https://static.rust-lang.org/dist/ PKG_HASH:=b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c -HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/rustc-$(PKG_VERSION)-src +HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/rust-$(RUSTC_TARGET_ARCH)/rustc-$(PKG_VERSION)-src PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org> PKG_LICENSE:=Apache-2.0 MIT @@ -22,7 +23,6 @@ PKG_HOST_ONLY:=1 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk -include ./rust-values.mk define Package/rust SECTION:=lang diff --git a/lang/rust/rust-values.mk b/lang/rust/rust-values.mk index 7ae379823..27e7f0806 100644 --- a/lang/rust/rust-values.mk +++ b/lang/rust/rust-values.mk @@ -5,7 +5,7 @@ # Rust Environmental Vars CONFIG_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME))) RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX) -CARGO_HOME:=$(STAGING_DIR_HOSTPKG)/cargo +CARGO_HOME:=$(STAGING_DIR)/host/cargo CARGO_VARS:= ifeq ($(CONFIG_USE_MUSL),y) |
