Skip to content

Commit 9c3fc65

Browse files
committed
Windows: use libxml2 from Rtools if found
1 parent bd8a5c6 commit 9c3fc65

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

Diff for: .github/workflows/R-CMD-check.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
- {os: macos-latest, r: 'release'}
2828

2929
- {os: windows-latest, r: 'release'}
30-
# use 4.0 or 4.1 to check with rtools40's older compiler
30+
- {os: windows-latest, r: 'oldrel-1'}
31+
- {os: windows-latest, r: 'oldrel-2'}
32+
- {os: windows-latest, r: 'oldrel-3'}
3133
- {os: windows-latest, r: 'oldrel-4'}
3234

3335
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}

Diff for: NEWS.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# xml2 (development version)
22

3+
* Windows: use libxml2 from Rtools if found
4+
35
# xml2 1.3.6
46

57
* Now compatible with libxml2 2.12.0 and later (@KNnut).

Diff for: src/Makevars.win

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
VERSION=2.10.3
2-
RWINLIB=../windows/libxml2-$(VERSION)
3-
PKG_CPPFLAGS=-I../inst/include -I$(RWINLIB)/include/libxml2 \
4-
-DLIBXML_STATIC
1+
PKG_CONFIG_NAME = libxml-2.0
2+
PKG_CONFIG ?= $(BINPREF)pkg-config
3+
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))
4+
STATIC_CFLAGS = -DLIBXML_STATIC -I../inst/include
55

6+
ifneq ($(PKG_LIBS),)
7+
$(info using $(PKG_CONFIG_NAME) from Rtools)
8+
PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME)) $(STATIC_CFLAGS)
9+
else
10+
RWINLIB = ../windows/libxml2-2.10.3
11+
PKG_CPPFLAGS = -I$(RWINLIB)/include -I$(RWINLIB)/include/libxml2 $(STATIC_CFLAGS)
612
PKG_LIBS = -L$(RWINLIB)/lib${subst gcc,,$(COMPILED_BY)}$(R_ARCH) \
7-
-L$(RWINLIB)/lib$(R_ARCH)\
8-
-lxml2 -llzma -liconv -lz -lws2_32
13+
-L$(RWINLIB)/lib$(R_ARCH) -lxml2 -llzma -liconv -lz -lws2_32
14+
endif
915

10-
all: clean winlibs
16+
all: $(SHLIB)
1117

12-
clean:
13-
rm -f $(OBJECTS) $(SHLIB)
18+
$(OBJECTS): $(RWINLIB)
1419

15-
winlibs:
16-
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
20+
$(RWINLIB):
21+
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
1722

18-
.PHONY: all winlibs clean
23+
clean:
24+
rm -f $(SHLIB) $(OBJECTS)

Diff for: tools/winlibs.R

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Build against static libraries from rwinlib
2-
VERSION <- commandArgs(TRUE)
3-
if(!file.exists(sprintf("../windows/libxml2-%s/include/libxml2/libxml/parser.h", VERSION))){
4-
if(getRversion() < "3.3.0") setInternet2()
5-
download.file(sprintf("https://github.com/rwinlib/libxml2/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE)
2+
if(!file.exists("../windows/libxml2-2.10.3/include/libxml2/libxml/parser.h")){
3+
download.file("https://github.com/rwinlib/libxml2/archive/v2.10.3.zip", "lib.zip", quiet = TRUE)
64
dir.create("../windows", showWarnings = FALSE)
75
unzip("lib.zip", exdir = "../windows")
86
unlink("lib.zip")

0 commit comments

Comments
 (0)