From: Jeffery To Date: Fri, 22 Sep 2023 16:02:01 +0000 (+0800) Subject: rust: Install to $(STAGING_DIR)/host X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c3247d59e8da319a65ac67283b78e7c9eba8fae7;p=feed%2Fpackages.git rust: Install to $(STAGING_DIR)/host This allows rustc/cargo/etc to be called without having to set PATH, as $(STAGING_DIR)/host/bin is already in PATH. This also fixes CARGO_HOME not being set during Host/Configure and Host/Compile. Signed-off-by: Jeffery To (cherry picked from commit 49aaf19c65a35c37725ead7a438684411b512d6f) --- diff --git a/lang/python/python3-host.mk b/lang/python/python3-host.mk index ca5cb64baa..6ca002587c 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -78,8 +78,7 @@ HOST_PYTHON3_VARS = \ CFLAGS="$(HOST_CFLAGS)" \ CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \ LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath$(comma)$(STAGING_DIR_HOSTPKG)/lib" \ - CARGO_HOME="$(CARGO_HOME)" \ - PATH="$(CARGO_HOME)/bin:$(PATH)" + CARGO_HOME="$(CARGO_HOME)" # $(1) => directory of python script # $(2) => python script and its arguments diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index 0693d21ee0..fcb1d06b3a 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -47,7 +47,6 @@ PYTHON3_VARS = \ _python_exec_prefix="/usr" \ CARGO_BUILD_TARGET="$(RUSTC_TARGET_ARCH)" \ CARGO_HOME="$(CARGO_HOME)" \ - PATH="$(CARGO_HOME)/bin:$(PATH)" \ PYO3_CROSS_LIB_DIR="$(PYTHON3_LIB_DIR)" \ RUSTFLAGS="$(CARGO_RUSTFLAGS)" diff --git a/lang/rust/Makefile b/lang/rust/Makefile index b27c2fc09e..67513d1800 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rust PKG_VERSION:=1.72.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz PKG_SOURCE_URL:=https://static.rust-lang.org/dist/ @@ -40,7 +40,7 @@ define Package/rust/description endef # Rust-lang has an uninstall script -RUST_UNINSTALL:=$(CARGO_HOME)/lib/rustlib/uninstall.sh +RUST_UNINSTALL:=$(STAGING_DIR)/host/lib/rustlib/uninstall.sh # Target Flags TARGET_CONFIGURE_ARGS = \ @@ -52,19 +52,19 @@ TARGET_CONFIGURE_ARGS = \ $(if $(CONFIG_USE_MUSL),--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR)) # CARGO_HOME is an environmental -HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)" +HOST_CONFIGURE_VARS += CARGO_HOME="$(CARGO_HOME)" # Rust Configuration Arguments HOST_CONFIGURE_ARGS = \ --build=$(RUSTC_HOST_ARCH) \ --target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \ --host=$(RUSTC_HOST_ARCH) \ - --prefix=$(CARGO_HOME) \ - --bindir=$(CARGO_HOME)/bin \ - --libdir=$(CARGO_HOME)/lib \ - --sysconfdir=$(CARGO_HOME)/etc \ - --datadir=$(CARGO_HOME)/share \ - --mandir=$(CARGO_HOME)/man \ + --prefix=$(STAGING_DIR)/host \ + --bindir=$(STAGING_DIR)/host/bin \ + --libdir=$(STAGING_DIR)/host/lib \ + --sysconfdir=$(STAGING_DIR)/host/etc \ + --datadir=$(STAGING_DIR)/host/share \ + --mandir=$(STAGING_DIR)/host/man \ --dist-compression-formats=gz \ --enable-missing-tools \ --disable-sanitizers \ @@ -82,6 +82,7 @@ endef define Host/Compile ( \ cd $(HOST_BUILD_DIR) ; \ + CARGO_HOME=$(CARGO_HOME) \ OPENWRT_RUSTC_BOOTSTRAP_CACHE=$(DL_DIR)/rustc \ $(PYTHON) x.py --config ./config.toml dist build-manifest cargo llvm-tools \ rustc rust-std rust-src ; \ @@ -95,7 +96,7 @@ define Host/Install $(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc "$$$$targz" | tar -xf - ; \ done ; \ find . -mindepth 2 -maxdepth 2 -type f -name install.sh \ - -execdir bash '{}' --prefix=$(CARGO_HOME) --disable-ldconfig \; ; \ + -execdir bash '{}' --prefix=$(STAGING_DIR)/host --disable-ldconfig \; ; \ \ sed -e 's|@RUSTC_TARGET_ARCH@|$(RUSTC_TARGET_ARCH)|g' \ -e 's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \ diff --git a/lang/rust/rust-host-build.mk b/lang/rust/rust-host-build.mk index 39bee072eb..29ecc42a5e 100644 --- a/lang/rust/rust-host-build.mk +++ b/lang/rust/rust-host-build.mk @@ -20,7 +20,6 @@ include $(RUST_INCLUDE_DIR)/rust-values.mk define Host/Compile/Cargo ( \ cd $(HOST_BUILD_DIR) ; \ - export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \ CARGO_HOME=$(CARGO_HOME) \ CC=$(HOSTCC_NOCACHE) \ cargo install -v \ @@ -34,7 +33,6 @@ endef define Host/Uninstall/Cargo ( \ cd $(HOST_BUILD_DIR) ; \ - export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \ CARGO_HOME=$(CARGO_HOME) \ CC=$(HOSTCC_NOCACHE) \ cargo uninstall -v \ diff --git a/lang/rust/rust-package.mk b/lang/rust/rust-package.mk index 8d30ee86ce..231828bab6 100644 --- a/lang/rust/rust-package.mk +++ b/lang/rust/rust-package.mk @@ -20,7 +20,6 @@ include $(RUST_INCLUDE_DIR)/rust-values.mk define Build/Compile/Cargo ( \ cd $(PKG_BUILD_DIR) ; \ - export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \ CARGO_HOME=$(CARGO_HOME) \ TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUSTC_CFLAGS)" \ TARGET_CC=$(TARGET_CC_NOCACHE) \