Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tesseract] update to 5.2.0 #26114

Merged
merged 17 commits into from
Aug 15, 2022
13 changes: 13 additions & 0 deletions ports/opencv4/0018-fix-depend-tesseract.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/modules/text/cmake/init.cmake b/modules/text/cmake/init.cmake
index 254757e..73194ec 100644
--- a/modules/text/cmake/init.cmake
+++ b/modules/text/cmake/init.cmake
@@ -4,6 +4,8 @@ OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CRO
if(NOT HAVE_TESSERACT
AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT)
)
+ find_package(Tesseract CONFIG REQUIRED)
+ set(Tesseract_LIBRARIES Tesseract::libtesseract)
if(NOT Tesseract_FOUND)
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
endif()
7 changes: 7 additions & 0 deletions ports/opencv4/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ if("contrib" IN_LIST FEATURES)
0013-fix-ceres.patch
0014-fix-ogre.patch
0016-fix-freetype-contrib.patch
0018-fix-depend-tesseract.patch
)
set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules")

Expand Down Expand Up @@ -352,6 +353,12 @@ if("qt" IN_LIST FEATURES)
list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON")
endif()

if("contrib" IN_LIST FEATURES)
if(VCPKG_TARGET_IS_UWP)
list(APPEND ADDITIONAL_BUILD_FLAGS "-DWITH_TESSERACT=OFF")
endif()
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
Expand Down
1 change: 1 addition & 0 deletions ports/opencv4/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "opencv4",
"version": "4.6.0",
"port-version": 1,
"description": "computer vision library",
"homepage": "https://github.com/opencv/opencv",
"license": "Apache-2.0",
Expand Down
14 changes: 14 additions & 0 deletions ports/tesseract/fix-depend-libarchive.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd2649d..f932913 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -792,7 +792,8 @@ if(OpenCL_FOUND)
target_link_libraries(libtesseract PUBLIC OpenCL::OpenCL)
endif()
if(LibArchive_FOUND)
- target_link_libraries(libtesseract PUBLIC ${LibArchive_LIBRARIES})
+ find_package(LibArchive REQUIRED)
+ target_link_libraries(libtesseract PRIVATE LibArchive::LibArchive)
endif(LibArchive_FOUND)
if(CURL_FOUND)
if(NOT CURL_LIBRARIES)
13 changes: 0 additions & 13 deletions ports/tesseract/fix-tiff-linkage.patch

This file was deleted.

14 changes: 0 additions & 14 deletions ports/tesseract/fix-timeval.patch

This file was deleted.

30 changes: 19 additions & 11 deletions ports/tesseract/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
if(NOT VCPKG_TARGET_IS_WINDOWS)
set(tesseract_patch fix-depend-libarchive.patch)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tesseract-ocr/tesseract
REF 4.1.1
SHA512 017723a2268be789fe98978eed02fd294968cc8050dde376dee026f56f2b99df42db935049ae5e72c4519a920e263b40af1a6a40d9942e66608145b3131a71a2
PATCHES
fix-tiff-linkage.patch
fix-timeval.patch # Remove this patch in the next update
REF 5ad5325a0aa8effc47ca033625b6a51682f82767 #v5.2.0
SHA512 c6ed442c9deb28772aeb918142dab08d5b55eeeeccb0c1d3f13cf51bb72af227afb7f14c19a5c8db40d6a7b8cfeccb3af08a78adfcd7431e4a06f65372709ceb
PATCHES ${tesseract_patch}
)

# The built-in cmake FindICU is better
Expand All @@ -30,29 +32,34 @@ vcpkg_cmake_configure(
${FEATURE_OPTIONS}
-DSTATIC=${BUILD_STATIC}
-DUSE_SYSTEM_ICU=True
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=ON
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=ON
-DLeptonica_DIR=YES
-DTARGET_ARCHITECTURE=${TARGET_ARCHITECTURE}
-DSW_BUILD=OFF
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_OpenCL
STATIC
TARGET_ARCHITECTURE
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()

vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/tesseract)

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/tesseract/TesseractConfig.cmake"
"find_package(Leptonica REQUIRED)"
"find_dependency(Leptonica)"
[[
find_package(Leptonica REQUIRED)
find_package(LibArchive REQUIRED)
find_dependency(Leptonica)
find_dependency(LibArchive)
]]
)

vcpkg_copy_tools(TOOL_NAMES tesseract AUTO_CLEAN)

if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/tesseract.pc" "-ltesseract41" "-ltesseract41d")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/tesseract.pc" "-ltesseract52" "-ltesseract52d")
endif()
vcpkg_fixup_pkgconfig()

Expand All @@ -68,6 +75,7 @@ endif()


file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
4 changes: 2 additions & 2 deletions ports/tesseract/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "tesseract",
"version": "4.1.1",
"port-version": 10,
"version": "5.2.0",
"description": "An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.",
"homepage": "https://github.com/tesseract-ocr/tesseract",
"license": "Apache-2.0",
"supports": "!arm",
"dependencies": [
"leptonica",
Expand Down
6 changes: 3 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5202,7 +5202,7 @@
},
"opencv4": {
"baseline": "4.6.0",
"port-version": 0
"port-version": 1
},
"opendnp3": {
"baseline": "3.1.1",
Expand Down Expand Up @@ -7033,8 +7033,8 @@
"port-version": 0
},
"tesseract": {
"baseline": "4.1.1",
"port-version": 10
"baseline": "5.2.0",
"port-version": 0
},
"tfhe": {
"baseline": "1.0.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/opencv4.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a6c9bded8fc4ad22bea6869caecf2881c8da2d41",
"version": "4.6.0",
"port-version": 1
},
{
"git-tree": "1ff543272c91a32d242ad5320e9ca63b29b34ed2",
"version": "4.6.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/t-/tesseract.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4295c14c2cba326f07271c7fdf12c326fecbcd38",
"version": "5.2.0",
"port-version": 0
},
{
"git-tree": "ac84bef93d2709f28bf4ab8341a80dab949a8cf1",
"version": "4.1.1",
Expand Down