Skip to content

Commit d96c63a

Browse files
authored
Merge 849915f into 19056cf
2 parents 19056cf + 849915f commit d96c63a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

R/install.R

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ install_cmdstan <- function(dir = NULL,
9999
warning("version and release_url shouldn't both be specified!",
100100
"\nrelease_url will be ignored.", call. = FALSE)
101101
}
102+
102103
release_url <- paste0("https://github.com/stan-dev/cmdstan/releases/download/v",
103-
version, "/cmdstan-", version, ".tar.gz")
104+
version, "/cmdstan-", version, cmdstan_arch_suffix(version), ".tar.gz")
104105
}
105106
if (!is.null(release_url)) {
106107
if (!endsWith(release_url, ".tar.gz")) {
@@ -118,7 +119,7 @@ install_cmdstan <- function(dir = NULL,
118119
} else {
119120
ver <- latest_released_version()
120121
message("* Latest CmdStan release is v", ver)
121-
cmdstan_ver <- paste0("cmdstan-", ver)
122+
cmdstan_ver <- paste0("cmdstan-", ver, cmdstan_arch_suffix(ver))
122123
tar_gz_file <- paste0(cmdstan_ver, ".tar.gz")
123124
dir_cmdstan <- file.path(dir, cmdstan_ver)
124125
message("* Installing CmdStan v", ver, " in ", dir_cmdstan)
@@ -300,9 +301,10 @@ github_auth_token <- function() {
300301

301302
# construct url for download from cmdstan version number
302303
github_download_url <- function(version_number) {
304+
303305
base_url <- "https://github.com/stan-dev/cmdstan/releases/download/"
304306
paste0(base_url, "v", version_number,
305-
"/cmdstan-", version_number, ".tar.gz")
307+
"/cmdstan-", version_number, cmdstan_arch_suffix(), ".tar.gz")
306308
}
307309

308310
# get version number of latest release
@@ -614,3 +616,15 @@ check_unix_cpp_compiler <- function() {
614616
}
615617
}
616618
}
619+
620+
cmdstan_arch_suffix <- function(version = NULL) {
621+
arch <- NULL
622+
if (grepl("linux", R.version$os) && grepl("aarch64", R.version$arch)) {
623+
arch <- "-linux-arm64"
624+
}
625+
if (!is.null(version) && version < "2.26") {
626+
# pre-CmdStan 2.26, only the x85 tarball was provided
627+
arch <- NULL
628+
}
629+
arch
630+
}

0 commit comments

Comments
 (0)