Skip to content

Commit

Permalink
Windows: update libs to new location
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 26, 2023
1 parent b5a54ae commit bfbaf44
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 19 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 @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/Makevars.ucrt

This file was deleted.

17 changes: 10 additions & 7 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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"
23 changes: 16 additions & 7 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -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')
}

0 comments on commit bfbaf44

Please sign in to comment.