module RbSys::Mkmf
def rust_toolchain_env(builder)
def rust_toolchain_env(builder) <<~MAKE #{conditional_assign("RB_SYS_RUSTUP_PROFILE", "minimal")} # If the user passed true, we assume stable Rust. Otherwise, use what # was specified (i.e. RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN=beta) #{if_eq_stmt("$(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN)", "true")} RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN = stable #{endif_stmt} # If a $RUST_TARGET is specified (i.e. for rake-compiler-dock), append # that to the profile. #{if_eq_stmt("$(RUST_TARGET)", "")} RB_SYS_DEFAULT_TOOLCHAIN = $(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN) #{else_stmt} RB_SYS_DEFAULT_TOOLCHAIN = $(RB_SYS_FORCE_INSTALL_RUST_TOOLCHAIN)-$(RUST_TARGET) #{endif_stmt} # Since we are forcing the installation of the Rust toolchain, we need # to set these env vars unconditionally for the build. #{export_env("CARGO_HOME", "$(RB_SYS_BUILD_DIR)/$(RB_SYS_DEFAULT_TOOLCHAIN)/cargo")} #{export_env("RUSTUP_HOME", "$(RB_SYS_BUILD_DIR)/$(RB_SYS_DEFAULT_TOOLCHAIN)/rustup")} #{export_env("PATH", "$(CARGO_HOME)/bin:$(RUSTUP_HOME)/bin:$(PATH)")} #{export_env("RUSTUP_TOOLCHAIN", "$(RB_SYS_DEFAULT_TOOLCHAIN)")} #{export_env("CARGO", "$(CARGO_HOME)/bin/cargo")} MAKE end