From bfbaf44394ca537eef6d4403c29cfea671985525 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Tue, 26 Sep 2023 15:08:08 +0200 Subject: [PATCH] Windows: update libs to new location --- .github/workflows/R-CMD-check.yaml | 5 +++-- src/Makevars.ucrt | 3 --- src/Makevars.win | 17 ++++++++++------- tools/winlibs.R | 23 ++++++++++++++++------- 4 files changed, 29 insertions(+), 19 deletions(-) delete mode 100644 src/Makevars.ucrt diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 65a75b0f..304b9d13 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -137,8 +137,9 @@ jobs: matrix: config: - {os: windows-latest, r: 'release'} - # Use 3.6 to trigger usage of RTools35 - - {os: windows-latest, r: '3.6'} + # Use 4.1 to trigger usage of RTools40 + - {os: windows-latest, r: '4.1'} + - {os: windows-latest, r: '4.2'} steps: - uses: actions/checkout@v3 diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt deleted file mode 100644 index ed1cc83f..00000000 --- a/src/Makevars.ucrt +++ /dev/null @@ -1,3 +0,0 @@ -CRT=-ucrt -TLS_LIBS=-lbcrypt -include Makevars.win diff --git a/src/Makevars.win b/src/Makevars.win index 713c09cb..2aef8c9b 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,11 +1,14 @@ -VERSION = 3.2.5 -RWINLIB = ../windows/libmariadbclient-$(VERSION) -TLS_LIBS ?= -lssl -lcrypto +RWINLIB = ../windows/libmariadbclient + +ifeq ($(R_COMPILED_BY),gcc 8.3.0) +TLS_LIBS = -lssl -lcrypto +endif -CXX_STD=CXX11 PKG_CPPFLAGS = -I$(RWINLIB)/include/mariadb -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR -PKG_LIBS= -L$(RWINLIB)/lib${R_ARCH}${CRT} \ - -lmariadbclient $(TLS_LIBS) -lz -lsecur32 -lshlwapi -lcrypt32 -lgdi32 -lws2_32 -pthread +PKG_LIBS = \ + -L$(RWINLIB)/lib$(R_ARCH) \ + -L$(RWINLIB)/lib \ + -lmariadbclient $(TLS_LIBS) -lz -lbcrypt -lsecur32 -lshlwapi -lcrypt32 -lgdi32 -lws2_32 -pthread # Necessary, so that the behavior of make called without arguments # is not changed: @@ -18,4 +21,4 @@ clean: rm -f $(SHLIB) $(OBJECTS) winlibs: - "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION) + "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" diff --git a/tools/winlibs.R b/tools/winlibs.R index 234866a0..20145ffd 100644 --- a/tools/winlibs.R +++ b/tools/winlibs.R @@ -1,9 +1,18 @@ -# Link against libmariadbclient static libraries -VERSION <- commandArgs(TRUE) -if(!file.exists(sprintf("../windows/libmariadbclient-%s/include/mariadb/mysql.h", VERSION))){ - if(getRversion() < "3.3.0") setInternet2() - download.file(sprintf("https://github.com/rwinlib/libmariadbclient/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE) +if(!file.exists("../windows/libmariadbclient/include/mysql.h")){ + unlink("../windows", recursive = TRUE) + url <- if(grepl("aarch", R.version$platform)){ + "https://github.com/r-windows/bundles/releases/download/libmariadbclient-3.2.5/libmariadbclient-3.2.5-clang-aarch64.tar.xz" + } else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){ + "https://github.com/r-windows/bundles/releases/download/libmariadbclient-3.2.5/libmariadbclient-3.2.5-clang-x86_64.tar.xz" + } else if(getRversion() >= "4.2") { + "https://github.com/r-windows/bundles/releases/download/libmariadbclient-3.2.5/libmariadbclient-3.2.5-ucrt-x86_64.tar.xz" + } else { + "https://github.com/rwinlib/libmariadbclient/archive/v3.2.5.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(), 'libmariadbclient') }