#6 Correctly set the soversion based on SemVer properties and split shared libraries into -libs
Merged 9 months ago by smani. Opened 9 months ago by salimma.
rpms/ salimma/tesseract rawhide-fix-soversion  into  rawhide

file modified
+33 -8
@@ -8,18 +8,21 @@ 

  

  Name:          tesseract

  Version:       5.4.1

- Release:       2%{?dist}

+ Release:       3%{?dist}

  Summary:       Raw OCR Engine

  

  License:       Apache-2.0

  URL:           https://github.com/tesseract-ocr/%{name}

  Source0:       https://github.com/tesseract-ocr/tesseract/archive/%{version}%{?pre:-%pre}/%{name}-%{version}%{?pre:-%pre}.tar.gz

  

+ # Correctly set the soversion based on SemVer properties

+ # backported from https://github.com/tesseract-ocr/tesseract/pull/4319.patch

+ Patch0:        tesseract_fix_soversion.patch

  # Fix library name case

  # Build training libs statically

- Patch0:        tesseract_cmake.patch

+ Patch1:        tesseract_cmake.patch

  # Don't assume neon available on arm64/aarch64

- Patch1:        tesseract_neon.patch

+ Patch2:        tesseract_neon.patch

  

  

  BuildRequires: cmake
@@ -64,29 +67,43 @@ 

  BuildRequires: mingw64-pango

  %endif

  

+ Requires:      %{name}-libs%{?_isa} = %{version}-%{release}

  Requires:      tesseract-langpack-eng

  

  

- %description

+ %global _description %{expand:

  A commercial quality OCR engine originally developed at HP between 1985 and

  1995. In 1995, this engine was among the top 3 evaluated by UNLV. It was

- open-sourced by HP and UNLV in 2005.

+ open-sourced by HP and UNLV in 2005.}

+ 

+ %description %_description

  

  

  %package devel

  Summary:       Development files for %{name}

  Requires:      %{name}%{?_isa} = %{version}-%{release}

  

- %description devel

+ %description devel %_description

+ 

  The %{name}-devel package contains header file for

  developing applications that use %{name}.

  

  

+ %package libs

+ Summary:       Shared libraries for %{name}

+ 

+ %description libs %_description

+ 

+ The %{name}-libs package contains shared libraries

+ for %{name}.

+ 

+ 

  %package tools

  Summary:       Training tools for %{name}

  Requires:      %{name}%{?_isa} = %{version}-%{release}

  

- %description tools

+ %description tools %_description

+ 

  The %{name}-tools package contains tools for training %{name}.

  

  
@@ -167,7 +184,6 @@ 

  %license LICENSE

  %doc AUTHORS ChangeLog README.md

  %{_bindir}/%{name}

- %{_libdir}/lib%{name}.so.5.4.1

  %{_datadir}/%{name}/

  %{_mandir}/man1/tesseract.1*

  
@@ -179,6 +195,10 @@ 

  %{_libdir}/cmake/%{name}/

  %{_libdir}/pkgconfig/%{name}.pc

  

+ %files libs

+ %{_libdir}/lib%{name}.so.5.4

+ %{_libdir}/lib%{name}.so.%{version}

+ 

  %files tools

  %{_bindir}/ambiguous_words

  %{_bindir}/classifier_tester
@@ -245,6 +265,11 @@ 

  

  

  %changelog

+ * Mon Sep 23 2024 Michel Lind <salimma@fedoraproject.org> - 5.4.1-3

+ - Correctly set the soversion based on SemVer properties

+   Backport of upstream PR#4319 from Neal Gompa (ngompa)

+ - Split shared libraries into their own -libs subpackage

+ 

  * Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.1-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

  

file modified
+5 -7
@@ -1,6 +1,5 @@ 

- diff -rupN --no-dereference tesseract-5.4.1/CMakeLists.txt tesseract-5.4.1-new/CMakeLists.txt

- --- tesseract-5.4.1/CMakeLists.txt	2024-06-11 20:18:21.000000000 +0200

- +++ tesseract-5.4.1-new/CMakeLists.txt	2024-06-13 18:47:53.277068523 +0200

+ --- a/CMakeLists.txt

+ +++ b/CMakeLists.txt

  @@ -364,7 +364,7 @@ elseif(UNIX)

       set(LIB_pthread pthread)

     endif()
@@ -12,7 +11,7 @@ 

   add_definitions("-DCMAKE_BUILD")

  @@ -831,12 +831,17 @@ set_target_properties(

     libtesseract PROPERTIES SOVERSION

-                            ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

+                            ${VERSION_MAJOR}.${VERSION_MINOR})

   

  -set_target_properties(

  -  libtesseract
@@ -46,9 +45,8 @@ 

   endif()

   

   # ##############################################################################

- diff -rupN --no-dereference tesseract-5.4.1/src/training/CMakeLists.txt tesseract-5.4.1-new/src/training/CMakeLists.txt

- --- tesseract-5.4.1/src/training/CMakeLists.txt	2024-06-11 20:18:21.000000000 +0200

- +++ tesseract-5.4.1-new/src/training/CMakeLists.txt	2024-06-13 18:47:53.277068523 +0200

+ --- a/src/training/CMakeLists.txt

+ +++ b/src/training/CMakeLists.txt

  @@ -115,7 +115,7 @@ if(NOT DISABLED_LEGACY_ENGINE)

       common/trainingsampleset.h)

   endif()

@@ -0,0 +1,34 @@ 

+ From 280779c615402e335e40d96b9cf71ee8758fd63f Mon Sep 17 00:00:00 2001

+ From: Neal Gompa <neal@gompa.dev>

+ Date: Wed, 18 Sep 2024 07:44:29 -0400

+ Subject: [PATCH] cmake: Correctly set the soversion based on SemVer properties

+ 

+ As this project follows Semantic Versioning, the shared object

+ version should match these semantics.

+ 

+ The two options that make sense here are to have the soversion

+ set to the version major (so only breaking changes are tracked)

+ or to set to version major and minor (so breaking and API additions

+ are tracked).

+ 

+ Since the Windows version of the library already uses version major

+ and version minor, let's just do this universally.

+ 

+ Fixes: 832926f5afebd9a5a81343425e733708332f730f ("Update library version handling for cmake")

+ 

+ Signed-off-by: Neal Gompa <neal@gompa.dev>

+ ---

+  CMakeLists.txt | 2 +-

+  1 file changed, 1 insertion(+), 1 deletion(-)

+ 

+ --- a/CMakeLists.txt

+ +++ b/CMakeLists.txt

+ @@ -829,7 +829,7 @@ set_target_properties(

+                            ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

+  set_target_properties(

+    libtesseract PROPERTIES SOVERSION

+ -                          ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

+ +                          ${VERSION_MAJOR}.${VERSION_MINOR})

+  

+  set_target_properties(

+    libtesseract

I'm looking into making Tesseract packaging more modular so it's easier to backport newer Tesseracts in EPEL without affecting packages that depend on the version shipped by EL/CentOS Stream; in doing so @ngompa and I noticed that the soversion of Tesseract is overly strict (including the patch version, which it should not, and does not do on Windows)

This was fixed in https://github.com/tesseract-ocr/tesseract/pull/4319; this PR backports it and also splits off -libs.

Let me know if changes are needed, i.e. if tesseract dependents also need data files and therefore splitting libs no longer make sense (or they can be moved to a -data subpackage).

Pull-Request has been merged by smani

9 months ago

per https://bodhi.fedoraproject.org/updates/FEDORA-2024-41b92bf172#comment-3740912 - I forgot to mention in the PR - since now the soversion is just maj.min we do need to rebuild the dependents.

Rebuilding it in the ffmpeg sidetag

michel in tesseract on  rawhide [?] 
⬢ [f40-packaging] ❯ fedrq-whatrequires-verbose.sh 'libtesseract.so.5.4.1()(64bit)' -b f41
+ fedrq whatrequires 'libtesseract.so.5.4.1()(64bit)' -F multiline:source,requires -b f41
+ grep 'libtesseract.so.5.4.1()(64bit)'
R-tesseract : libtesseract.so.5.4.1()(64bit)
crow-translate : libtesseract.so.5.4.1()(64bit)
gimagereader : libtesseract.so.5.4.1()(64bit)
gimagereader : libtesseract.so.5.4.1()(64bit)
ffmpeg : libtesseract.so.5.4.1()(64bit)
mupdf : libtesseract.so.5.4.1()(64bit)
opencv : libtesseract.so.5.4.1()(64bit)
skanpage : libtesseract.so.5.4.1()(64bit)
tesseract : libtesseract.so.5.4.1()(64bit)
tesseract : libtesseract.so.5.4.1()(64bit)

michel in tesseract on  rawhide [?] 
⬢ [f40-packaging] ❯ fedrq-whatrequires-verbose.sh 'libtesseract.so.5.4.1()(64bit)' -b f42
+ fedrq whatrequires 'libtesseract.so.5.4.1()(64bit)' -F multiline:source,requires -b f42
+ grep 'libtesseract.so.5.4.1()(64bit)'
R-tesseract : libtesseract.so.5.4.1()(64bit)
R-tesseract : libtesseract.so.5.4.1()(64bit)
crow-translate : libtesseract.so.5.4.1()(64bit)
crow-translate : libtesseract.so.5.4.1()(64bit)
gimagereader : libtesseract.so.5.4.1()(64bit)
gimagereader : libtesseract.so.5.4.1()(64bit)
gimagereader : libtesseract.so.5.4.1()(64bit)
gimagereader : libtesseract.so.5.4.1()(64bit)
ffmpeg : libtesseract.so.5.4.1()(64bit)
ffmpeg : libtesseract.so.5.4.1()(64bit)
maui-mauikit-imagetools : libtesseract.so.5.4.1()(64bit)
maui-mauikit-imagetools : libtesseract.so.5.4.1()(64bit)
mupdf : libtesseract.so.5.4.1()(64bit)
mupdf : libtesseract.so.5.4.1()(64bit)
opencv : libtesseract.so.5.4.1()(64bit)
opencv : libtesseract.so.5.4.1()(64bit)
skanpage : libtesseract.so.5.4.1()(64bit)
skanpage : libtesseract.so.5.4.1()(64bit)
tesseract : libtesseract.so.5.4.1()(64bit)
tesseract : libtesseract.so.5.4.1()(64bit)
tesseract : libtesseract.so.5.4.1()(64bit)
tesseract : libtesseract.so.5.4.1()(64bit)