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 <jeffery.to@gmail.com>
This commit is contained in:
parent
855623d8cc
commit
49aaf19c65
5 changed files with 12 additions and 16 deletions
|
@ -78,8 +78,7 @@ HOST_PYTHON3_VARS = \
|
||||||
CFLAGS="$(HOST_CFLAGS)" \
|
CFLAGS="$(HOST_CFLAGS)" \
|
||||||
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
|
CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
|
||||||
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath$(comma)$(STAGING_DIR_HOSTPKG)/lib" \
|
LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath$(comma)$(STAGING_DIR_HOSTPKG)/lib" \
|
||||||
CARGO_HOME="$(CARGO_HOME)" \
|
CARGO_HOME="$(CARGO_HOME)"
|
||||||
PATH="$(CARGO_HOME)/bin:$(PATH)"
|
|
||||||
|
|
||||||
# $(1) => directory of python script
|
# $(1) => directory of python script
|
||||||
# $(2) => python script and its arguments
|
# $(2) => python script and its arguments
|
||||||
|
|
|
@ -47,7 +47,6 @@ PYTHON3_VARS = \
|
||||||
_python_exec_prefix="/usr" \
|
_python_exec_prefix="/usr" \
|
||||||
CARGO_BUILD_TARGET="$(RUSTC_TARGET_ARCH)" \
|
CARGO_BUILD_TARGET="$(RUSTC_TARGET_ARCH)" \
|
||||||
CARGO_HOME="$(CARGO_HOME)" \
|
CARGO_HOME="$(CARGO_HOME)" \
|
||||||
PATH="$(CARGO_HOME)/bin:$(PATH)" \
|
|
||||||
PYO3_CROSS_LIB_DIR="$(PYTHON3_LIB_DIR)" \
|
PYO3_CROSS_LIB_DIR="$(PYTHON3_LIB_DIR)" \
|
||||||
RUSTFLAGS="$(CARGO_RUSTFLAGS)"
|
RUSTFLAGS="$(CARGO_RUSTFLAGS)"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=rust
|
PKG_NAME:=rust
|
||||||
PKG_VERSION:=1.72.0
|
PKG_VERSION:=1.72.0
|
||||||
PKG_RELEASE:=2
|
PKG_RELEASE:=3
|
||||||
|
|
||||||
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
|
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
|
||||||
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
|
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
|
||||||
|
@ -40,7 +40,7 @@ define Package/rust/description
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Rust-lang has an uninstall script
|
# 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 Flags
|
||||||
TARGET_CONFIGURE_ARGS = \
|
TARGET_CONFIGURE_ARGS = \
|
||||||
|
@ -52,19 +52,19 @@ TARGET_CONFIGURE_ARGS = \
|
||||||
$(if $(CONFIG_USE_MUSL),--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR))
|
$(if $(CONFIG_USE_MUSL),--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR))
|
||||||
|
|
||||||
# CARGO_HOME is an environmental
|
# CARGO_HOME is an environmental
|
||||||
HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)"
|
HOST_CONFIGURE_VARS += CARGO_HOME="$(CARGO_HOME)"
|
||||||
|
|
||||||
# Rust Configuration Arguments
|
# Rust Configuration Arguments
|
||||||
HOST_CONFIGURE_ARGS = \
|
HOST_CONFIGURE_ARGS = \
|
||||||
--build=$(RUSTC_HOST_ARCH) \
|
--build=$(RUSTC_HOST_ARCH) \
|
||||||
--target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \
|
--target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \
|
||||||
--host=$(RUSTC_HOST_ARCH) \
|
--host=$(RUSTC_HOST_ARCH) \
|
||||||
--prefix=$(CARGO_HOME) \
|
--prefix=$(STAGING_DIR)/host \
|
||||||
--bindir=$(CARGO_HOME)/bin \
|
--bindir=$(STAGING_DIR)/host/bin \
|
||||||
--libdir=$(CARGO_HOME)/lib \
|
--libdir=$(STAGING_DIR)/host/lib \
|
||||||
--sysconfdir=$(CARGO_HOME)/etc \
|
--sysconfdir=$(STAGING_DIR)/host/etc \
|
||||||
--datadir=$(CARGO_HOME)/share \
|
--datadir=$(STAGING_DIR)/host/share \
|
||||||
--mandir=$(CARGO_HOME)/man \
|
--mandir=$(STAGING_DIR)/host/man \
|
||||||
--dist-compression-formats=gz \
|
--dist-compression-formats=gz \
|
||||||
--enable-missing-tools \
|
--enable-missing-tools \
|
||||||
--disable-sanitizers \
|
--disable-sanitizers \
|
||||||
|
@ -82,6 +82,7 @@ endef
|
||||||
define Host/Compile
|
define Host/Compile
|
||||||
( \
|
( \
|
||||||
cd $(HOST_BUILD_DIR) ; \
|
cd $(HOST_BUILD_DIR) ; \
|
||||||
|
CARGO_HOME=$(CARGO_HOME) \
|
||||||
OPENWRT_RUSTC_BOOTSTRAP_CACHE=$(DL_DIR)/rustc \
|
OPENWRT_RUSTC_BOOTSTRAP_CACHE=$(DL_DIR)/rustc \
|
||||||
$(PYTHON) x.py --config ./config.toml dist build-manifest cargo llvm-tools \
|
$(PYTHON) x.py --config ./config.toml dist build-manifest cargo llvm-tools \
|
||||||
rustc rust-std rust-src ; \
|
rustc rust-std rust-src ; \
|
||||||
|
@ -95,7 +96,7 @@ define Host/Install
|
||||||
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc "$$$$targz" | tar -xf - ; \
|
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc "$$$$targz" | tar -xf - ; \
|
||||||
done ; \
|
done ; \
|
||||||
find . -mindepth 2 -maxdepth 2 -type f -name install.sh \
|
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' \
|
sed -e 's|@RUSTC_TARGET_ARCH@|$(RUSTC_TARGET_ARCH)|g' \
|
||||||
-e 's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \
|
-e 's|@TARGET_CC_NOCACHE@|$(TARGET_CC_NOCACHE)|g' \
|
||||||
|
|
|
@ -20,7 +20,6 @@ include $(RUST_INCLUDE_DIR)/rust-values.mk
|
||||||
define Host/Compile/Cargo
|
define Host/Compile/Cargo
|
||||||
( \
|
( \
|
||||||
cd $(HOST_BUILD_DIR) ; \
|
cd $(HOST_BUILD_DIR) ; \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
CARGO_HOME=$(CARGO_HOME) \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
CC=$(HOSTCC_NOCACHE) \
|
||||||
cargo install -v \
|
cargo install -v \
|
||||||
|
@ -34,7 +33,6 @@ endef
|
||||||
define Host/Uninstall/Cargo
|
define Host/Uninstall/Cargo
|
||||||
( \
|
( \
|
||||||
cd $(HOST_BUILD_DIR) ; \
|
cd $(HOST_BUILD_DIR) ; \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
CARGO_HOME=$(CARGO_HOME) \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
CC=$(HOSTCC_NOCACHE) \
|
||||||
cargo uninstall -v \
|
cargo uninstall -v \
|
||||||
|
|
|
@ -20,7 +20,6 @@ include $(RUST_INCLUDE_DIR)/rust-values.mk
|
||||||
define Build/Compile/Cargo
|
define Build/Compile/Cargo
|
||||||
( \
|
( \
|
||||||
cd $(PKG_BUILD_DIR) ; \
|
cd $(PKG_BUILD_DIR) ; \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
CARGO_HOME=$(CARGO_HOME) \
|
||||||
TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUSTC_CFLAGS)" \
|
TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUSTC_CFLAGS)" \
|
||||||
TARGET_CC=$(TARGET_CC_NOCACHE) \
|
TARGET_CC=$(TARGET_CC_NOCACHE) \
|
||||||
|
|
Loading…
Reference in a new issue