Skip to content

Commit

Permalink
graphics/leptonica: fix build with openjpeg 2.5.0
Browse files Browse the repository at this point in the history
ChangeLog: DanBloomberg/leptonica#623

Fix detection of openjpeg 2.5.0

PR:     264684
Reported by:    vvd@unislabs.com
Approved by:    hiroto.kagotani@gmail.com (maintainer, timeout > 1 month)
  • Loading branch information
VVD authored and fernape committed Jul 18, 2022
1 parent 5281a94 commit cd714f2
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions graphics/leptonica/files/patch-openjpeg-2.5
@@ -0,0 +1,59 @@
diff -u CMakeLists.txt.orig 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()
diff -u cmake/Configure.cmake.orig 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>
diff -u config/config.h.in.orig 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

0 comments on commit cd714f2

Please sign in to comment.