Skip to content

Commit 4bc6200

Browse files
committed
add harfbuzz
1 parent 22e5db9 commit 4bc6200

File tree

4 files changed

+25
-30
lines changed

4 files changed

+25
-30
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ vignettes/.*\.png$
2828
^tesseract\.sh$
2929
^lib$
3030
^pacman\.conf$
31+
^harfbuzz\.sh$

harfbuzz.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
export deps="fribidi freetype libpng libtiff libjpeg bzip2 zlib"

src/Makevars.win

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
1-
# Tesseract configuration
2-
TESSERACT_RWINLIB = ../windows/tesseract
3-
PKG_CPPFLAGS += -I${TESSERACT_RWINLIB}/include -I${TESSERACT_RWINLIB}/include/leptonica
1+
RWINLIB_TESSERACT=../windows/tesseract
2+
RWINLIB_POPPLER=../windows/poppler
3+
POPPLERDATA=share/poppler
44

5-
PKG_LIBS += \
6-
-L${TESSERACT_RWINLIB}/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
7-
-L${TESSERACT_RWINLIB}/lib \
5+
PKG_CPPFLAGS = -I${RWINLIB_TESSERACT}/include -I${RWINLIB_TESSERACT}/include/leptonica -I${RWINLIB_POPPLER}/include/poppler/cpp -I${RWINLIB_POPPLER}/include/poppler
6+
7+
PKG_CXXFLAGS = -Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA
8+
9+
PKG_LIBS = \
10+
-L${RWINLIB_TESSERACT}/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
11+
-L${RWINLIB_TESSERACT}/lib \
12+
-L${RWINLIB_POPPLER}/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
13+
-L${RWINLIB_POPPLER}/lib \
814
-ltesseract -lleptonica \
915
-ltiff -lopenjp2 -lwebp -lsharpyuv -ljpeg -lgif -lpng16 -lz \
10-
-lws2_32
11-
12-
# Poppler configuration
13-
POPPLERDATA = share/poppler
14-
POPPLER_RWINLIB = ../windows/poppler
15-
PKG_CXXFLAGS += -Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA
16-
PKG_CPPFLAGS += -I$(POPPLER_RWINLIB)/include/poppler/cpp \
17-
-I$(POPPLER_RWINLIB)/include/poppler \
18-
-DSTRICT_R_HEADERS -DR_NO_REMAP
19-
20-
PKG_LIBS += \
21-
-L$(POPPLER_RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
22-
-L$(POPPLER_RWINLIB)/lib \
16+
-lws2_32 \
2317
-lpoppler-cpp -lpoppler -llcms2 -ljpeg -lpng16 -ltiff -lopenjp2 \
2418
-lfreetype -lfreetype -lbz2 -liconv -lz
2519

2620
all: clean winlibs
2721

2822
clean:
29-
cmd /C "del /Q $(OBJECTS) $(SHLIB)"
23+
rm -f $(OBJECTS) $(SHLIB)
3024

3125
winlibs:
3226
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
33-
cmd /C "rmdir /S /Q ..\\inst\\share && mkdir ..\\inst\\share"
34-
cmd /C "xcopy /E /I $(POPPLER_RWINLIB)\\$(POPPLERDATA) ..\\inst\\share\\poppler"
27+
cp -Rf ../windows/tessdata ../inst/
28+
cp -Rf ${RWINLIB_TESSERACT}/share/tessdata ../inst/
29+
rm -Rf ../inst/share && mkdir -p ../inst/share
30+
cp -Rf $(RWINLIB_POPPLER)/$(POPPLERDATA) ../inst/share/poppler
3531

3632
.PHONY: all winlibs clean
3733

tools/winlibs.R

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ if (!file.exists("../windows/tesseract/include/tesseract/baseapi.h")) {
88
"https://github.com/pachadotdev/cpp11tesseract/releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-clang-x86_64.tar.xz"
99
} else if (getRversion() >= "4.3") {
1010
"https://github.com/pachadotdev/cpp11tesseract/releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-ucrt-x86_64.tar.xz"
11-
} else {
12-
"https://github.com/rwinlib/tesseract/archive/v5.3.2.tar.gz"
1311
}
1412
download.file(url, basename(url), quiet = TRUE)
15-
dir.create("../windows/tesseract", showWarnings = FALSE)
16-
untar(basename(url), exdir = "../windows/tesseract", tar = "internal")
13+
untar(basename(url), exdir = "../windows/", tar = "internal")
14+
file.rename(file.path("../windows", dir("../windows", pattern = "tesseract-ocr-")), "../windows/tesseract")
1715
unlink(basename(url))
1816
}
1917

@@ -44,11 +42,9 @@ if (!file.exists("../windows/poppler/include/poppler/cpp/poppler-document.h")) {
4442
"https://github.com/pachadotdev/cpp11tesseract/releases/download/poppler-23.08.0/poppler-23.08.0-clang-x86_64.tar.xz"
4543
} else if (getRversion() >= "4.3") {
4644
"https://github.com/pachadotdev/cpp11tesseract/releases/download/poppler-23.08.0/poppler-23.08.0-ucrt-x86_64.tar.xz"
47-
} else {
48-
"https://github.com/rwinlib/poppler/archive/v22.04.0-2.tar.gz"
4945
}
5046
download.file(url, basename(url), quiet = TRUE)
51-
dir.create("../windows/poppler", showWarnings = FALSE)
52-
untar(basename(url), exdir = "../windows/poppler", tar = "internal")
47+
untar(basename(url), exdir = "../windows/", tar = "internal")
48+
file.rename(file.path("../windows", dir("../windows", pattern = "poppler-")), "../windows/poppler")
5349
unlink(basename(url))
5450
}

0 commit comments

Comments
 (0)