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

thisisnic pushed a commit to branch maint-22.0.0.1-r
in repository https://gitbox.apache.org/repos/asf/arrow.git

commit f2c546e086f8f61a15d0d86bc270ba8dec66eba5
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 9bcfda3061..c4017bf3d1 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -531,6 +531,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