Closed VVD closed 2 years ago
Build fine for me on FreeBSD 12.3 amd64 with patches below.
CMakeLists.txt:
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -141,6 +141,17 @@
set(HAVE_LIBJP2K 1)
endif()
endif()
+ if(NOT JP2K)
+ find_path(JP2K_INCLUDE_DIR /openjpeg-2.5/openjpeg.h)
+ find_library(JP2K_LIBRARY NAMES openjp2)
+ if (JP2K_INCLUDE_DIR AND JP2K_LIBRARY)
+ set(JP2K 1)
+ set(JP2K_FOUND TRUE)
+ set(JP2K_LIBRARIES ${JP2K_LIBRARY})
+ set(JP2K_INCLUDE_DIRS ${JP2K_INCLUDE_DIR})
+ set(HAVE_LIBJP2K 1)
+ endif()
+ endif()
set(libs_private "${libs_private} -lopenjp2")
endif()
endif()
cmake/Configure.cmake:
--- cmake/Configure.cmake.orig
+++ cmake/Configure.cmake
@@ -69,6 +69,7 @@
openjpeg-2.2/openjpeg.h
openjpeg-2.3/openjpeg.h
openjpeg-2.4/openjpeg.h
+ openjpeg-2.5/openjpeg.h
)
check_includes(include_files_list)
@@ -146,7 +147,9 @@
/* Define to 1 if you have zlib. */
#cmakedefine HAVE_LIBZ 1
-#if defined(HAVE_OPENJPEG_2_4_OPENJPEG_H)
+#if defined(HAVE_OPENJPEG_2_5_OPENJPEG_H)
+#define LIBJP2K_HEADER <openjpeg-2.5/openjpeg.h>
+#elif defined(HAVE_OPENJPEG_2_4_OPENJPEG_H)
#define LIBJP2K_HEADER <openjpeg-2.4/openjpeg.h>
#elif defined(HAVE_OPENJPEG_2_3_OPENJPEG_H)
#define LIBJP2K_HEADER <openjpeg-2.3/openjpeg.h>
config/config.h.in:
--- config/config.h.in.orig
+++ config/config.h.in
@@ -51,6 +51,12 @@
/* Define to 1 if you have the <openjpeg-2.3/openjpeg.h> header file. */
#undef HAVE_OPENJPEG_2_3_OPENJPEG_H
+/* Define to 1 if you have the <openjpeg-2.4/openjpeg.h> header file. */
+#undef HAVE_OPENJPEG_2_4_OPENJPEG_H
+
+/* Define to 1 if you have the <openjpeg-2.5/openjpeg.h> header file. */
+#undef HAVE_OPENJPEG_2_5_OPENJPEG_H
+
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
Maybe a better solution is using pkg-config to check whether OpenJPEG is available and to get the necessary compiler and linker flags. That would also work for a future OpenJPEG 2.6.
pkg-config
is not standard on all platform (e.g. Windows) ;-)
using find_package(OpenJPEG)
should be better solution for cmake...
Builds with autoconf already use pkg-config
and should work with OpenJPEG 2.5. And yes, for cmake builds find_package
would be the best solution.
Don't think I can implement this in near future. If you can please do it. And maybe next release just after this. :-] Thanks!
624 should solve it. Please test it.
Thanks. But I can't apply patch to last release version without errors. What list of commits it require? I explore a bit and it's look like hard work to separate required commits.
The easiest option for me is to release a new version and I can test it.
There is no need to patch anything - just download the recent code:
I know this possibility, but I build via FreeBSD ports. To do this I must modify this port. It use releases and change it to use last version from git is not so fast and trivial work.
I "made release" 1.82.1 from git master:
cd /usr/ports/distfiles
wget https://github.com/DanBloomberg/leptonica/archive/refs/heads/master.zip
unzip master.zip
mv leptonica-master leptonica-1.82.1
tar -zcf leptonica-1.82.1.tar.gz leptonica-1.82.1
cd /usr/ports/graphics/leptonica
# fix version from 1.82.0 to 1.82.1 and remove extra patches from commits
vi Makefile
make makesum
make
Build without errors.
In 3 words: work for me. :-]
Waiting release.
Build failed with OpenJPEG 2.5.0 - there are no check for includes openjpeg-2.5/openjpeg.h. Found list of files with check for OpenJPEG: CMakeLists.txt cmake/Configure.cmake config/config.h.in
Will try to fix this and show patches in comments.