Skip to content

Commit 8beb5f1

Browse files
committed
fix: Fixes max character in path limit
1 parent 8baff3c commit 8beb5f1

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

src/Makevars.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
TARGET_DIR = ./rust/target
1+
# TARGET_DIR is set dynamically by tools/config.R
2+
# On Windows, this uses a short path to avoid MAX_PATH limitations
3+
TARGET_DIR = @TARGET_DIR@
24
LIBDIR = $(TARGET_DIR)/@LIBDIR@
35
STATLIB = $(LIBDIR)/libdeltaR.a
46
PKG_LIBS = -L$(LIBDIR) -ldeltaR

src/Makevars.win.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
TARGET = $(subst 64,x86_64,$(subst 32,i686,$(WIN)))-pc-windows-gnu
22

3-
TARGET_DIR = ./rust/target
3+
# TARGET_DIR is set dynamically by tools/config.R to use a short path
4+
# This avoids Windows MAX_PATH (260 char) limitations with aws-lc-sys
5+
TARGET_DIR = @TARGET_DIR@
46
LIBDIR = $(TARGET_DIR)/$(TARGET)/@LIBDIR@
57
STATLIB = $(LIBDIR)/libdeltaR.a
68
PKG_LIBS = -L$(LIBDIR) -ldeltaR -lws2_32 -ladvapi32 -luserenv -lbcrypt -lntdll

tools/config.R

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
# check the packages MSRV first
55
source("tools/msrv.R")
66

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+
722
# check DEBUG and NOT_CRAN environment variables
823
env_debug <- Sys.getenv("DEBUG")
924
env_not_cran <- Sys.getenv("NOT_CRAN")
@@ -71,7 +86,6 @@ cfg <- if (is_debug) "debug" else "release"
7186
)
7287

7388
# read in the Makevars.in file checking
74-
is_windows <- .Platform[["OS.type"]] == "windows"
7589

7690
# if windows we replace in the Makevars.win.in
7791
mv_fp <- ifelse(
@@ -102,7 +116,8 @@ new_txt <- gsub("@CRAN_FLAGS@", .cran_flags, mv_txt) |>
102116
gsub("@CLEAN_TARGET@", .clean_targets, x = _) |>
103117
gsub("@LIBDIR@", .libdir, x = _) |>
104118
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 = _)
106121

107122
message("Writing `", mv_ofp, "`.")
108123
con <- file(mv_ofp, open = "wb")

0 commit comments

Comments
 (0)