Skip to content

Commit

Permalink
Windows: update to libpq-15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Oct 8, 2023
1 parent 0bb23e1 commit 2de7898
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/Makevars.ucrt

This file was deleted.

9 changes: 4 additions & 5 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -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"
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 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')
}

0 comments on commit 2de7898

Please sign in to comment.