summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/libheif')
-rw-r--r--media-libs/libheif/files/libheif-1.3.2-openjpeg-2.patch93
-rw-r--r--media-libs/libheif/libheif-1.3.2-r1.ebuild (renamed from media-libs/libheif/libheif-1.3.2.ebuild)6
2 files changed, 96 insertions, 3 deletions
diff --git a/media-libs/libheif/files/libheif-1.3.2-openjpeg-2.patch b/media-libs/libheif/files/libheif-1.3.2-openjpeg-2.patch
new file mode 100644
index 000000000000..138295965b4c
--- /dev/null
+++ b/media-libs/libheif/files/libheif-1.3.2-openjpeg-2.patch
@@ -0,0 +1,93 @@
+Support building against libjpeg-turbo 2.0.
+
+Backport of https://github.com/strukturag/libheif/pull/85
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -95,6 +95,22 @@ AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], [
+ ], [have_libjpeg="no"])
+ fi
+ AM_CONDITIONAL([HAVE_LIBJPEG], [test "x$have_libjpeg" = "xyes"])
++if eval "test x$have_libjpeg = xyes"; then
++AC_MSG_CHECKING([for jpeg_write_icc_profile])
++AC_LANG_PUSH(C++)
++AC_TRY_COMPILE([
++ #include <stddef.h>
++ #include <stdio.h>
++ #include <jpeglib.h>
++],[
++ jpeg_write_icc_profile(NULL, NULL, 0);
++],[has_jpeg_write_icc_profile=yes],[has_jpeg_write_icc_profile=no]);
++AC_LANG_POP(C++)
++AC_MSG_RESULT([$has_jpeg_write_icc_profile])
++if eval "test x$has_jpeg_write_icc_profile = xyes"; then
++ AC_DEFINE(HAVE_JPEG_WRITE_ICC_PROFILE, 1, [Define to 1 if jpeg_write_icc_profile is available in libjpeg.])
++fi
++fi
+
+ PKG_CHECK_MODULES([libpng], [libpng], [
+ AC_DEFINE([HAVE_LIBPNG], [1], [Whether libpng was found.])
+--- a/examples/CMakeLists.txt
++++ b/examples/CMakeLists.txt
+@@ -8,6 +8,24 @@ include (${CMAKE_ROOT}/Modules/FindJPEG.cmake)
+
+ if(JPEG_FOUND)
+ add_definitions(-DHAVE_LIBJPEG=1)
++
++include (${CMAKE_ROOT}/Modules/CheckCXXSourceCompiles.cmake)
++
++set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES})
++check_cxx_source_compiles("
++#include <stddef.h>
++#include <stdio.h>
++#include <jpeglib.h>
++
++int main() {
++ jpeg_write_icc_profile(NULL, NULL, 0);
++ return 0;
++}
++" HAVE_JPEG_WRITE_ICC_PROFILE)
++if(HAVE_JPEG_WRITE_ICC_PROFILE)
++ add_definitions(-DHAVE_JPEG_WRITE_ICC_PROFILE=1)
++endif()
++
+ set (heif_convert_sources
+ ${heif_convert_sources}
+ encoder_jpeg.cc
+--- a/examples/encoder_jpeg.cc
++++ b/examples/encoder_jpeg.cc
+@@ -17,6 +17,10 @@
+ * You should have received a copy of the GNU General Public License
+ * along with convert. If not, see <http://www.gnu.org/licenses/>.
+ */
++#if defined(HAVE_CONFIG_H)
++#include "config.h"
++#endif
++
+ #include <assert.h>
+ #include <errno.h>
+ #include <string.h>
+--- a/examples/encoder_jpeg.h
++++ b/examples/encoder_jpeg.h
+@@ -24,6 +24,9 @@
+ #include <stddef.h>
+ #include <stdio.h>
+
++// Prevent duplicate definition for newer versions of libjpeg-turbo.
++#undef HAVE_STDDEF_H
++#undef HAVE_STDLIB_H
+ #include <jpeglib.h>
+
+ #include <string>
+--- a/examples/heif_enc.cc
++++ b/examples/heif_enc.cc
+@@ -35,6 +35,9 @@
+
+ #if HAVE_LIBJPEG
+ extern "C" {
++// Prevent duplicate definition for newer versions of libjpeg-turbo.
++#undef HAVE_STDDEF_H
++#undef HAVE_STDLIB_H
+ #include <jpeglib.h>
+ }
+ #endif
diff --git a/media-libs/libheif/libheif-1.3.2.ebuild b/media-libs/libheif/libheif-1.3.2-r1.ebuild
index 2bce8218a61a..aedf7a7e2591 100644
--- a/media-libs/libheif/libheif-1.3.2.ebuild
+++ b/media-libs/libheif/libheif-1.3.2-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="7"
@@ -11,6 +11,8 @@ if [[ ${PV} == "9999" ]] ; then
else
SRC_URI="https://github.com/strukturag/${PN}/releases/download/v${PV}/${P}.tar.gz"
KEYWORDS="~amd64 ~x86"
+
+ PATCHES=( "${FILESDIR}"/${P}-openjpeg-2.patch )
fi
DESCRIPTION="ISO/IEC 23008-12:2017 HEIF file format decoder and encoder"
@@ -20,14 +22,12 @@ LICENSE="GPL-3"
SLOT="0/1.3"
IUSE="static-libs +threads"
-# Doesn't yet support libjpeg-turbo-2, https://github.com/strukturag/libheif/issues/70
DEPEND="
media-libs/libde265:=[${MULTILIB_USEDEP}]
media-libs/libpng:0=[${MULTILIB_USEDEP}]
media-libs/x265:=[${MULTILIB_USEDEP}]
sys-libs/zlib:=[${MULTILIB_USEDEP}]
virtual/jpeg:0=[${MULTILIB_USEDEP}]
- !>=media-libs/libjpeg-turbo-2
"
RDEPEND="${DEPEND}"