tesseract: build with cmake to fix missing symbol errors

For whatever reason building with configure and make leads to symbols
not being found (see https://github.com/termux/termux-packages/issues/7953).

When switching to cmake it seems that libicu and pango are not
considered optional dependencies anymore, so add these to dependecies.
This commit is contained in:
Henrik Grimler 2021-11-09 10:54:31 +01:00
parent 09cc196ad8
commit 7901483967
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
2 changed files with 17 additions and 13 deletions

View File

@ -3,27 +3,20 @@ TERMUX_PKG_DESCRIPTION="Tesseract is probably the most accurate open source OCR
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=5.0.0-rc1
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/tesseract-ocr/tesseract/archive/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=4bb7bc253edd77dc2bade54855e91d0858efac73df9f0117437337f358196987
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="libc++, libtool, libuuid, leptonica, libandroid-glob, zstd"
TERMUX_PKG_DEPENDS="libc++, libtool, libuuid, leptonica, libandroid-glob, zstd, libicu, pango"
TERMUX_PKG_BREAKS="tesseract-dev"
TERMUX_PKG_REPLACES="tesseract-dev"
termux_step_pre_configure() {
export LIBS="-landroid-glob"
# http://blog.matt-swain.com/post/26419042500/installing-tesseract-ocr-on-mac-os-x-lion
export LIBLEPT_HEADERSDIR=${TERMUX_PREFIX}/include/leptonica
perl -p -i -e 's|ADD_RT], true|ADD_RT], false|g' configure.ac
./autogen.sh
}
TERMUX_PKG_FORCE_CMAKE=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DUSE_SYSTEM_ICU=on"
termux_step_post_make_install() {
# download english trained data
cd "${TERMUX_PREFIX}/share/tessdata"
mkdir -p "${TERMUX_PREFIX}"/share/tessdata
cd "${TERMUX_PREFIX}"/share/tessdata
rm -f eng.*
local checksums

View File

@ -0,0 +1,11 @@
--- ../src-training-CMakeLists.txt.orig 2021-11-09 10:38:49.403732886 +0100
+++ ./src/training/CMakeLists.txt 2021-11-09 10:38:18.379641180 +0100
@@ -211,7 +211,7 @@
if (SW_BUILD)
target_link_libraries (unicharset_training PUBLIC common_training org.sw.demo.unicode.icu.i18n)
else()
-target_link_libraries (unicharset_training PUBLIC common_training ${ICU_LINK_LIBRARIES})
+target_link_libraries (unicharset_training PUBLIC common_training ${ICU_LINK_LIBRARIES} libandroid-glob.so)
endif()
target_include_directories (unicharset_training PUBLIC unicharset ${CMAKE_CURRENT_BINARY_DIR})
generate_export_header (unicharset_training EXPORT_MACRO_NAME TESS_UNICHARSET_TRAINING_API)