Skip to content

Commit

Permalink
Windows: support arm
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 25, 2023
1 parent af19893 commit ab90033
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]",
comment = c(ORCID = "0000-0002-4035-0289"))
Description: Bindings to 'libsodium' <https://doc.libsodium.org/>: a modern,
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.3.0
- Windows: support arm

1.2.0
- Fix crash with bin2hex() for very large input vectors

Expand Down
9 changes: 7 additions & 2 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
PKG_CPPFLAGS= -I../windows/sodium-1.0.12/include
PKG_LIBS= -L../windows/sodium-1.0.12/lib${R_ARCH} -lsodium
RWINLIB = ../windows/sodium
PKG_CPPFLAGS = -I$(RWINLIB)/include

PKG_LIBS = \
-L$(RWINLIB)/lib$(R_ARCH) \
-L${RWINLIB}/lib \
-lsodium

all: clean winlibs

Expand Down
22 changes: 16 additions & 6 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -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')
}

0 comments on commit ab90033

Please sign in to comment.