Skip to content

Commit

Permalink
[tesseract] port update to 4.1.0 release (#7227)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhbanito authored and Rastaban committed Jul 18, 2019
1 parent 505eae9 commit 1223604
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 44 deletions.
11 changes: 9 additions & 2 deletions ports/tesseract/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Source: tesseract
Version: 4.0.0-3
Version: 4.1.0
Homepage: https://github.com/tesseract-ocr/tesseract
Description: An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.
Build-Depends: leptonica, icu
Build-Depends: leptonica

Feature: training_tools
Description: build training tools
Build-Depends: icu

Feature: cpu_independed
Description: build on any cpu extension commands support
13 changes: 13 additions & 0 deletions ports/tesseract/fix-tiff-linkage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f154663..c07b827 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -431,7 +431,7 @@ endif()
add_executable (tesseract ${tesseractmain_src} ${tesseractmain_rsc})
target_link_libraries (tesseract libtesseract)
if (HAVE_TIFFIO_H)
- target_link_libraries(tesseract tiff)
+ target_link_libraries(tesseract TIFF::TIFF)
endif()

if (OPENMP_BUILD AND UNIX)
13 changes: 0 additions & 13 deletions ports/tesseract/leptonica.patch

This file was deleted.

49 changes: 43 additions & 6 deletions ports/tesseract/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,41 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tesseract-ocr/tesseract
REF 4.0.0
SHA512 69e57d4ba1fc43d212fd0fff69a2b5d48a3b37cfee7054fdc083cbb7e04d92317609a32e457229661d70ce8d9b16c9d25e81bfc3861db660dd2c8f292202d447
HEAD_REF master
REF 4.1.0
SHA512 d617f5c5b826640b2871dbe3d7973bcc5e66fafd837921a20e009d683806ed50f0f258aa455019d99fc54f5cb65c2fa0380e3a3c92b39ab0684b8799c730b09d
PATCHES
use-vcpkg-icu.patch
ws2-32.patch
leptonica.patch
fix-tiff-linkage.patch
)

# The built-in cmake FindICU is better
file(REMOVE ${SOURCE_PATH}/cmake/FindICU.cmake)

# Handle Static Library Output
if(VCPKG_LIBRARY_LINKAGE EQUAL "static")
list(APPEND OPTIONS_LIST -DSTATIC=ON)
endif()

# Handle CONTROL
if("training_tools" IN_LIST FEATURES)
list(APPEND OPTIONS_LIST -DBUILD_TRAINING_TOOLS=ON)
else()
list(APPEND OPTIONS_LIST -DBUILD_TRAINING_TOOLS=OFF)
endif()
if("independed_architecture" IN_LIST FEATURES)
list(APPEND OPTIONS_LIST -DTARGET_ARCHITECTURE=none)
else()
list(APPEND OPTIONS_LIST -DTARGET_ARCHITECTURE=auto)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSTATIC=ON
-DUSE_SYSTEM_ICU=True
#any value for vcpkg leptonica link cmake branch select
-DLeptonica_DIR=YES
${OPTIONS_LIST}
)

vcpkg_install_cmake()
Expand All @@ -35,6 +52,26 @@ set(EXTENSION)
if(WIN32)
set(EXTENSION ".exe")
endif()

# copy training tools
set(TRAINING_TOOLS_DIR ${CURRENT_PACKAGES_DIR}/tools/tesseract/training)
if("training_tools" IN_LIST FEATURES)
file(COPY ${CURRENT_PACKAGES_DIR}/bin/ambiguous_words${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/classifier_tester${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/combine_tessdata${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/cntraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/dawg2wordlist${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/mftraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/shapeclustering${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/wordlist2dawg${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/combine_lang_model${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/lstmeval${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/lstmtraining${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/set_unicharset_properties${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/unicharset_extractor${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
file(COPY ${CURRENT_PACKAGES_DIR}/bin/text2image${EXTENSION} DESTINATION ${TRAINING_TOOLS_DIR})
endif()

file(COPY ${CURRENT_PACKAGES_DIR}/bin/tesseract${EXTENSION} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/tesseract)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/tesseract)

Expand Down
11 changes: 0 additions & 11 deletions ports/tesseract/use-vcpkg-icu.patch

This file was deleted.

12 changes: 0 additions & 12 deletions ports/tesseract/ws2-32.patch

This file was deleted.

0 comments on commit 1223604

Please sign in to comment.