Skip to contentSkip to conversation

use RUSTC_{HOST,TARGET}_NAME

PATCH New Eric Le Bihan 2 participants 4 messages Feb 13, 2018

lore
Share & tools
lore
#0 lore raw

v2 cover use RUSTC_{HOST,TARGET}_NAME

As utils/check-package complains about RUST_{HOST,TARGET}_NAME in rustc package not being compliant and as these variables are related to the Rust compiler, it sounds sensible to rename them.

This series renames RUST_{HOST,TARGET}_NAME to RUSTC_{HOST,TARGET}_NAME in all the packages using them, as well as in the documentation example.

Also included, a clean-up of rustc/Config.in.host to make check-package even more happy.

Eric Le Bihan (2):
rustc: use RUSTC_{HOST,TARGET}_NAME
rustc: fix check-package warnings

 docs/manual/adding-packages-cargo.txt |  4 ++--
 package/cargo-bin/cargo-bin.mk        |  2 +-
 package/cargo/cargo.mk                |  2 +-
 package/cargo/config.in               |  2 +-
 package/rust-bin/rust-bin.mk          | 14 +++++++-------
 package/rust/rust.mk                  |  4 ++--
 package/rustc/Config.in.host          |  3 +--
 package/rustc/rustc.mk                |  4 ++--
 8 files changed, 17 insertions(+), 18 deletions(-)

--
2.14.3

#1 lore raw

PATCH v2 1/2 rustc: use RUSTC_{HOST,TARGET}_NAME

utils/check-package complains as follows:

package/rustc/rustc.mk:10: possible typo: RUST_TARGET_NAME -> *RUSTC* package/rustc/rustc.mk:18: possible typo: RUST_HOST_NAME -> *RUSTC*

As RUST_{HOST,TARGET}_NAME are related to the Rust compiler, it sounds sensible to rename them to RUSTC_{HOST,TARGET}_NAME.

So update all rust related packages to use the new variables.

---
 docs/manual/adding-packages-cargo.txt |  4 ++--
 package/cargo-bin/cargo-bin.mk        |  2 +-
 package/cargo/cargo.mk                |  2 +-
 package/cargo/config.in               |  2 +-
 package/rust-bin/rust-bin.mk          | 14 +++++++-------
 package/rust/rust.mk                  |  4 ++--
 package/rustc/rustc.mk                |  4 ++--
 7 files changed, 16 insertions(+), 16 deletions(-)
docs/manual/adding-packages-cargo.txt +2 -2
index 3f9ddfed16..b78163e6a1 100644
@@ -49,11 +49,11 @@ package. Let's start with an example:
 15: FOO_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
 16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
 17:
-18: FOO_BIN_DIR = target/$(RUST_TARGET_NAME)/$(FOO_CARGO_MODE)
+18: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
 19:
 20: FOO_CARGO_OPTS = \
 21:   --$(FOO_CARGO_MODE) \
-22: 	--target=$(RUST_TARGET_NAME) \
+22: 	--target=$(RUSTC_TARGET_NAME) \
 23: 	--manifest-path=$(@D)/Cargo.toml
 24:
 25: define FOO_BUILD_CMDS
package/cargo-bin/cargo-bin.mk +1 -1
index 0f235748ff..3c834d9033 100644
@@ -6,7 +6,7 @@
 
 CARGO_BIN_VERSION = 0.24.0
 CARGO_BIN_SITE = https://static.rust-lang.org/dist
-CARGO_BIN_SOURCE = cargo-$(CARGO_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz
+CARGO_BIN_SOURCE = cargo-$(CARGO_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
 CARGO_BIN_LICENSE = Apache-2.0 or MIT
 CARGO_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
 
package/cargo/cargo.mk +1 -1
index 5625127fcd..3fd088d727 100644
@@ -82,7 +82,7 @@ define HOST_CARGO_INSTALL_CMDS
 	$(INSTALL) -D -m 0755 $(@D)/target/release/cargo $(HOST_DIR)/bin/cargo
 	$(INSTALL) -D package/cargo/config.in \
 		$(HOST_DIR)/share/cargo/config
-	$(SED) 's/@RUST_TARGET_NAME@/$(RUST_TARGET_NAME)/' \
+	$(SED) 's/@RUSTC_TARGET_NAME@/$(RUSTC_TARGET_NAME)/' \
 		$(HOST_DIR)/share/cargo/config
 	$(SED) 's/@CROSS_PREFIX@/$(notdir $(TARGET_CROSS))/' \
 		$(HOST_DIR)/share/cargo/config
package/cargo/config.in +1 -1
index cc048c71c4..47fad026be 100644
@@ -1,2 +1,2 @@
-[target. at RUST_TARGET_NAME@]
+[target. at RUSTC_TARGET_NAME@]
 linker = "@CROSS_PREFIX at gcc"
package/rust-bin/rust-bin.mk +7 -7
index 5ace7bf08f..cd5844b115 100644
@@ -11,13 +11,13 @@ RUST_BIN_LICENSE_FILES = LICENSE-APACHE LICENSE-MIT
 
 HOST_RUST_BIN_PROVIDES = host-rustc
 
-HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz
+HOST_RUST_BIN_SOURCE = rustc-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz
 
 HOST_RUST_BIN_EXTRA_DOWNLOADS = \
-	rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME).tar.xz \
-	rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME).tar.xz
+	rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME).tar.xz \
+	rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME).tar.xz
 
-HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME)/rust-std-$(RUST_HOST_NAME)
+HOST_RUST_BIN_LIBSTD_HOST_PREFIX = rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME)/rust-std-$(RUSTC_HOST_NAME)
 
 define HOST_RUST_BIN_LIBSTD_EXTRACT
 	mkdir -p $(@D)/std
@@ -26,7 +26,7 @@ define HOST_RUST_BIN_LIBSTD_EXTRACT
 			$(TAR) -C $(@D)/std $(TAR_OPTIONS) -
 	)
 	cd $(@D)/rustc/lib/rustlib; \
-		ln -sf ../../../std/$(HOST_RUST_BIN_LIBSTD_HOST_PREFIX)/lib/rustlib/$(RUST_HOST_NAME)
+		ln -sf ../../../std/$(HOST_RUST_BIN_LIBSTD_HOST_PREFIX)/lib/rustlib/$(RUSTC_HOST_NAME)
 endef
 
 HOST_RUST_BIN_POST_EXTRACT_HOOKS += HOST_RUST_BIN_LIBSTD_EXTRACT
@@ -42,12 +42,12 @@ define HOST_RUST_BIN_INSTALL_RUSTC
 endef
 
 define HOST_RUST_BIN_INSTALL_LIBSTD_HOST
-	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUST_HOST_NAME); \
+	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUSTC_HOST_NAME); \
 		./install.sh $(HOST_RUST_BIN_INSTALL_OPTS))
 endef
 
 define HOST_RUST_BIN_INSTALL_LIBSTD_TARGET
-	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUST_TARGET_NAME); \
+	(cd $(@D)/std/rust-std-$(RUST_BIN_VERSION)-$(RUSTC_TARGET_NAME); \
 		./install.sh $(HOST_RUST_BIN_INSTALL_OPTS))
 endef
 endif
package/rust/rust.mk +2 -2
index 6d6ac4370a..ff2634b996 100644
@@ -48,7 +48,7 @@ HOST_RUST_POST_EXTRACT_HOOKS += HOST_RUST_EXCLUDE_ORIG_FILES
 define HOST_RUST_CONFIGURE_CMDS
 	( \
 		echo '[build]'; \
-		echo 'target = ["$(RUST_TARGET_NAME)"]'; \
+		echo 'target = ["$(RUSTC_TARGET_NAME)"]'; \
 		echo 'cargo = "$(HOST_CARGO_BIN_DIR)/cargo/bin/cargo"'; \
 		echo 'rustc = "$(HOST_RUST_BIN_DIR)/rustc/bin/rustc"'; \
 		echo 'python = "$(HOST_DIR)/bin/python2"'; \
@@ -61,7 +61,7 @@ define HOST_RUST_CONFIGURE_CMDS
 		echo 'prefix = "$(HOST_DIR)"'; \
 		echo '[rust]'; \
 		echo 'use-jemalloc = $(HOST_RUST_JEMALLOC_ENABLED)'; \
-		echo '[target.$(RUST_TARGET_NAME)]'; \
+		echo '[target.$(RUSTC_TARGET_NAME)]'; \
 		echo 'cc = "$(TARGET_CROSS)gcc"'; \
 		echo $(HOST_RUST_JEMALLOC_CONF); \
 	) > $(@D)/config.toml
package/rustc/rustc.mk +2 -2
index 7a951c0cfd..bed74f3c2c 100644
@@ -7,7 +7,7 @@
 RUSTC_ARCH = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ARCH))
 RUSTC_ABI = $(call qstrip,$(BR2_PACKAGE_HOST_RUSTC_ABI))
 
-RUST_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI)
+RUSTC_TARGET_NAME = $(RUSTC_ARCH)-unknown-linux-gnu$(RUSTC_ABI)
 
 ifeq ($(HOSTARCH),x86)
 RUSTC_HOST_ARCH = i686
@@ -15,6 +15,6 @@ else
 RUSTC_HOST_ARCH = $(HOSTARCH)
 endif
 
-RUST_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu
+RUSTC_HOST_NAME = $(RUSTC_HOST_ARCH)-unknown-linux-gnu
 
 $(eval $(host-virtual-package))
Signature · 1 line
2.14.3
#2 lore raw

PATCH v2 2/2 rustc: fix check-package warnings

In reply to Eric Le Bihan

utils/check-package complains as follows:

package/rustc/Config.in.host:6: attributes order: type, default, depends on, select, help (http://nightly.buildroot.org/#_config_files)
package/rustc/Config.in.host:79: empty line at end of file

This patch fixes these warnings.

---
 package/rustc/Config.in.host | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
package/rustc/Config.in.host +1 -2
index d93ff05209..bdbe488f48 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
 	bool
-	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	# The pre-built Rust standard library is only available for the
 	# following architectures/ABIs, and is built against glibc.
 	default y if BR2_i386
@@ -12,6 +11,7 @@ config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS
 	default y if (BR2_mips64 || BR2_mips64el) && !BR2_MIPS_CPU_MIPS64R6 \
 		&& BR2_MIPS_NABI64
 	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 
 config BR2_PACKAGE_HOST_RUSTC_ARCH
 	string
@@ -76,4 +76,3 @@ config BR2_PACKAGE_PROVIDES_HOST_RUSTC
 	default "host-rust-bin" if BR2_PACKAGE_HOST_RUST_BIN
 
 endif
-
Signature · 1 line
2.14.3
#3 lore raw

v2 cover use RUSTC_{HOST,TARGET}_NAME

In reply to Eric Le Bihan

Hello,

Quoted 3 lines · Eric Le Bihan

Eric Le Bihan (2):
rustc: use RUSTC_{HOST,TARGET}_NAME
rustc: fix check-package warnings

Thanks, series applied to master!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com