diff --git a/src/Makevars.in b/src/Makevars.in index 65c84ea..6898596 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -39,7 +39,7 @@ $(STATLIB): export CARGO_HOME=$(CARGOTMP) && \ export PATH="$(PATH):$(HOME)/.cargo/bin" && \ - @PANIC_EXPORTS@RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --lib @PROFILE@ --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) @TARGET@ + @SKIP_GENERATE@@PANIC_EXPORTS@RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --lib @PROFILE@ --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) @TARGET@ # Always clean up CARGOTMP rm -Rf $(CARGOTMP); diff --git a/src/Makevars.win.in b/src/Makevars.win.in index 7f0a787..1fe9531 100644 --- a/src/Makevars.win.in +++ b/src/Makevars.win.in @@ -35,7 +35,7 @@ $(STATLIB): export CARGO_HOME=$(CARGOTMP) && \ export LIBRARY_PATH="$(LIBRARY_PATH);$(CURDIR)/$(TARGET_DIR)/libgcc_mock" && \ . rust/build-env-win.sh && \ - RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --target=$(TARGET) --lib @PROFILE@ --manifest-path=rust/Cargo.toml --target-dir=$(TARGET_DIR) + @SKIP_GENERATE@RUSTFLAGS="$(RUSTFLAGS) --print=native-static-libs" cargo build @CRAN_FLAGS@ --target=$(TARGET) --lib @PROFILE@ --manifest-path=rust/Cargo.toml --target-dir=$(TARGET_DIR) # Always clean up CARGOTMP rm -Rf $(CARGOTMP); diff --git a/tools/config.R b/tools/config.R index aa035f7..63f4ed4 100644 --- a/tools/config.R +++ b/tools/config.R @@ -27,11 +27,13 @@ if (!is_not_cran) { # we set cran flags only if NOT_CRAN is empty and if # the vendored crates are present. -.cran_flags <- ifelse( - !is_not_cran && vendor_exists, - "-j 2 --offline", - "" -) +is_cran_build <- !is_not_cran && vendor_exists + +.cran_flags <- ifelse(is_cran_build, "-j 2 --offline", "") + +# The vendored tree-sitter-ggsql crate includes a pre-generated parser.c, +# so we skip running `tree-sitter generate` (which requires tree-sitter-cli). +.skip_generate <- ifelse(is_cran_build, "GGSQL_SKIP_GENERATE=1 ", "") # when DEBUG env var is present we use `--debug` build .profile <- ifelse(is_debug, "", "--release") @@ -123,6 +125,7 @@ new_txt <- gsub("@CRAN_FLAGS@", .cran_flags, mv_txt) |> gsub("@CLEAN_TARGET@", .clean_targets, x = _) |> gsub("@LIBDIR@", .libdir, x = _) |> gsub("@TARGET@", .target, x = _) |> + gsub("@SKIP_GENERATE@", .skip_generate, x = _) |> gsub("@PANIC_EXPORTS@", .panic_exports, x = _) |> gsub("@ODBC_LIBS@", .odbc_libs, x = _)