From cc010cab233fe1da5f614d7dc0afde3a5e2e8d2d Mon Sep 17 00:00:00 2001 From: Sandro Mani Date: Mon, 3 Apr 2023 12:10:58 +0200 Subject: [PATCH] Update to 5.3.1 --- .gitignore | 1 + sources | 2 +- tesseract.spec | 24 +++++++--------- tesseract_cmake.patch | 64 ++++++++++++++++++++++++------------------ tesseract_gcc13.patch | 28 ------------------ tesseract_libdir.patch | 29 ------------------- tesseract_neon.patch | 33 ++++++++++++++++++++++ 7 files changed, 81 insertions(+), 100 deletions(-) delete mode 100644 tesseract_gcc13.patch delete mode 100644 tesseract_libdir.patch create mode 100644 tesseract_neon.patch diff --git a/.gitignore b/.gitignore index bedaeb4..540eaec 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ tesseract-2.00.eng.tar.gz /tesseract-5.1.0.tar.gz /tesseract-5.2.0.tar.gz /tesseract-5.3.0.tar.gz +/tesseract-5.3.1.tar.gz diff --git a/sources b/sources index e379d06..8e07b22 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (tesseract-5.3.0.tar.gz) = fc0cfda980059390b7d6d3d8e475b4ecc9dcfee1abc3b16fc9ffc8904db0a0847a5f6f1b32bd2e1f6f5a714a8c4df0fb3dc7c6aa25ece6162bf52fe86b4d0f34 +SHA512 (tesseract-5.3.1.tar.gz) = 1744106d76eafd0786b99b517707afdd22b7b5cb3dfd7f0af02954539715c981ff0f12d142ee103113ba38dac8476052d6880b81d4c8050de650bf1cee6ba06c diff --git a/tesseract.spec b/tesseract.spec index 98b6154..e16b18d 100644 --- a/tesseract.spec +++ b/tesseract.spec @@ -7,8 +7,8 @@ %endif Name: tesseract -Version: 5.3.0 -Release: 6%{?dist} +Version: 5.3.1 +Release: 1%{?dist} Summary: Raw OCR Engine License: Apache-2.0 @@ -16,17 +16,10 @@ URL: https://github.com/tesseract-ocr/%{name} Source0: https://github.com/tesseract-ocr/tesseract/archive/%{version}%{?pre:-%pre}/%{name}-%{version}%{?pre:-%pre}.tar.gz # Fix library name case -# Fix shared library version suffix -# Honour TESSDATA_PREFIX # Build training libs statically Patch0: tesseract_cmake.patch -# Generate correct libdir path in /usr/lib64/pkgconfig/tesseract.pc -# Already merged upstream, can be dropped at next release -# https://github.com/tesseract-ocr/tesseract/commit/5e116fa5cad249b8a08d22af652cf52f44fbb8cd -Patch1: tesseract_libdir.patch -# Fixed FTBFS under GCC 13: -# https://github.com/tesseract-ocr/tesseract/commit/2025b53de6b3d97285d7c5f80497493007c586c3 -Patch2: tesseract_gcc13.patch +# Don't assume neon available on arm64/aarch64 +Patch1: tesseract_neon.patch BuildRequires: cmake @@ -44,7 +37,7 @@ BuildRequires: /usr/bin/xsltproc %if %{with mingw} BuildRequires: mingw32-filesystem >= 95 -BuildRequires: mingw32-gcc +BuildRequires: mingw32-gcc-c++ BuildRequires: mingw32-giflib BuildRequires: mingw32-binutils BuildRequires: mingw32-icu @@ -56,7 +49,7 @@ BuildRequires: mingw32-libwebp BuildRequires: mingw32-pango BuildRequires: mingw64-filesystem >= 95 -BuildRequires: mingw64-gcc +BuildRequires: mingw64-gcc-c++ BuildRequires: mingw64-giflib BuildRequires: mingw64-binutils BuildRequires: mingw64-icu @@ -171,7 +164,7 @@ cp -a doc/*.5 %{buildroot}%{_mandir}/man5/ %license LICENSE %doc AUTHORS ChangeLog README.md %{_bindir}/%{name} -%{_libdir}/lib%{name}.so.5.3.0 +%{_libdir}/lib%{name}.so.5.3.1 %{_datadir}/%{name}/ %{_mandir}/man1/tesseract.1* @@ -249,6 +242,9 @@ cp -a doc/*.5 %{buildroot}%{_mandir}/man5/ %changelog +* Mon Apr 03 2023 Sandro Mani - 5.3.1-1 +- Update to 5.3.1 + * Mon Mar 20 2023 Vitaly Zaitsev - 5.3.0-6 - Backported GCC 13 build fix. Fixed FTBFS on Fedora 38+. diff --git a/tesseract_cmake.patch b/tesseract_cmake.patch index 8cacfd6..18c7d59 100644 --- a/tesseract_cmake.patch +++ b/tesseract_cmake.patch @@ -1,7 +1,7 @@ -diff -rupN --no-dereference tesseract-5.3.0/CMakeLists.txt tesseract-5.3.0-new/CMakeLists.txt ---- tesseract-5.3.0/CMakeLists.txt 2022-12-22 14:57:57.000000000 +0100 -+++ tesseract-5.3.0-new/CMakeLists.txt 2022-12-23 10:33:09.303707322 +0100 -@@ -345,7 +345,7 @@ elseif(UNIX) +diff -rupN --no-dereference tesseract-5.3.1/CMakeLists.txt tesseract-5.3.1-new/CMakeLists.txt +--- tesseract-5.3.1/CMakeLists.txt 2023-04-01 21:50:30.000000000 +0200 ++++ tesseract-5.3.1-new/CMakeLists.txt 2023-04-03 12:08:00.033581846 +0200 +@@ -361,7 +361,7 @@ elseif(UNIX) set(LIB_pthread pthread) endif() elseif(WIN32) @@ -10,37 +10,45 @@ diff -rupN --no-dereference tesseract-5.3.0/CMakeLists.txt tesseract-5.3.0-new/C endif() add_definitions("-DCMAKE_BUILD") -@@ -812,11 +812,14 @@ set_target_properties(libtesseract - set_target_properties(libtesseract - PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) +@@ -831,12 +831,17 @@ set_target_properties( + libtesseract PROPERTIES SOVERSION + ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) --if(WIN32) -+if(MSVC) - set_target_properties(libtesseract - PROPERTIES OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR}) - set_target_properties(libtesseract - PROPERTIES DEBUG_OUTPUT_NAME tesseract${VERSION_MAJOR}${VERSION_MINOR}d) -+elseif(MINGW) +-set_target_properties( +- libtesseract +- PROPERTIES +- OUTPUT_NAME +- tesseract$<$:${VERSION_MAJOR}${VERSION_MINOR}$<$:d>> +-) ++if(MINGW) + set_target_properties(libtesseract PROPERTIES SUFFIX "-${VERSION_MAJOR}${VERSION_MINOR}${CMAKE_SHARED_LIBRARY_SUFFIX}") + set_target_properties(libtesseract PROPERTIES OUTPUT_NAME tesseract) - else() - set_target_properties(libtesseract PROPERTIES OUTPUT_NAME tesseract) - endif() -@@ -931,9 +934,9 @@ install( ++else() ++ set_target_properties( ++ libtesseract ++ PROPERTIES ++ OUTPUT_NAME ++ tesseract$<$:${VERSION_MAJOR}${VERSION_MINOR}$<$:d>> ++ ) ++endif() + + if(SW_BUILD) + target_link_libraries(libtesseract PUBLIC org.sw.demo.danbloomberg.leptonica +@@ -958,9 +963,9 @@ install( if(INSTALL_CONFIGS) - install(FILES ${TESSERACT_CONFIGS} -- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/tessdata/configs) -+ DESTINATION ${TESSDATA_PREFIX}/tessdata/configs) - install(FILES ${TESSERACT_TESSCONFIGS} -- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/tessdata/tessconfigs) -+ DESTINATION ${TESSDATA_PREFIX}/tessdata/tessconfigs) + install(FILES ${TESSERACT_CONFIGS} +- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/tessdata/configs) ++ DESTINATION ${TESSDATA_PREFIX}/tessdata/configs) + install(FILES ${TESSERACT_TESSCONFIGS} +- DESTINATION ${CMAKE_INSTALL_PREFIX}/share/tessdata/tessconfigs) ++ DESTINATION ${TESSDATA_PREFIX}/tessdata/tessconfigs) endif() # ############################################################################## -diff -rupN --no-dereference tesseract-5.3.0/src/training/CMakeLists.txt tesseract-5.3.0-new/src/training/CMakeLists.txt ---- tesseract-5.3.0/src/training/CMakeLists.txt 2022-12-22 14:57:57.000000000 +0100 -+++ tesseract-5.3.0-new/src/training/CMakeLists.txt 2022-12-23 10:33:09.303707322 +0100 +diff -rupN --no-dereference tesseract-5.3.1/src/training/CMakeLists.txt tesseract-5.3.1-new/src/training/CMakeLists.txt +--- tesseract-5.3.1/src/training/CMakeLists.txt 2023-04-01 21:50:30.000000000 +0200 ++++ tesseract-5.3.1-new/src/training/CMakeLists.txt 2023-04-03 12:08:00.034581845 +0200 @@ -115,7 +115,7 @@ if(NOT DISABLED_LEGACY_ENGINE) common/trainingsampleset.h) endif() @@ -59,7 +67,7 @@ diff -rupN --no-dereference tesseract-5.3.0/src/training/CMakeLists.txt tesserac if(SW_BUILD) target_link_libraries(unicharset_training PUBLIC common_training org.sw.demo.unicode.icu.i18n) -@@ -378,7 +378,7 @@ if(ICU_FOUND) +@@ -377,7 +377,7 @@ if(ICU_FOUND) file(GLOB pango_training_src pango/*) diff --git a/tesseract_gcc13.patch b/tesseract_gcc13.patch deleted file mode 100644 index f630727..0000000 --- a/tesseract_gcc13.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2025b53de6b3d97285d7c5f80497493007c586c3 Mon Sep 17 00:00:00 2001 -From: Khem Raj -Date: Mon, 30 Jan 2023 11:27:07 -0800 -Subject: [PATCH] Fix build with gcc 13 by including - -gcc 13 moved some includes around and as a result is -no longer transitively included [1]. Explicitly include it for -int32_t. - -[1] https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes - -Signed-off-by: Khem Raj ---- - src/ccutil/params.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/ccutil/params.h b/src/ccutil/params.h -index f514d8709c..0f3f874357 100644 ---- a/src/ccutil/params.h -+++ b/src/ccutil/params.h -@@ -21,6 +21,7 @@ - - #include // for TESS_API - -+#include - #include - #include - #include diff --git a/tesseract_libdir.patch b/tesseract_libdir.patch deleted file mode 100644 index b3565d4..0000000 --- a/tesseract_libdir.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 5e116fa5cad249b8a08d22af652cf52f44fbb8cd Mon Sep 17 00:00:00 2001 -From: Frank Dana -Date: Thu, 2 Feb 2023 19:57:59 -0500 -Subject: [PATCH] Fix libdir in tesseract.pc from CMake - -tesseract.pc.cmake was hardcoding libdir to -`{prefix}/lib`, which is wrong for systems that use -`/usr/lib64/` on 64-bit. `CMAKE_INSTALL_LIBDIR` -is already expected to contain the libdir path -relative to the install prefix. ---- - tesseract.pc.cmake | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tesseract.pc.cmake b/tesseract.pc.cmake -index 7f36ce19..5469a398 100644 ---- a/tesseract.pc.cmake -+++ b/tesseract.pc.cmake -@@ -1,6 +1,6 @@ - prefix=@CMAKE_INSTALL_PREFIX@ - exec_prefix=${prefix}/bin --libdir=${prefix}/lib -+libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ - includedir=${prefix}/include - - Name: @tesseract_NAME@ --- -2.39.1 - diff --git a/tesseract_neon.patch b/tesseract_neon.patch new file mode 100644 index 0000000..a295782 --- /dev/null +++ b/tesseract_neon.patch @@ -0,0 +1,33 @@ +diff -rupN --no-dereference tesseract-5.3.1/CMakeLists.txt tesseract-5.3.1-new/CMakeLists.txt +--- tesseract-5.3.1/CMakeLists.txt 2023-04-03 12:08:00.080581809 +0200 ++++ tesseract-5.3.1-new/CMakeLists.txt 2023-04-03 12:08:00.084581806 +0200 +@@ -248,7 +248,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "a + set(HAVE_AVX512F FALSE) + set(HAVE_FMA FALSE) + set(HAVE_SSE4_1 FALSE) +- set(HAVE_NEON TRUE) ++ check_cxx_compiler_flag("-mfpu=neon" HAVE_NEON) + + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*") + +diff -rupN --no-dereference tesseract-5.3.1/src/arch/simddetect.cpp tesseract-5.3.1-new/src/arch/simddetect.cpp +--- tesseract-5.3.1/src/arch/simddetect.cpp 2023-04-01 21:50:30.000000000 +0200 ++++ tesseract-5.3.1-new/src/arch/simddetect.cpp 2023-04-03 12:08:00.084581806 +0200 +@@ -254,7 +254,7 @@ SIMDDetect::SIMDDetect() { + // SSE detected. + SetDotProduct(DotProductSSE, &IntSimdMatrix::intSimdMatrixSSE); + #endif +-#if defined(HAVE_NEON) || defined(__aarch64__) ++#if defined(HAVE_NEON) + } else if (neon_available_) { + // NEON detected. + SetDotProduct(DotProductNEON, &IntSimdMatrix::intSimdMatrixNEON); +@@ -311,7 +311,7 @@ void SIMDDetect::Update() { + } else if (dotproduct == "accelerate") { + SetDotProduct(DotProductAccelerate, IntSimdMatrix::intSimdMatrix); + #endif +-#if defined(HAVE_NEON) || defined(__aarch64__) ++#if defined(HAVE_NEON) + } else if (dotproduct == "neon" && neon_available_) { + // NEON selected by config variable. + SetDotProduct(DotProductNEON, &IntSimdMatrix::intSimdMatrixNEON);