From 9c6ab7291831307e18500b3c52cf4fc4eb61dadb Mon Sep 17 00:00:00 2001 From: eitsupi Date: Tue, 15 Aug 2023 11:27:45 +0000 Subject: [PATCH] fix(template): set `CARGO_BUILD_JOBS=2` on CRAN --- inst/templates/Makevars | 1 + inst/templates/Makevars.win | 1 + tests/testthat/_snaps/use_extendr.md | 3 +++ 3 files changed, 5 insertions(+) diff --git a/inst/templates/Makevars b/inst/templates/Makevars index 18cc5a06..a00dd59b 100644 --- a/inst/templates/Makevars +++ b/inst/templates/Makevars @@ -15,6 +15,7 @@ $(STATLIB): # therefore is only used if cargo is absent from the user's PATH. if [ "$(NOT_CRAN)" != "true" ]; then \ export CARGO_HOME=$(CARGOTMP); \ + export CARGO_BUILD_JOBS=2; \ fi && \ export PATH="$(PATH):$(HOME)/.cargo/bin" && \ cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) diff --git a/inst/templates/Makevars.win b/inst/templates/Makevars.win index e47a9ab2..803f2e78 100644 --- a/inst/templates/Makevars.win +++ b/inst/templates/Makevars.win @@ -24,6 +24,7 @@ $(STATLIB): # CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2 if [ "$(NOT_CRAN)" != "true" ]; then \ export CARGO_HOME=$(CARGOTMP); \ + export CARGO_BUILD_JOBS=2; \ fi && \ export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \ export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ diff --git a/tests/testthat/_snaps/use_extendr.md b/tests/testthat/_snaps/use_extendr.md index 843f532c..b7ab6deb 100644 --- a/tests/testthat/_snaps/use_extendr.md +++ b/tests/testthat/_snaps/use_extendr.md @@ -60,6 +60,7 @@ # therefore is only used if cargo is absent from the user's PATH. if [ "$(NOT_CRAN)" != "true" ]; then \ export CARGO_HOME=$(CARGOTMP); \ + export CARGO_BUILD_JOBS=2; \ fi && \ export PATH="$(PATH):$(HOME)/.cargo/bin" && \ cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) @@ -105,6 +106,7 @@ # CARGO_LINKER is provided in Makevars.ucrt for R >= 4.2 if [ "$(NOT_CRAN)" != "true" ]; then \ export CARGO_HOME=$(CARGOTMP); \ + export CARGO_BUILD_JOBS=2; \ fi && \ export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \ export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ @@ -272,6 +274,7 @@ # therefore is only used if cargo is absent from the user's PATH. if [ "$(NOT_CRAN)" != "true" ]; then \ export CARGO_HOME=$(CARGOTMP); \ + export CARGO_BUILD_JOBS=2; \ fi && \ export PATH="$(PATH):$(HOME)/.cargo/bin" && \ cargo build --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR)