Skip to content

Commit

Permalink
Windows: update libgit2 1.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 18, 2023
1 parent eaddaab commit 534bf7a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '4.2'}
- {os: windows-latest, r: '4.1'}
- {os: windows-latest, r: '3.6'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
Expand Down
11 changes: 5 additions & 6 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
VERSION = 1.7.0
RWINLIB = ../windows/libgit2-$(VERSION)
RWINLIB = ../windows/libgit2
TARGET = lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH)

PKG_CPPFLAGS = -I$(RWINLIB)/include \
-DR_NO_REMAP -DSTRICT_R_HEADERS

PKG_LIBS = \
-L$(RWINLIB)/$(TARGET) \
-L$(RWINLIB)/lib$(R_ARCH) \
-lgit2 -lssh2 -lz -lcrypto -liconv \
-lwinhttp -lws2_32 -lcrypt32 -lole32 -lrpcrt4
-L$(RWINLIB)/lib \
-lgit2 -lssh2 -lssl -lcrypto -lz -liconv \
-lwinhttp -lws2_32 -lcrypt32 -lole32 -lrpcrt4 -lsecur32

all: clean winlibs

winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"

clean:
rm -f $(SHLIB) $(OBJECTS)
Expand Down
20 changes: 14 additions & 6 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
if(getRversion() < "3.3.0") setInternet2()
VERSION <- commandArgs(TRUE)
if(!file.exists(sprintf("../windows/libgit2-%s/include/git2.h", VERSION))){
download.file(sprintf("https://github.com/rwinlib/libgit2/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE)
if(!file.exists("../windows/libgit2/include/git2.h")){
unlink("../windows", recursive = TRUE)
url <- if(grepl("aarch", R.version$platform)){
"https://github.com/r-windows/bundles/releases/download/libgit2-1.7.1/libgit2-1.7.1-clang-aarch64.tar.xz"
} else if(getRversion() >= "4.2") {
"https://github.com/r-windows/bundles/releases/download/libgit2-1.7.1/libgit2-1.7.1-ucrt-x86_64.tar.xz"
} else {
"https://github.com/rwinlib/libgit2/archive/v1.7.1.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(), 'libgit2')
}

0 comments on commit 534bf7a

Please sign in to comment.