summaryrefslogtreecommitdiffstats
path: root/external/libtiff
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /external/libtiff
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/libtiff')
-rw-r--r--external/libtiff/0001-ofz-54685-Timeout.patch59
-rw-r--r--external/libtiff/ExternalProject_libtiff.mk74
-rw-r--r--external/libtiff/Makefile7
-rw-r--r--external/libtiff/Module_libtiff.mk17
-rw-r--r--external/libtiff/README3
-rw-r--r--external/libtiff/UnpackedTarball_libtiff.mk21
-rw-r--r--external/libtiff/libtiff.linknolibs.patch11
7 files changed, 192 insertions, 0 deletions
diff --git a/external/libtiff/0001-ofz-54685-Timeout.patch b/external/libtiff/0001-ofz-54685-Timeout.patch
new file mode 100644
index 0000000000..e09b9679f0
--- /dev/null
+++ b/external/libtiff/0001-ofz-54685-Timeout.patch
@@ -0,0 +1,59 @@
+From caab95ab518aafbc985974098ad806f769c462ea Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
+Date: Fri, 20 Jan 2023 10:41:34 +0000
+Subject: [PATCH] ofz#54685 Timeout
+
+---
+ libtiff/tif_ojpeg.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
+index 0c915de2..27b84611 100644
+--- a/libtiff/tif_ojpeg.c
++++ b/libtiff/tif_ojpeg.c
+@@ -1312,6 +1312,34 @@ static int OJPEGReadSecondarySos(TIFF *tif, uint16_t s)
+ return (1);
+ }
+
++// see also vcl/source/filter/jpeg/jpegc.cxx
++static void emitMessage(j_common_ptr cinfo, int msg_level)
++{
++ if (msg_level < 0)
++ {
++ // https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
++ // try to retain some degree of recoverability up to some reasonable
++ // limit (initially using ImageMagick's current limit of 1000), then
++ // bail.
++ const int WarningLimit = 1000;
++#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
++ // ofz#50452 due to Timeouts, just abandon fuzzing on any
++ // JWRN_NOT_SEQUENTIAL
++ if (cinfo->err->msg_code == JWRN_NOT_SEQUENTIAL)
++ {
++ cinfo->err->error_exit(cinfo);
++ return;
++ }
++#endif
++ if (++cinfo->err->num_warnings > WarningLimit)
++ cinfo->err->error_exit(cinfo);
++ else
++ cinfo->err->output_message(cinfo);
++ }
++ else if (cinfo->err->trace_level >= msg_level)
++ cinfo->err->output_message(cinfo);
++}
++
+ static int OJPEGWriteHeaderInfo(TIFF *tif)
+ {
+ static const char module[] = "OJPEGWriteHeaderInfo";
+@@ -1327,6 +1355,7 @@ static int OJPEGWriteHeaderInfo(TIFF *tif)
+ sp->libjpeg_jpeg_error_mgr.output_message =
+ OJPEGLibjpegJpegErrorMgrOutputMessage;
+ sp->libjpeg_jpeg_error_mgr.error_exit = OJPEGLibjpegJpegErrorMgrErrorExit;
++ sp->libjpeg_jpeg_error_mgr.emit_message = emitMessage;
+ sp->libjpeg_jpeg_decompress_struct.err = &(sp->libjpeg_jpeg_error_mgr);
+ sp->libjpeg_jpeg_decompress_struct.client_data = (void *)tif;
+ if (jpeg_create_decompress_encap(
+--
+2.39.0
+
diff --git a/external/libtiff/ExternalProject_libtiff.mk b/external/libtiff/ExternalProject_libtiff.mk
new file mode 100644
index 0000000000..f6bcba1066
--- /dev/null
+++ b/external/libtiff/ExternalProject_libtiff.mk
@@ -0,0 +1,74 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,libtiff))
+
+$(eval $(call gb_ExternalProject_register_targets,libtiff,\
+ build \
+))
+
+$(eval $(call gb_ExternalProject_use_externals,libtiff,\
+ libjpeg \
+ libwebp \
+ zlib \
+))
+
+$(eval $(call gb_ExternalProject_use_autoconf,libtiff,build))
+
+# using ac_cv_lib_z_inflateEnd=yes to skip test for our
+# static windows lib where the name is zlib not z
+# using ac_cv_lib_jpeg_jpeg_read_scanlines and
+# ac_cv_lib_jpeg_jpeg12_read_scanlines to skip tests
+# for our static jpeg lib where the name is libjpeg-turbo.lib
+# or liblibjpeg-turbo.a not libjpeg.lib/libjpeg.a
+# we're building this statically anyway so the lib isn't
+# used during the link done here
+
+$(call gb_ExternalProject_get_state_target,libtiff,build) :
+ $(call gb_Trace_StartRange,libtiff,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ export PKG_CONFIG="" \
+ && MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
+ --enable-static \
+ --enable-jpeg \
+ --enable-zlib \
+ --enable-webp \
+ --disable-shared \
+ --disable-cxx \
+ --disable-libdeflate \
+ --disable-jbig \
+ --disable-lerc \
+ --disable-lzma \
+ --disable-mdi \
+ --disable-win32-io \
+ --disable-zstd \
+ --with-pic \
+ --without-x \
+ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
+ CFLAGS="$(CFLAGS) $(call gb_ExternalProject_get_build_flags,libtiff) $(gb_EMSCRIPTEN_CFLAGS)" \
+ $(if $(SYSTEM_ZLIB),,--with-zlib-include-dir="$(call gb_UnpackedTarball_get_dir,zlib)") \
+ $(if $(SYSTEM_ZLIB),,--with-zlib-lib-dir="$(gb_StaticLibrary_WORKDIR)") \
+ $(if $(SYSTEM_LIBJPEG),,--with-jpeg-include-dir="$(call gb_UnpackedTarball_get_dir,libjpeg-turbo)") \
+ $(if $(SYSTEM_LIBJPEG),,--with-jpeg-lib-dir="$(gb_StaticLibrary_WORKDIR)") \
+ $(if $(SYSTEM_LIBWEBP),,--with-webp-include-dir="$(call gb_UnpackedTarball_get_dir,libwebp/src)") \
+ $(if $(SYSTEM_LIBWEBP),,$(if $(filter WNT,$(OS_FOR_BUILD)),\
+ --with-webp-lib-dir="$(call gb_UnpackedTarball_get_dir,libwebp)/output/lib/libwebp$(if $(MSVC_USE_DEBUG_RUNTIME),_debug)$(gb_StaticLibrary_PLAINEXT)", \
+ --with-webp-lib-dir="$(call gb_UnpackedTarball_get_dir,libwebp)/src/.libs")) \
+ CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS)" \
+ LDFLAGS="$(call gb_ExternalProject_get_link_flags,libtiff) $(gb_EMSCRIPTEN_LDFLAGS)" \
+ ac_cv_lib_z_inflateEnd=yes \
+ ac_cv_lib_jpeg_jpeg_read_scanlines=yes \
+ ac_cv_lib_jpeg_jpeg12_read_scanlines=no \
+ ac_cv_lib_webp_WebPDecode=yes \
+ $(gb_CONFIGURE_PLATFORMS) \
+ && cd libtiff && $(MAKE) libtiff.la \
+ )
+ $(call gb_Trace_EndRange,libtiff,EXTERNAL)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtiff/Makefile b/external/libtiff/Makefile
new file mode 100644
index 0000000000..e4968cf85f
--- /dev/null
+++ b/external/libtiff/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtiff/Module_libtiff.mk b/external/libtiff/Module_libtiff.mk
new file mode 100644
index 0000000000..adf8114e6e
--- /dev/null
+++ b/external/libtiff/Module_libtiff.mk
@@ -0,0 +1,17 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,libtiff))
+
+$(eval $(call gb_Module_add_targets,libtiff,\
+ ExternalProject_libtiff \
+ UnpackedTarball_libtiff \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtiff/README b/external/libtiff/README
new file mode 100644
index 0000000000..a650ea584a
--- /dev/null
+++ b/external/libtiff/README
@@ -0,0 +1,3 @@
+libtiff is a library to encode and decode images in TIFF format, from [http://download.osgeo.org/libtiff/]
+
+For the moment we use it only for decoding part.
diff --git a/external/libtiff/UnpackedTarball_libtiff.mk b/external/libtiff/UnpackedTarball_libtiff.mk
new file mode 100644
index 0000000000..f7eeb6ace8
--- /dev/null
+++ b/external/libtiff/UnpackedTarball_libtiff.mk
@@ -0,0 +1,21 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,libtiff))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libtiff,$(LIBTIFF_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libtiff,1))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libtiff,\
+ external/libtiff/libtiff.linknolibs.patch \
+ external/libtiff/0001-ofz-54685-Timeout.patch \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libtiff/libtiff.linknolibs.patch b/external/libtiff/libtiff.linknolibs.patch
new file mode 100644
index 0000000000..bd03af3a70
--- /dev/null
+++ b/external/libtiff/libtiff.linknolibs.patch
@@ -0,0 +1,11 @@
+--- a/libtiff/Makefile.in 2022-05-21 15:32:48.069999327 +0100
++++ b/libtiff/Makefile.in 2022-05-21 15:32:59.051499293 +0100
+@@ -372,7 +372,7 @@
+ LDFLAGS = @LDFLAGS@
+ LIBDIR = @LIBDIR@
+ LIBOBJS = @LIBOBJS@
+-LIBS = @LIBS@
++#LIBS = @LIBS@
+ LIBTIFF_ALPHA_VERSION = @LIBTIFF_ALPHA_VERSION@
+ LIBTIFF_DOCDIR = @LIBTIFF_DOCDIR@
+ LIBTIFF_MAJOR_VERSION = @LIBTIFF_MAJOR_VERSION@