From 2de7898829de12fecfa2674a17f69d18b913bd11 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Sun, 8 Oct 2023 15:27:04 +0200 Subject: [PATCH] Windows: update to libpq-15.3 --- .github/workflows/R-CMD-check.yaml | 4 ++-- src/Makevars.ucrt | 2 -- src/Makevars.win | 9 ++++----- tools/winlibs.R | 23 ++++++++++++++++------- 4 files changed, 22 insertions(+), 16 deletions(-) delete mode 100644 src/Makevars.ucrt diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index dfe2dc8a..955a8ae8 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -137,8 +137,8 @@ jobs: matrix: config: - {os: windows-latest, r: 'release'} - # Use 3.6 to trigger usage of RTools35 - - {os: windows-latest, r: '3.6'} + - {os: windows-latest, r: '4.2'} + - {os: windows-latest, r: '4.1'} steps: - uses: actions/checkout@v4 diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt deleted file mode 100644 index 1a2e1013..00000000 --- a/src/Makevars.ucrt +++ /dev/null @@ -1,2 +0,0 @@ -CRT=-ucrt -include Makevars.win diff --git a/src/Makevars.win b/src/Makevars.win index ab0719ac..f672d883 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,7 +1,6 @@ -VERSION = 13.2.0 -RWINLIB = ../windows/libpq-$(VERSION) -PKG_CPPFLAGS = -I$(RWINLIB)/include -Ivendor -DSTRICT_R_HEADERS -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR -PKG_LIBS = -L$(RWINLIB)/lib${R_ARCH}${CRT} \ +RWINLIB = ../windows/libpq +PKG_CPPFLAGS = -I$(RWINLIB)/include -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR +PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \ -lpq -lpgport -lpgcommon -lssl -lcrypto -lwsock32 -lsecur32 -lws2_32 -lgdi32 -lcrypt32 -lwldap32 $(SHLIB): @@ -12,4 +11,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 802c7573..7ec3f84f 100644 --- a/tools/winlibs.R +++ b/tools/winlibs.R @@ -1,9 +1,18 @@ -# Link against libpq static libraries -VERSION <- commandArgs(TRUE) -if(!file.exists(sprintf("../windows/libpq-%s/include/libpq-fe.h", VERSION))){ - if(getRversion() < "3.3.0") setInternet2() - download.file(sprintf("https://github.com/rwinlib/libpq/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE) +if(!file.exists("../windows/libpq/include/libpq-fe.h")){ + unlink("../windows", recursive = TRUE) + url <- if(grepl("aarch", R.version$platform)){ + "https://github.com/r-windows/bundles/releases/download/libpq-15.3/libpq-15.3-clang-aarch64.tar.xz" + } else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){ + "https://github.com/r-windows/bundles/releases/download/libpq-15.3/libpq-15.3-clang-x86_64.tar.xz" + } else if(getRversion() >= "4.2") { + "https://github.com/r-windows/bundles/releases/download/libpq-15.3/libpq-15.3-ucrt-x86_64.tar.xz" + } else { + "https://github.com/rwinlib/libpq/archive/v13.2.0.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(), 'libpq') }