From 7b406485d40f5442a82e222e71c9ec0fc525d280 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Mon, 25 Sep 2023 22:28:52 +0200 Subject: [PATCH] Windows: support arm --- .github/workflows/R-CMD-check.yaml | 5 +++-- DESCRIPTION | 2 +- NEWS | 3 +++ src/Makevars.win | 11 +++++++++-- tools/winlibs.R | 22 ++++++++++++++++------ 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 2353bb0..8a962dc 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -19,7 +19,8 @@ jobs: - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - {os: windows-latest, r: '4.1'} - - {os: windows-latest, r: '3.6'} + - {os: windows-latest, r: '4.2'} + - {os: windows-latest, r: 'devel'} - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} - {os: ubuntu-latest, r: 'release'} - {os: ubuntu-latest, r: 'oldrel-1'} @@ -29,7 +30,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/DESCRIPTION b/DESCRIPTION index fbd6a5e..25314e2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: sodium Type: Package Title: A Modern and Easy-to-Use Crypto Library -Version: 1.2.1 +Version: 1.3.0 Authors@R: person("Jeroen", "Ooms", role = c("aut", "cre"), email = "jeroen@berkeley.edu", comment = c(ORCID = "0000-0002-4035-0289")) Description: Bindings to 'libsodium' : a modern, diff --git a/NEWS b/NEWS index 4105884..3ed000b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.3.0 + - Windows: support arm + 1.2.0 - Fix crash with bin2hex() for very large input vectors diff --git a/src/Makevars.win b/src/Makevars.win index e105954..7efe22a 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,5 +1,12 @@ -PKG_CPPFLAGS= -I../windows/sodium-1.0.12/include -PKG_LIBS= -L../windows/sodium-1.0.12/lib${R_ARCH} -lsodium +RWINLIB = ../windows/sodium +OLDLIBDIR = lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH) + +PKG_CPPFLAGS = -I$(RWINLIB)/include + +PKG_LIBS = \ + -L${RWINLIB}/$(OLDLIBDIR) \ + -L${RWINLIB}/lib \ + -lsodium all: clean winlibs diff --git a/tools/winlibs.R b/tools/winlibs.R index d897c7f..9299206 100644 --- a/tools/winlibs.R +++ b/tools/winlibs.R @@ -1,8 +1,18 @@ -# Build against mingw-w64 build of libsodium -if(!file.exists("../windows/sodium-1.0.12/include/sodium.h")){ - if(getRversion() < "3.3.0") setInternet2() - download.file("https://github.com/rwinlib/sodium/archive/v1.0.12.zip", "lib.zip", quiet = TRUE) +if(!file.exists("../windows/sodium/include/sodium.h")){ + unlink("../windows", recursive = TRUE) + url <- if(grepl("aarch", R.version$platform)){ + "https://github.com/r-windows/bundles/releases/download/libsodium-1.0.18/libsodium-1.0.18-clang-aarch64.tar.xz" + } else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){ + "https://github.com/r-windows/bundles/releases/download/libsodium-1.0.18/libsodium-1.0.18-clang-x86_64.tar.xz" + } else if(getRversion() >= "4.2") { + "https://github.com/r-windows/bundles/releases/download/libsodium-1.0.18/libsodium-1.0.18-ucrt-x86_64.tar.xz" + } else { + "https://github.com/rwinlib/sodium/archive/v1.0.12.tar.gz" + } + download.file(url, basename(url), quiet = TRUE) dir.create("../windows", showWarnings = FALSE) - unzip("lib.zip", exdir = "../windows") - unlink("lib.zip") + untar(basename(url), exdir = "../windows", tar = 'internal') + unlink(basename(url)) + setwd("../windows") + file.rename(list.files(), 'sodium') }