Skip to content

Commit

Permalink
Windows: update to libssl 3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 18, 2023
1 parent 736d6a8 commit 7f11ec3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
config:
- {os: windows-latest, r: '3.6'}
- {os: windows-latest, r: '4.1'}
- {os: windows-latest, r: '4.2'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'release', ssl_backend: 'openssl'}
- {os: windows-latest, r: 'devel'}
Expand Down
7 changes: 3 additions & 4 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
VERSION = 3.1.1
RWINLIB = ../windows/openssl-$(VERSION)
RWINLIB = ../windows/libssl
TARGET = lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH)
PKG_CPPFLAGS = -I$(RWINLIB)/include -DOPENSSL_SUPPRESS_DEPRECATED

Expand All @@ -9,7 +8,7 @@ LIBBCRYPT = bcrypt/bcrypt_pbkdf.o bcrypt/blowfish.o
PKG_LIBS = \
-Lbcrypt -lstatbcrypt \
-L$(RWINLIB)/$(TARGET) \
-L$(RWINLIB)/lib$(R_ARCH) \
-L$(RWINLIB)/lib \
-lssl -lcrypto -lz -lws2_32 -lgdi32 -lcrypt32

#all: clean
Expand All @@ -22,7 +21,7 @@ $(SHLIB): $(OBJECTS) $(STATLIB)
$(STATLIB): $(LIBBCRYPT)

winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"

clean:
rm -f $(SHLIB) $(OBJECTS) $(STATLIB) $(LIBBCRYPT)
Expand Down
22 changes: 14 additions & 8 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Build against mingw-w64 build of openssl
VERSION <- commandArgs(TRUE)
if(!file.exists(sprintf("../windows/openssl-%s/include/openssl/ssl.h", VERSION))){
if(getRversion() < "3.3.0") setInternet2()
download.file(sprintf("https://github.com/rwinlib/openssl/archive/v%s.zip", VERSION),
"lib.zip", quiet = TRUE)
if(!file.exists("../windows/libssl/include/openssl/pem.h")){
unlink("../windows", recursive = TRUE)
url <- if(grepl("aarch", R.version$platform)){
"https://github.com/r-windows/bundles/releases/download/openssl-3.1.2/openssl-3.1.2-clang-aarch64.tar.xz"
} else if(getRversion() >= "4.2") {
"https://github.com/r-windows/bundles/releases/download/openssl-3.1.2/openssl-3.1.2-ucrt-x86_64.tar.xz"
} else {
"https://github.com/rwinlib/openssl/archive/v3.1.1.zip"
}
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(), 'libssl')
}

0 comments on commit 7f11ec3

Please sign in to comment.