Skip to content

Commit 3b99e0f

Browse files
authored
Merge pull request #442 from r-dbi/winlibs
2 parents 1ac74a9 + 1a6da49 commit 3b99e0f

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ jobs:
137137
matrix:
138138
config:
139139
- {os: windows-latest, r: 'release'}
140-
# Use 3.6 to trigger usage of RTools35
141-
- {os: windows-latest, r: '3.6'}
140+
- {os: windows-latest, r: '4.2'}
141+
- {os: windows-latest, r: '4.1'}
142142

143143
steps:
144144
- uses: actions/checkout@v4

src/Makevars.ucrt

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/Makevars.win

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
VERSION = 13.2.0
2-
RWINLIB = ../windows/libpq-$(VERSION)
3-
PKG_CPPFLAGS = -I$(RWINLIB)/include -Ivendor -DSTRICT_R_HEADERS -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR
4-
PKG_LIBS = -L$(RWINLIB)/lib${R_ARCH}${CRT} \
1+
RWINLIB = ../windows/libpq
2+
PKG_CPPFLAGS = -I$(RWINLIB)/include -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR
3+
PKG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \
54
-lpq -lpgport -lpgcommon -lssl -lcrypto -lwsock32 -lsecur32 -lws2_32 -lgdi32 -lcrypt32 -lwldap32
65

76
$(SHLIB):
@@ -12,4 +11,4 @@ clean:
1211
rm -f $(SHLIB) $(OBJECTS)
1312

1413
winlibs:
15-
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
14+
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"

tools/winlibs.R

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
# Link against libpq static libraries
2-
VERSION <- commandArgs(TRUE)
3-
if(!file.exists(sprintf("../windows/libpq-%s/include/libpq-fe.h", VERSION))){
4-
if(getRversion() < "3.3.0") setInternet2()
5-
download.file(sprintf("https://github.com/rwinlib/libpq/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE)
1+
if(!file.exists("../windows/libpq/include/libpq-fe.h")){
2+
unlink("../windows", recursive = TRUE)
3+
url <- if(grepl("aarch", R.version$platform)){
4+
"https://github.com/r-windows/bundles/releases/download/libpq-15.3/libpq-15.3-clang-aarch64.tar.xz"
5+
} else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){
6+
"https://github.com/r-windows/bundles/releases/download/libpq-15.3/libpq-15.3-clang-x86_64.tar.xz"
7+
} else if(getRversion() >= "4.2") {
8+
"https://github.com/r-windows/bundles/releases/download/libpq-15.3/libpq-15.3-ucrt-x86_64.tar.xz"
9+
} else {
10+
"https://github.com/rwinlib/libpq/archive/v13.2.0.tar.gz"
11+
}
12+
download.file(url, basename(url), quiet = TRUE)
613
dir.create("../windows", showWarnings = FALSE)
7-
unzip("lib.zip", exdir = "../windows")
8-
unlink("lib.zip")
14+
untar(basename(url), exdir = "../windows", tar = 'internal')
15+
unlink(basename(url))
16+
setwd("../windows")
17+
file.rename(list.files(), 'libpq')
918
}

0 commit comments

Comments
 (0)