Skip to content

Commit

Permalink
Windows: update to poppler 23.08.0 + deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Sep 19, 2023
1 parent 640d6e6 commit 85de43c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'devel'}
- {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'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pdftools
Type: Package
Title: Text Extraction, Rendering and Converting of PDF Documents
Version: 3.3.3
Version: 3.4.0
Authors@R: person("Jeroen", "Ooms", role = c("aut", "cre"), email = "jeroen@berkeley.edu",
comment = c(ORCID = "0000-0002-4035-0289"))
Description: Utilities based on 'libpoppler' for extracting text, fonts, attachments and
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
3.4.0
- Windows: update to poppler 23.08.0 + deps

3.3.3
- Fix a bug in the version checking macro
- Remove CXX11 from Makevars.win
Expand Down
17 changes: 4 additions & 13 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
VERSION=22.04.0
POPPLERDATA=share/poppler

# Need older poppler for R < 4.0
ifeq ($(R_COMPILED_BY),gcc 4.9.3)
VERSION=0.73.0
POPPLERDATA=poppler-data-0.4.9
LIBHARFBUZZ=-lharfbuzz
endif

RWINLIB=../windows/poppler-$(VERSION)
RWINLIB=../windows/poppler
PKG_CXXFLAGS=-Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA
PKG_CPPFLAGS=-I$(RWINLIB)/include/poppler/cpp \
-I$(RWINLIB)/include/poppler

PKG_LIBS= \
-L$(RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
-L$(RWINLIB)/lib${R_ARCH} \
-L$(RWINLIB)/lib \
-lpoppler-cpp -lpoppler -llcms2 -ljpeg -lpng16 -ltiff -lopenjp2 \
-lfreetype $(LIBHARFBUZZ) -lfreetype -lbz2 -liconv -lz
-lfreetype -lfreetype -lbz2 -liconv -lz

all: clean winlibs

clean:
rm -f $(OBJECTS) $(SHLIB)

winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
rm -Rf ../inst/share && mkdir -p ../inst/share
cp -Rf $(RWINLIB)/$(POPPLERDATA) ../inst/share/poppler

Expand Down
29 changes: 14 additions & 15 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Build against mingw-w64 build of poppler 0.57.0
VERSION <- commandArgs(TRUE)
if(!file.exists(sprintf("../windows/poppler-%s/include/poppler/cpp/poppler-document.h", VERSION))){
if(getRversion() < "3.3.0") setInternet2()
download.file(sprintf("https://github.com/rwinlib/poppler/archive/v%s.zip", VERSION),
"lib.zip", quiet = TRUE)
if(!file.exists("../windows/poppler/include/poppler/cpp/poppler-document.h")){
unlink("../windows", recursive = TRUE)
url <- if(grepl("aarch", R.version$platform)){
"https://github.com/r-windows/bundles/releases/download/poppler-23.08.0/poppler-23.08.0-clang-aarch64.tar.xz"
} else if(getRversion() >= "4.2") {
"https://github.com/r-windows/bundles/releases/download/poppler-23.08.0/poppler-23.08.0-ucrt-x86_64.tar.xz"
} else {
"https://github.com/rwinlib/poppler/archive/v22.04.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(), 'poppler')
}

# Download extra poppler data
#if(!file.exists("../windows/poppler-data-0.4.8")){
# download.file("https://poppler.freedesktop.org/poppler-data-0.4.8.tar.gz", "data.tar.gz", quiet = TRUE)
# untar("data.tar.gz", exdir = "../windows")
# unlink("data.tar.gz")
#}

0 comments on commit 85de43c

Please sign in to comment.