Skip to content

Commit 97fa486

Browse files
authored
Windows: use poppler from Rtools if found (#135)
1 parent f786f24 commit 97fa486

File tree

4 files changed

+29
-19
lines changed

4 files changed

+29
-19
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
config:
1919
- {os: macOS-latest, r: 'release'}
2020
- {os: windows-latest, r: 'devel'}
21-
- {os: windows-latest, r: 'release'}
21+
- {os: windows-latest, r: '4.4'}
22+
- {os: windows-latest, r: '4.3'}
2223
- {os: windows-latest, r: '4.2'}
2324
- {os: windows-latest, r: '4.1'}
2425
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: pdftools
22
Type: Package
33
Title: Text Extraction, Rendering and Converting of PDF Documents
4-
Version: 3.4.1
4+
Version: 3.5.0
55
Authors@R: person("Jeroen", "Ooms", role = c("aut", "cre"), email = "[email protected]",
66
comment = c(ORCID = "0000-0002-4035-0289"))
77
Description: Utilities based on 'libpoppler' <https://poppler.freedesktop.org> for extracting

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
3.5.0
2+
- Windows: use poppler from Rtools if found
3+
14
3.4.1
25
- Remove some test verbosity as per CRAN requeset
36
- Update maintainer email address

src/Makevars.win

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1-
POPPLERDATA=share/poppler
2-
RWINLIB=../windows/poppler
3-
PKG_CXXFLAGS=-Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA
4-
PKG_CPPFLAGS=-I$(RWINLIB)/include/poppler/cpp \
5-
-I$(RWINLIB)/include/poppler \
6-
-DSTRICT_R_HEADERS -DR_NO_REMAP
1+
PKG_CONFIG_NAME = poppler-cpp poppler-data
2+
PKG_CONFIG ?= $(BINPREF)pkg-config
3+
PKG_CXXFLAGS = -Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA -DSTRICT_R_HEADERS -DR_NO_REMAP
4+
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))
75

8-
PKG_LIBS= \
9-
-L$(RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
10-
-L$(RWINLIB)/lib \
11-
-lpoppler-cpp -lpoppler -llcms2 -ljpeg -lpng16 -ltiff -lopenjp2 \
12-
-lfreetype -lfreetype -lbz2 -liconv -lz
6+
ifneq ($(PKG_LIBS),)
7+
$(info using $(PKG_CONFIG_NAME) from Rtools)
8+
PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME))
9+
POPPLERDATA := $(shell pkg-config --variable=poppler_datadir $(PKG_CONFIG_NAME))
10+
else
11+
RWINLIB = ../windows/poppler
12+
PKG_CPPFLAGS = -I$(RWINLIB)/include/poppler/cpp -I$(RWINLIB)/include/poppler
13+
PKG_LIBS = -L$(RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} -L$(RWINLIB)/lib \
14+
-lpoppler-cpp -lpoppler -llcms2 -ljpeg -lpng16 -ltiff -lopenjp2 -lfreetype -lfreetype -lbz2 -liconv -lz
15+
POPPLERDATA = $(RWINLIB)/share/poppler
16+
endif
1317

14-
all: clean winlibs
18+
all: $(SHLIB) copydata
1519

16-
clean:
17-
rm -f $(OBJECTS) $(SHLIB)
20+
$(OBJECTS): $(RWINLIB)
1821

19-
winlibs:
22+
$(RWINLIB):
2023
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
24+
25+
copydata:
2126
rm -Rf ../inst/share && mkdir -p ../inst/share
22-
cp -Rf $(RWINLIB)/$(POPPLERDATA) ../inst/share/poppler
27+
cp -Rf $(POPPLERDATA) ../inst/share/
2328

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

0 commit comments

Comments
 (0)