Skip to content

Commit 0f51aba

Browse files
authored
GH-48340: [R] respected MAKEFLAGS (#48341)
### Rationale for this change Respect the `MAKEFLAGS` that someone has set. Resolves #48340 ### What changes are included in this PR? Respect ### Are these changes tested? No, though we should see speedups in various places. ### Are there any user-facing changes? More respect. * GitHub Issue: #48340
1 parent f40d62e commit 0f51aba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

r/tools/nixlibs.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ build_libarrow <- function(src_dir, dst_dir) {
540540
if (makeflags == "") {
541541
makeflags <- sprintf("-j%s", ncores)
542542
Sys.setenv(MAKEFLAGS = makeflags)
543+
} else {
544+
# Extract -j value from existing MAKEFLAGS if present
545+
j_match <- regmatches(makeflags, regexpr("-j\\s*([0-9]+)", makeflags, perl = TRUE))
546+
if (length(j_match) > 0) {
547+
ncores <- as.integer(sub("-j\\s*", "", j_match, perl = TRUE))
548+
}
543549
}
544550
if (!quietly) {
545551
lg("Building with MAKEFLAGS=%s", makeflags)

0 commit comments

Comments
 (0)