aboutsummaryrefslogtreecommitdiff
path: root/lang/rust/rustc_environment.mk
diff options
context:
space:
mode:
authorDonald Hoskins <grommish@gmail.com>2022-07-18 01:07:17 +0000
committerToni Uhlig <matzeton@googlemail.com>2022-09-11 13:16:26 +0200
commit5bbd4b2038f612218895e2ceb6c80ae80ea8a6b6 (patch)
treefb57301b720ff425a7c939ca0d15f0e6327bc8b2 /lang/rust/rustc_environment.mk
parent29035353ba7e200ea35bb656d5f7b4f8406d5dca (diff)
rust: Updste to 1.62.0
Diffstat (limited to 'lang/rust/rustc_environment.mk')
-rw-r--r--lang/rust/rustc_environment.mk30
1 files changed, 30 insertions, 0 deletions
diff --git a/lang/rust/rustc_environment.mk b/lang/rust/rustc_environment.mk
new file mode 100644
index 0000000..db0e350
--- /dev/null
+++ b/lang/rust/rustc_environment.mk
@@ -0,0 +1,30 @@
+-include $(TOPDIR)/package/feeds/packages/rust/rustc_targets.mk
+
+# These RUSTFLAGS are common across all TARGETs
+RUSTFLAGS += \
+ -C linker=$(TOOLCHAIN_DIR)/bin/$(TARGET_CC_NOCACHE) \
+ -C ar=$(TOOLCHAIN_DIR)/bin/$(TARGET_AR) \
+ -C target-cpu=$(RUSTC_CPU_TYPE)
+
+ifneq ($(RUST_TARGET_FEATURES),)
+RUSTFLAGS += -C target-feature=$(RUST_TARGET_FEATURES)
+endif
+
+# Common Build Flags
+CARGO_BUILD_FLAGS = \
+ RUSTFLAGS="$(RUSTFLAGS)" \
+ CARGO_HOME="$(CARGO_HOME)"
+
+# This adds the rust environmental variables to Make calls
+# MAKE_FLAGS += $(RUST_BUILD_FLAGS)
+
+define RustPackage/Cargo/Update
+ cd $(PKG_BUILD_DIR) && \
+ $(CARGO_BUILD_FLAGS) cargo update $(1)
+endef
+
+define RustPackage/Cargo/Compile
+ cd $(PKG_BUILD_DIR) && \
+ $(CARGO_BUILD_FLAGS) cargo build -v --release \
+ --target $(RUSTC_TARGET_ARCH) $(1)
+endef