This is an automated email from the ASF dual-hosted git repository.

jonkeane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0f51aba2f3 GH-48340: [R] respected `MAKEFLAGS` (#48341)
0f51aba2f3 is described below

commit 0f51aba2f354f8213bebc9125588c550a6ef8de8
Author: Jonathan Keane <[email protected]>
AuthorDate: Mon Dec 8 08:26:47 2025 -0600

    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
---
 r/tools/nixlibs.R | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index ee782bdeea..cace64b8e9 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -540,6 +540,12 @@ build_libarrow <- function(src_dir, dst_dir) {
   if (makeflags == "") {
     makeflags <- sprintf("-j%s", ncores)
     Sys.setenv(MAKEFLAGS = makeflags)
+  } else {
+    # Extract -j value from existing MAKEFLAGS if present
+    j_match <- regmatches(makeflags, regexpr("-j\\s*([0-9]+)", makeflags, perl 
= TRUE))
+    if (length(j_match) > 0) {
+      ncores <- as.integer(sub("-j\\s*", "", j_match, perl = TRUE))
+    }
   }
   if (!quietly) {
     lg("Building with MAKEFLAGS=%s", makeflags)

Reply via email to