Makefile.fetch                              |    1 
 RepositoryExternal.mk                       |   49 ++++++++++++++++++++++++++++
 bin/lo-all-static-libs                      |    1 
 config_host.mk.in                           |    3 +
 configure.ac                                |    6 +++
 download.lst                                |    2 +
 external/Module_external.mk                 |    1 
 external/libtiff/ExternalProject_libtiff.mk |   44 +++++++++++++++++++++++++
 external/libtiff/Makefile                   |    7 ++++
 external/libtiff/Module_libtiff.mk          |   17 +++++++++
 external/libtiff/UnpackedTarball_libtiff.mk |   16 +++++++++
 vcl/Library_vcl.mk                          |    1 
 12 files changed, 148 insertions(+)

New commits:
commit a2ffd71f20e14f797f30223fe29b3ac1e92eafdf
Author:     Julien Nabet <[email protected]>
AuthorDate: Thu May 19 20:09:51 2022 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri May 20 22:29:00 2022 +0200

    build libtiff
    
    Change-Id: Id9b6e1355147c3f68b9922db14f1b4904a05c686
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134650
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/Makefile.fetch b/Makefile.fetch
index 10641958a9a1..ccb3860735cb 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -159,6 +159,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk 
$(SRCDIR)/download.lst $(S
                $(call fetch_Optional,LIBLANGTAG,LIBLANGTAG_TARBALL) \
                $(call fetch_Optional,LIBNUMBERTEXT,LIBNUMBERTEXT_TARBALL) \
                $(call fetch_Optional,LIBPNG,LIBPNG_TARBALL) \
+               $(call fetch_Optional,LIBTIFF,LIBTIFF_TARBALL) \
                $(call fetch_Optional,LIBTOMMATH,LIBTOMMATH_TARBALL) \
                $(call fetch_Optional,LIBWEBP,LIBWEBP_TARBALL) \
                $(call fetch_Optional,LIBXML2,LIBXML_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 590a6093aea1..fa97dc350597 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2607,6 +2607,55 @@ endef
 
 endif # !SYSTEM_LIBPNG
 
+ifneq ($(SYSTEM_LIBTIFF),)
+
+define gb_LinkTarget__use_libtiff
+$(call gb_LinkTarget_set_include,$(1),\
+       $$(INCLUDE) \
+       $(LIBTIFF_CFLAGS) \
+)
+
+$(call gb_LinkTarget_add_libs,$(1),\
+       $(LIBTIFF_LIBS) \
+)
+
+endef
+
+gb_ExternalProject__use_libtiff :=
+
+else # !SYSTEM_LIBTIFF
+
+define gb_LinkTarget__use_libtiff
+$(call gb_LinkTarget_set_include,$(1),\
+       $(LIBTIFF_CFLAGS) \
+       $$(INCLUDE) \
+)
+
+$(call gb_LinkTarget_set_include,$(1),\
+       -I$(call gb_UnpackedTarball_get_dir,libtiff)/src \
+       $$(INCLUDE) \
+)
+ifeq ($(OS),WNT)
+$(call gb_LinkTarget_add_libs,$(1),\
+       $(call 
gb_UnpackedTarball_get_dir,libtiff)/libtiff/.libs/libtiff$(gb_StaticLibrary_PLAINEXT)
 \
+)
+else
+$(call gb_LinkTarget_add_libs,$(1),\
+       -L$(call gb_UnpackedTarball_get_dir,libtiff)/libtiff/.libs -ltiff \
+)
+endif
+$(call gb_LinkTarget_use_external_project,$(1),libtiff)
+
+endef
+
+define gb_ExternalProject__use_libtiff
+$(call gb_ExternalProject_use_external_project,$(1),\
+       libtiff \
+)
+
+endef
+
+endif # !SYSTEM_LIBTIFF
 
 ifneq ($(SYSTEM_LIBWEBP),)
 
diff --git a/bin/lo-all-static-libs b/bin/lo-all-static-libs
index fbe6d7010624..af4ff25f348b 100755
--- a/bin/lo-all-static-libs
+++ b/bin/lo-all-static-libs
@@ -123,6 +123,7 @@ echo $INSTDIR/$LIBO_LIB_FOLDER/lib*.a \
      $WORKDIR/UnpackedTarball/liborcus/src/*/.libs/*.a \
      $WORKDIR/UnpackedTarball/librevenge/src/*/.libs/*.a \
      $WORKDIR/UnpackedTarball/libvisio/src/lib/.libs/*.a \
+     $WORKDIR/UnpackedTarball/libtiff/libtiff/.libs/*.a \
      $WORKDIR/UnpackedTarball/libwebp/src/.libs/*.a \
      $WORKDIR/UnpackedTarball/libwp?/src/lib/.libs/*.a \
      $WORKDIR/UnpackedTarball/raptor/src/.libs/*.a \
diff --git a/config_host.mk.in b/config_host.mk.in
index df8205e8ad1d..4d45a94e5a2c 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -417,6 +417,8 @@ export LIBPNG_CFLAGS=$(gb_SPACE)@LIBPNG_CFLAGS@
 export LIBPNG_LIBS=$(gb_SPACE)@LIBPNG_LIBS@
 export LIBREPOSITORY_JAR=@LIBREPOSITORY_JAR@
 export LIBSERIALIZER_JAR=@LIBSERIALIZER_JAR@
+export LIBTIFF_CFLAGS=$(gb_SPACE)@LIBTIFF_CFLAGS@
+export LIBTIFF_LIBS=$(gb_SPACE)@LIBTIFF_LIBS@
 export LIBTOMMATH_CFLAGS=@LIBTOMMATH_CFLAGS@
 export LIBTOMMATH_LIBS=@LIBTOMMATH_LIBS@
 export LIBTOOL=@LIBTOOL@
@@ -644,6 +646,7 @@ export SYSTEM_LIBNUMBERTEXT=@SYSTEM_LIBNUMBERTEXT@
 export SYSTEM_LIBNUMBERTEXT_DATA=@SYSTEM_LIBNUMBERTEXT_DATA@
 export SYSTEM_LIBORCUS=@SYSTEM_LIBORCUS@
 export SYSTEM_LIBPNG=@SYSTEM_LIBPNG@
+export SYSTEM_LIBTIFF=@SYSTEM_LIBTIFF@
 export SYSTEM_LIBTOMMATH=@SYSTEM_LIBTOMMATH@
 export SYSTEM_LIBWEBP=@SYSTEM_LIBWEBP@
 export SYSTEM_LIBXML=@SYSTEM_LIBXML@
diff --git a/configure.ac b/configure.ac
index 34ba3f7844e0..186c472b7d45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13555,6 +13555,12 @@ 
LIBPNG_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/libpng"
 LIBPNG_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -llibpng"
 libo_CHECK_SYSTEM_MODULE([libpng],[LIBPNG],[libpng])
 
+dnl ===================================================================
+dnl Test whether to build libtiff or rely on the system version
+dnl ===================================================================
+
+libo_CHECK_SYSTEM_MODULE([libtiff],[LIBTIFF],[libtiff])
+
 dnl ===================================================================
 dnl Test whether to build libwebp or rely on the system version
 dnl ===================================================================
diff --git a/download.lst b/download.lst
index e57bce71e198..be1eaa463570 100644
--- a/download.lst
+++ b/download.lst
@@ -208,6 +208,8 @@ export PIXMAN_SHA256SUM := 
6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f
 export PIXMAN_TARBALL := pixman-0.40.0.tar.gz
 export LIBPNG_SHA256SUM := 
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca
 export LIBPNG_TARBALL := libpng-1.6.37.tar.xz
+export LIBTIFF_SHA256SUM := 
0e46e5acb087ce7d1ac53cf4f56a09b221537fc86dfc5daaad1c2e89e1b37ac8
+export LIBTIFF_TARBALL := tiff-4.3.0.tar.gz
 export POPPLER_SHA256SUM := 
7d3493056b5b86413e5c693c2cae02c5c06cd8e618d14c2c31e2c84b67b2313e
 export POPPLER_TARBALL := poppler-22.01.0.tar.xz
 export POPPLER_DATA_SHA256SUM := 
2cec05cd1bb03af98a8b06a1e22f6e6e1a65b1e2f3816cb3069bb0874825f08c
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 4f97609adbae..c8ad9ae110a6 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
        $(call gb_Helper_optional,LIBLANGTAG,liblangtag) \
        $(call gb_Helper_optional,LIBNUMBERTEXT,libnumbertext) \
        $(call gb_Helper_optional,LIBPNG,libpng) \
+       $(call gb_Helper_optional,LIBTIFF,libtiff) \
        $(call gb_Helper_optional,LIBWEBP,libwebp) \
        $(call gb_Helper_optional,LIBXML2,libxml2) \
        $(call gb_Helper_optional,LIBXSLT,libxslt) \
diff --git a/external/libtiff/ExternalProject_libtiff.mk 
b/external/libtiff/ExternalProject_libtiff.mk
new file mode 100644
index 000000000000..9933a4cf947c
--- /dev/null
+++ b/external/libtiff/ExternalProject_libtiff.mk
@@ -0,0 +1,44 @@
+# -*- 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_autoconf,libtiff,build))
+
+$(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 \
+                       --with-pic \
+                       --disable-shared \
+                       --disable-cxx \
+                       --disable-jbig \
+                       --disable-jpeg \
+                       --disable-lzma \
+                       --disable-mdi \
+                       --disable-webp \
+                       --disable-win32-io \
+                       --disable-zstd \
+                       --without-x \
+                       $(if 
$(verbose),--disable-silent-rules,--enable-silent-rules) \
+                       CFLAGS="$(CFLAGS) $(call 
gb_ExternalProject_get_build_flags,libtiff)" \
+                       CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
+                       LDFLAGS="$(call 
gb_ExternalProject_get_link_flags,libtiff)" \
+                       $(gb_CONFIGURE_PLATFORMS) \
+               && $(MAKE) \
+       )
+       $(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 000000000000..e4968cf85fb6
--- /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 000000000000..adf8114e6e1e
--- /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/UnpackedTarball_libtiff.mk 
b/external/libtiff/UnpackedTarball_libtiff.mk
new file mode 100644
index 000000000000..30701edc56cf
--- /dev/null
+++ b/external/libtiff/UnpackedTarball_libtiff.mk
@@ -0,0 +1,16 @@
+# -*- 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,0))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index a141e22348dd..5828084eb5a9 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
     libeot \
     libjpeg \
     libpng \
+    libtiff \
     libwebp \
     mdds_headers \
 ))

Reply via email to