@@ -52,9 +52,34 @@ gfortran_version <- function() {
5252# ' appropriate location for **Intel** (`x86_64`) or **M-series** (`arm64`/`aarch64`)
5353# ' depending on the R version used.
5454# '
55- # ' ### gfortran Installation for R 4.3
55+ # ' ### gfortran Installation for R 4.5
5656# '
57- # ' The `gfortran` installer for R 4.3 is a universal installer that places
57+ # ' The `gfortran` installer for R 4.5 is a universal installer that places
58+ # ' `gfortran` into the `/opt/gfortran` for both **Intel** (`x86_64`) and
59+ # ' **M-series** (`arm64`/`aarch64`) macs.
60+ # '
61+ # ' ```sh
62+ # ' # Install the downloaded package into root
63+ # ' sudo installer \
64+ # ' -pkg /path/to/gfortran-14.2-universal.pkg \
65+ # ' -target /
66+ # ' ```
67+ # '
68+ # ' Once installed, we modify the `PATH` environment variable to recognize the newly
69+ # ' installed software by adding into the `~/.Renviron` file the following:
70+ # '
71+ # ' ```sh
72+ # ' touch ~/.Renviron
73+ # ' cat << "EOF" > ~./Renviron
74+ # ' ## macrtools - gfortran: start
75+ # ' PATH=${PATH}:/opt/gfortran/bin
76+ # ' ## macrtools - gfortran: end
77+ # ' EOF
78+ # ' ```
79+ # '
80+ # ' ### gfortran Installation for R 4.3-4.4
81+ # '
82+ # ' The `gfortran` installer for R 4.3-4.4 is a universal installer that places
5883# ' `gfortran` into the `/opt/gfortran` for both **Intel** (`x86_64`) and
5984# ' **M-series** (`arm64`/`aarch64`) macs.
6085# '
@@ -205,7 +230,11 @@ gfortran_install <- function(password = base::getOption("macrtools.password"), v
205230
206231 gfortran_status <- FALSE
207232
208- if (is_r_version(" 4.3" ) || is_r_version(" 4.4" )) {
233+ if (is_r_version(" 4.5" )) {
234+ gfortran_status <- install_gfortran_14_2_universal(
235+ password = entered_password_gfortran ,
236+ verbose = verbose )
237+ } else if (is_r_version(" 4.3" ) || is_r_version(" 4.4" )) {
209238 gfortran_status <- install_gfortran_12_2_universal(
210239 password = entered_password_gfortran ,
211240 verbose = verbose )
@@ -390,7 +419,7 @@ gfortran_update <- function(password = base::getOption("macrtools.password"), ve
390419 assert_mac()
391420 assert_aarch64()
392421 assert(is_gfortran_installed(), " gfortran must be installed" )
393- assert(is_r_version(" 4.2" ) || is_r_version(" 4.3" ) || is_r_version(" 4.4" ),
422+ assert(is_r_version(" 4.2" ) || is_r_version(" 4.3" ) || is_r_version(" 4.4" ) || is_r_version( " 4.5 " ) ,
394423 " R 4.2 or above is required for gfortran update" )
395424
396425 # Figure out installation directory
@@ -541,10 +570,35 @@ install_gfortran_11_arm <- function(password = base::getOption("macrtools.passwo
541570}
542571
543572
573+ # ' Install gfortran v14.2 universal binaries
574+ # '
575+ # ' @details
576+ # ' Installs the `gfortran` v14.2 binaries for R version 4.5 for both
577+ # ' Intel and ARM-based macs.
578+ # '
579+ # ' @noRd
580+ install_gfortran_14_2_universal <- function (
581+ password = base :: getOption(" macrtools.password" ),
582+ verbose = TRUE ) {
583+
584+ # URL for gfortran 14.2 universal installer for R 4.5
585+ gfortran_14_universal <- " https://github.com/R-macos/gcc-14-branch/releases/download/gcc-14.2-darwin-r2.1/gfortran-14.2-universal.pkg"
586+
587+ # Download pkg
588+ path_to_pkg <- binary_download(gfortran_14_universal , verbose = verbose )
589+
590+ # Install pkg into the appropriate location
591+ pkg_install(path_to_pkg ,
592+ " /" ,
593+ password = password ,
594+ verbose = verbose )
595+ }
596+
597+
544598# ' Install gfortran v12.2 universal binaries
545599# '
546600# ' @details
547- # ' Installs the `gfortran` v12.2 binaries for R version 4.3 for both
601+ # ' Installs the `gfortran` v12.2 binaries for R version 4.3-4.4 for both
548602# ' Intel and ARM-based macs.
549603# '
550604# ' @noRd
0 commit comments