Summary: | graphics/leptonica: update to 1.82.0 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | John Hein <jcfyecrayz> | ||||||||||||||
Component: | Individual Port(s) | Assignee: | Rainer Hurling <rhurlin> | ||||||||||||||
Status: | Closed FIXED | ||||||||||||||||
Severity: | Affects Some People | CC: | diizzy, hiroto.kagotani, rhurlin | ||||||||||||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(hiroto.kagotani) |
||||||||||||||
Version: | Latest | ||||||||||||||||
Hardware: | Any | ||||||||||||||||
OS: | Any | ||||||||||||||||
URL: | https://github.com/DanBloomberg/leptonica/compare/1.76.0...1.82.0 | ||||||||||||||||
Attachments: |
|
Description
John Hein
2021-11-27 17:53:17 UTC
(In reply to John Hein from comment #0) The maze_req test is failing for the 1.76.0 version of the port as well (at least 12/stable-amd64, probably others). So that failure is not a new regression with 1.82.0. Any reason why we're not using upstream release archive? http://www.leptonica.org/source/leptonica-1.82.0.tar.gz https://github.com/DanBloomberg/leptonica/releases/download/1.82.0/leptonica-1.82.0.tar.gz Switching to CMake would probably also improve builds times (In reply to Daniel Engberg from comment #2) Thank you, Daniel, for the tips. I would also appreciate it if this update would switch to cmake right away. Another concern on my part is that projects like graphics/opencv cannot use the graphics/tesseract and graphics/leptonica dependencies so far. If graphics/tesseract is already installed on a system and then graphics/opencv is to be installed, OpenCV uses the script /usr/local/cmake/TesseractConfig.cmake to check for the presence of Leptonica and would like to use the FindLeptonica.cmake file under /usr/local/share/cmake/Modules, which does not exist in the system, for this purpose. However, FindLeptonica.cmake is not yet included in the Leptonica sources. If my opinion is shared that the port graphics/leptonica should install this cmake file, there is a working example at https://github.com/yoisel/tesseract_winrt/blob/master/cmake/FindLeptonica.cmake. This file could be patched into the port and then installed from the Makefile under /usr/local/share/cmake/Modules. If this file would be present, ports like graphics/opencv could also find an installed Leptonica ;) Any opinions on this? What does the maintainer say ;) Hmm... I did a quick change to CMake and it looks like we need to do some patching or possibly some ${RLN} magic but it looks like nothing major. ====> Compressing man pages (compress-man) ====> Checking for pkg-plist issues (check-plist) ===> Parsing plist ===> Checking for items in STAGEDIR missing from pkg-plist Error: Orphaned: lib/cmake/leptonica/LeptonicaConfig-version.cmake Error: Orphaned: lib/cmake/leptonica/LeptonicaConfig.cmake Error: Orphaned: lib/cmake/leptonica/LeptonicaTargets-%%CMAKE_BUILD_TYPE%%.cmake Error: Orphaned: lib/cmake/leptonica/LeptonicaTargets.cmake Error: Orphaned: lib/libleptonica.so.1.82.0 Error: Orphaned: lib/libleptonica.so.5.4.0 ===> Checking for items in pkg-plist which are not in STAGEDIR Error: Missing: bin/imagetops Error: Missing: lib/cmake/LeptonicaConfig-version.cmake Error: Missing: lib/cmake/LeptonicaConfig.cmake Error: Missing: lib/liblept.a Error: Missing: lib/liblept.so Error: Missing: lib/liblept.so.5 Error: Missing: lib/liblept.so.5.0.4 Error: Missing: lib/libleptonica.a ===> Error: Plist issues found. *** Error code 1 I've uploaded a quick "WIP" patch, JPEG2000 and WEBP options needs to be sorted out correctly and plist needs to be updated accordingly. Looking at other ports the general naming convention seems to be lib/cmake/${PORTNAME}/ so that should be followed for consistency. As for the FindLeptonica.cmake I agree that it should be included and should also be submitted upstream. Created attachment 229788 [details]
CMake conversion (WIP)
Based on the patch by John Hein, always include zlib support as we always have zlib available via base.
Created attachment 229806 [details]
CMake conversion (WIP) v2
A few more quick fixes, some things could be more tidy but I'm not going to rewrite all CMake files.
Library options now works as expected
No weird library symlinks
.pc (pkgconfig) file now reports version correctly
Stuff that needs fixing
* libdata/pkgconfig/lept.pc and/or libdata/pkgconfig/leptonica.pc for consistency ?
* Import CMake helper to find library
* Libs.private in .pc file lists no libraries at all
Created attachment 229815 [details] patch to add FindLeptonica.cmake file Thanks Daniel, nice work :D In one of the next patch versions, there could be something like the following in the ports Makefile to add 'FindLeptonica.cmake', as mentioned in comment #3: # Workaround for a missing FindLeptonica.cmake # (from https://github.com/yoisel/tesseract_winrt/blob/master/cmake/) post-install: ${MKDIR} ${STAGEDIR}${PREFIX}/share/cmake/Modules ${INSTALL_DATA} ${WRKSRC}/cmake/FindLeptonica.cmake \ ${STAGEDIR}${PREFIX}/share/cmake/Modules/ Personally, I would prefer that we update to 1.82.0 first. Then later consider switching to cmake. If the maintainer and others agree on the switch to cmake, we could open a separate bug for the cmake switch. Also it would be good to get the proposed patch for CMakeLists.txt accepted (or at least submitted for consideration) upstream. A few observations on the cmake changes (v2) - why is imagetops not installed (maybe overlooked for cmake in upstream)? Also the .a libs (maybe no one cares, but it's a change). And there is a check-plist error. Why I think we should do it in one sweep otherwise is because it'll take good while before there's another attempt because "it works" and of course upstream the changes. Upstream PR: https://github.com/DanBloomberg/leptonica/pull/599 Created attachment 229910 [details]
CMake conversion (WIP) v3
CMake "helper" imported
Libs.private pc file should be fine now
imagetops is now installed
This should fix all known issues, please test :-)
(In reply to Daniel Engberg from comment #11) Your patch v3 builds and installs fine for me. But, there is a name change of the libraries (from liblept.so to libleptonica.so) which causes errors for the graphics/tesseract and textproc/py-ocrmypdf dependencies. These two ports need to be fixed. John had suggested in comment #8 to first make his changes (based on autoconf) and then switch to cmake. I can imagine to proceed like this. Of course, it also works if we commit all the changes, including the pending dependent changes, in one go. What do you both think? Thanks! Regarding the conflicting names it seems to go way back https://github.com/DanBloomberg/leptonica/issues/253 Personally I think it makes more sense to use the project name but either way we can just use RLN (symlinks) in post-install for compatibility reasons. As for how we want to handle the update I'll leave it up to you but I don't see the benefit of going autotools then cmake though however I think we should wait on upstream (~1-2 weeks) before going ahead just to avoid diverging from upstream. (In reply to Daniel Engberg from comment #13) Hi Daniel, Thanks for the link to the project's thoughts on how to handle the different naming of the libraries under autoconf and cmake. Since we have to wait at least for a reaction from the maintainer, I think it would be best to also wait for the Leptonica project's decisions on naming the libraries, as you suggested. PR finally merged (patch needs updating), upstream is still unsure about naming though... Created attachment 230746 [details]
CMake conversion (WIP) v4
This should be the final version
John and Rainer, can you give this a try?
(In reply to Daniel Engberg from comment #16) The newest patch (WIP4) applies, builds and installs fine for me. Dependents like textproc/py-ocrmypdf and graphics/opencv also install as usual. Thanks, Daniel :) A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=91c8d5f580a9954293ae3cea4420a96479fc80c0 commit 91c8d5f580a9954293ae3cea4420a96479fc80c0 Author: John Hein <jcfyecrayz@liamekaens.com> AuthorDate: 2022-02-13 14:04:54 +0000 Commit: Rainer Hurling <rhurlin@FreeBSD.org> CommitDate: 2022-02-13 14:25:06 +0000 graphics/leptonica: Update to 1.82.0 If graphics/tesseract is installed and then graphics/opencv is to be installed, OpenCV uses TesseractConfig.cmake to check for the presence of Leptonica and wants to use FindLeptonica.cmake for that. Therefore the new version adds a file cmake/FindLeptonica.cmake. After switching from autotools to cmake, the libraries are named as libleptonica.so instead of liblept.so. Upstream it is not yet decided which naming will be used in the future [1]. As a workaround, the port links the new naming to the previous one, since several dependent ports still use the old names of the libraries. [1] https://github.com/DanBloomberg/leptonica/issues/253 Changelog: https://github.com/DanBloomberg/leptonica/compare/1.76.0...1.82.0 PR: 260079 Co-authored-by: Daniel Engberg <diizzy@FreeBSD.org> graphics/leptonica/Makefile | 70 ++++++++++------------ graphics/leptonica/distinfo | 8 ++- graphics/leptonica/files/patch-cmake-findlib (new) | 55 +++++++++++++++++ .../leptonica/files/patch-src-Makefile.am (gone) | 9 --- graphics/leptonica/pkg-plist | 14 ++++- 5 files changed, 104 insertions(+), 52 deletions(-) Committed! I hope all is fine now, for the next steps ... Thanks. |