From 518d65e61735fd60a8b4b6eb471d9791fabad578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Cs=C3=A1rdi?= Date: Sun, 17 Mar 2024 14:10:35 +0100 Subject: [PATCH] Support Rtools44 Closes #183. --- NEWS.md | 2 ++ R/rtools.R | 31 ++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 2b7aa72..d96121f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # pkgbuild (development version) +* pkgbuild now supports R 4.4.x and Rtools44 (#183). + # pkgbuild 1.4.3 * pkgbuild now does not need the crayon, rprojroot and prettyunits diff --git a/R/rtools.R b/R/rtools.R index ae565b0..bd6a5bc 100644 --- a/R/rtools.R +++ b/R/rtools.R @@ -30,12 +30,38 @@ has_rtools <- function(debug = FALSE) { return(FALSE) } + # R 4.4.0 or later on ARM64 + if (getRversion() >= "4.4.0" && grepl("aarch", R.version$platform)) { + rtools44_aarch64_home <- Sys.getenv("RTOOLS44_AARCH64_HOME", "C:\rtools44-aarch64") + if (file.exists(file.path(rtools44_aarch64_home, "usr", "bin"))) { + if (debug) { + cat("Found in Rtools 4.4 (aarch64) installation folder\n") + } + rtools_path_set(rtools(rtools44_aarch64_home, "4.4")) + return(TRUE) + } + return(FALSE) + } + + # R 4.4.0 or later + if (getRversion() >= "4.4.0") { + rtools44_home <- Sys.getenv("RTOOLS44_HOME", "C:\\rtools44") + if (file.exists(file.path(rtools44_home, "usr", "bin"))) { + if (debug) { + cat("Found in Rtools 4.4 installation folder\n") + } + rtools_path_set(rtools(rtools44_home, "4.4")) + return(TRUE) + } + return(FALSE) + } + # R 4.3.0 or later on ARM64 - if (grepl("aarch", R.version$platform)) { + if (getRversion() >= "4.3.0" && grepl("aarch", R.version$platform)) { rtools43_aarch64_home <- Sys.getenv("RTOOLS43_AARCH64_HOME", "C:\rtools43-aarch64") if (file.exists(file.path(rtools43_aarch64_home, "usr", "bin"))) { if (debug) { - cat("Found in Rtools 4.3 installation folder\n") + cat("Found in Rtools 4.3 (aarch64) installation folder\n") } rtools_path_set(rtools(rtools43_aarch64_home, "4.3")) return(TRUE) @@ -56,7 +82,6 @@ has_rtools <- function(debug = FALSE) { return(FALSE) } - # R 4.2.x or later and ucrt? ucrt <- is_ucrt() if (ucrt) {