Skip to content

Commit 69e4d02

Browse files
authored
[tesseract] update to 5.2.0 (#26114)
* [tesseract] update to 5.2.0 * x-add-version * fix windows build error * version * fix opencv4 build error * version * conflict * version * fix opencv build error on uwp * version * fix linux build error * version * fix * version * version
1 parent 69296c1 commit 69e4d02

11 files changed

+69
-43
lines changed

Diff for: ports/opencv4/0018-fix-depend-tesseract.patch

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/modules/text/cmake/init.cmake b/modules/text/cmake/init.cmake
2+
index 254757e..73194ec 100644
3+
--- a/modules/text/cmake/init.cmake
4+
+++ b/modules/text/cmake/init.cmake
5+
@@ -4,6 +4,8 @@ OCV_OPTION(WITH_TESSERACT "Include Tesseract OCR library support" (NOT CMAKE_CRO
6+
if(NOT HAVE_TESSERACT
7+
AND (WITH_TESSERACT OR OPENCV_FIND_TESSERACT)
8+
)
9+
+ find_package(Tesseract CONFIG REQUIRED)
10+
+ set(Tesseract_LIBRARIES Tesseract::libtesseract)
11+
if(NOT Tesseract_FOUND)
12+
find_package(Tesseract QUIET) # Prefer CMake's standard locations (including Tesseract_DIR)
13+
endif()

Diff for: ports/opencv4/portfile.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ if("contrib" IN_LIST FEATURES)
177177
0013-fix-ceres.patch
178178
0014-fix-ogre.patch
179179
0016-fix-freetype-contrib.patch
180+
0018-fix-depend-tesseract.patch
180181
)
181182
set(BUILD_WITH_CONTRIB_FLAG "-DOPENCV_EXTRA_MODULES_PATH=${CONTRIB_SOURCE_PATH}/modules")
182183

@@ -352,6 +353,12 @@ if("qt" IN_LIST FEATURES)
352353
list(APPEND ADDITIONAL_BUILD_FLAGS "-DCMAKE_AUTOMOC=ON")
353354
endif()
354355

356+
if("contrib" IN_LIST FEATURES)
357+
if(VCPKG_TARGET_IS_UWP)
358+
list(APPEND ADDITIONAL_BUILD_FLAGS "-DWITH_TESSERACT=OFF")
359+
endif()
360+
endif()
361+
355362
vcpkg_cmake_configure(
356363
SOURCE_PATH "${SOURCE_PATH}"
357364
OPTIONS

Diff for: ports/opencv4/vcpkg.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "opencv4",
33
"version": "4.6.0",
4+
"port-version": 1,
45
"description": "computer vision library",
56
"homepage": "https://github.com/opencv/opencv",
67
"license": "Apache-2.0",

Diff for: ports/tesseract/fix-depend-libarchive.patch

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index bd2649d..f932913 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -792,7 +792,8 @@ if(OpenCL_FOUND)
6+
target_link_libraries(libtesseract PUBLIC OpenCL::OpenCL)
7+
endif()
8+
if(LibArchive_FOUND)
9+
- target_link_libraries(libtesseract PUBLIC ${LibArchive_LIBRARIES})
10+
+ find_package(LibArchive REQUIRED)
11+
+ target_link_libraries(libtesseract PRIVATE LibArchive::LibArchive)
12+
endif(LibArchive_FOUND)
13+
if(CURL_FOUND)
14+
if(NOT CURL_LIBRARIES)

Diff for: ports/tesseract/fix-tiff-linkage.patch

-13
This file was deleted.

Diff for: ports/tesseract/fix-timeval.patch

-14
This file was deleted.

Diff for: ports/tesseract/portfile.cmake

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
if(NOT VCPKG_TARGET_IS_WINDOWS)
2+
set(tesseract_patch fix-depend-libarchive.patch)
3+
endif()
4+
15
vcpkg_from_github(
26
OUT_SOURCE_PATH SOURCE_PATH
37
REPO tesseract-ocr/tesseract
4-
REF 4.1.1
5-
SHA512 017723a2268be789fe98978eed02fd294968cc8050dde376dee026f56f2b99df42db935049ae5e72c4519a920e263b40af1a6a40d9942e66608145b3131a71a2
6-
PATCHES
7-
fix-tiff-linkage.patch
8-
fix-timeval.patch # Remove this patch in the next update
8+
REF 5ad5325a0aa8effc47ca033625b6a51682f82767 #v5.2.0
9+
SHA512 c6ed442c9deb28772aeb918142dab08d5b55eeeeccb0c1d3f13cf51bb72af227afb7f14c19a5c8db40d6a7b8cfeccb3af08a78adfcd7431e4a06f65372709ceb
10+
PATCHES ${tesseract_patch}
911
)
1012

1113
# The built-in cmake FindICU is better
@@ -30,29 +32,34 @@ vcpkg_cmake_configure(
3032
${FEATURE_OPTIONS}
3133
-DSTATIC=${BUILD_STATIC}
3234
-DUSE_SYSTEM_ICU=True
33-
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=ON
35+
-DCMAKE_DISABLE_FIND_PACKAGE_LibArchive=OFF
3436
-DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=ON
3537
-DLeptonica_DIR=YES
3638
-DTARGET_ARCHITECTURE=${TARGET_ARCHITECTURE}
39+
-DSW_BUILD=OFF
40+
MAYBE_UNUSED_VARIABLES
41+
CMAKE_DISABLE_FIND_PACKAGE_OpenCL
42+
STATIC
43+
TARGET_ARCHITECTURE
3744
)
3845

3946
vcpkg_cmake_install()
4047
vcpkg_copy_pdbs()
4148

42-
vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
49+
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/tesseract)
4350

4451
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/tesseract/TesseractConfig.cmake"
45-
"find_package(Leptonica REQUIRED)"
52+
"find_dependency(Leptonica)"
4653
[[
47-
find_package(Leptonica REQUIRED)
48-
find_package(LibArchive REQUIRED)
54+
find_dependency(Leptonica)
55+
find_dependency(LibArchive)
4956
]]
5057
)
5158

5259
vcpkg_copy_tools(TOOL_NAMES tesseract AUTO_CLEAN)
5360

5461
if(NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
55-
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/tesseract.pc" "-ltesseract41" "-ltesseract41d")
62+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/tesseract.pc" "-ltesseract52" "-ltesseract52d")
5663
endif()
5764
vcpkg_fixup_pkgconfig()
5865

@@ -68,6 +75,7 @@ endif()
6875

6976

7077
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
78+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
7179

7280
# Handle copyright
7381
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

Diff for: ports/tesseract/vcpkg.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "tesseract",
3-
"version": "4.1.1",
4-
"port-version": 11,
3+
"version": "5.2.0",
54
"description": "An OCR Engine that was developed at HP Labs between 1985 and 1995... and now at Google.",
65
"homepage": "https://github.com/tesseract-ocr/tesseract",
6+
"license": "Apache-2.0",
77
"supports": "!(arm & (osx | linux))",
88
"dependencies": [
99
"leptonica",

Diff for: versions/baseline.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -5206,7 +5206,7 @@
52065206
},
52075207
"opencv4": {
52085208
"baseline": "4.6.0",
5209-
"port-version": 0
5209+
"port-version": 1
52105210
},
52115211
"opendnp3": {
52125212
"baseline": "3.1.1",
@@ -7045,8 +7045,8 @@
70457045
"port-version": 0
70467046
},
70477047
"tesseract": {
7048-
"baseline": "4.1.1",
7049-
"port-version": 11
7048+
"baseline": "5.2.0",
7049+
"port-version": 0
70507050
},
70517051
"tfhe": {
70527052
"baseline": "1.0.1",

Diff for: versions/o-/opencv4.json

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "a6c9bded8fc4ad22bea6869caecf2881c8da2d41",
5+
"version": "4.6.0",
6+
"port-version": 1
7+
},
38
{
49
"git-tree": "1ff543272c91a32d242ad5320e9ca63b29b34ed2",
510
"version": "4.6.0",

Diff for: versions/t-/tesseract.json

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "5ea8fcd243e8aa38e1a83eaa1c745fc53a3464cc",
5+
"version": "5.2.0",
6+
"port-version": 0
7+
},
38
{
49
"git-tree": "24c99e73eaf335a9abedcfd42163c4968ca07ec3",
510
"version": "4.1.1",

0 commit comments

Comments
 (0)