|
4 | 4 | # check the packages MSRV first |
5 | 5 | source("tools/msrv.R") |
6 | 6 |
|
| 7 | +# check if we are on Windows |
| 8 | +is_windows <- .Platform[["OS.type"]] == "windows" |
| 9 | + |
| 10 | +# Generate a short target directory for Windows to avoid MAX_PATH issues |
| 11 | +# aws-lc-sys builds fail when paths exceed ~250 characters |
| 12 | +if (is_windows) { |
| 13 | + # Use R's temp directory but with a short subdirectory name |
| 14 | + # This is CRAN-compliant as it uses the session temp directory |
| 15 | + short_tmp <- file.path(tempdir(), "dR") |
| 16 | + # Normalize to forward slashes for Make compatibility |
| 17 | + .target_dir <- gsub("\\\\", "/", short_tmp) |
| 18 | +} else { |
| 19 | + .target_dir <- "./rust/target" |
| 20 | +} |
| 21 | + |
7 | 22 | # check DEBUG and NOT_CRAN environment variables |
8 | 23 | env_debug <- Sys.getenv("DEBUG") |
9 | 24 | env_not_cran <- Sys.getenv("NOT_CRAN") |
@@ -71,7 +86,6 @@ cfg <- if (is_debug) "debug" else "release" |
71 | 86 | ) |
72 | 87 |
|
73 | 88 | # read in the Makevars.in file checking |
74 | | -is_windows <- .Platform[["OS.type"]] == "windows" |
75 | 89 |
|
76 | 90 | # if windows we replace in the Makevars.win.in |
77 | 91 | mv_fp <- ifelse( |
@@ -102,7 +116,8 @@ new_txt <- gsub("@CRAN_FLAGS@", .cran_flags, mv_txt) |> |
102 | 116 | gsub("@CLEAN_TARGET@", .clean_targets, x = _) |> |
103 | 117 | gsub("@LIBDIR@", .libdir, x = _) |> |
104 | 118 | gsub("@TARGET@", .target, x = _) |> |
105 | | - gsub("@PANIC_EXPORTS@", .panic_exports, x = _) |
| 119 | + gsub("@PANIC_EXPORTS@", .panic_exports, x = _) |> |
| 120 | + gsub("@TARGET_DIR@", .target_dir, x = _) |
106 | 121 |
|
107 | 122 | message("Writing `", mv_ofp, "`.") |
108 | 123 | con <- file(mv_ofp, open = "wb") |
|
0 commit comments