summaryrefslogtreecommitdiffstats
path: root/external/libwebp
diff options
context:
space:
mode:
Diffstat (limited to 'external/libwebp')
-rw-r--r--external/libwebp/ExternalProject_libwebp.mk58
-rw-r--r--external/libwebp/Makefile7
-rw-r--r--external/libwebp/Makefile.vc.patch148
-rw-r--r--external/libwebp/Module_libwebp.mk17
-rw-r--r--external/libwebp/README1
-rw-r--r--external/libwebp/UnpackedTarball_libwebp.mk20
6 files changed, 251 insertions, 0 deletions
diff --git a/external/libwebp/ExternalProject_libwebp.mk b/external/libwebp/ExternalProject_libwebp.mk
new file mode 100644
index 000000000..0146bd72a
--- /dev/null
+++ b/external/libwebp/ExternalProject_libwebp.mk
@@ -0,0 +1,58 @@
+# -*- 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,libwebp))
+
+$(eval $(call gb_ExternalProject_register_targets,libwebp,\
+ build \
+))
+
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalProject_use_nmake,libwebp,build))
+
+# Explicitly passing in ARCH (for the known architectures, at least) avoids
+# workdir/UnpackedTarball/libwebp/Makefile.vc not being able to detect it when CC is clang-cl:
+$(call gb_ExternalProject_get_state_target,libwebp,build):
+ $(call gb_Trace_StartRange,libwebp,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ nmake -nologo -f Makefile.vc CFG=$(if $(MSVC_USE_DEBUG_RUNTIME),debug,release)-static RTLIBCFG=dynamic OBJDIR=output \
+ $(if $(filter INTEL,$(CPUNAME)),ARCH=x86, \
+ $(if $(filter X86_64,$(CPUNAME)),ARCH=x64, \
+ $(if $(filter AARCH64,$(CPUNAME)),ARCH=ARM))) \
+ )
+ $(call gb_Trace_EndRange,libwebp,EXTERNAL)
+else
+$(eval $(call gb_ExternalProject_use_autoconf,libwebp,build))
+
+$(call gb_ExternalProject_get_state_target,libwebp,build) :
+ $(call gb_Trace_StartRange,libwebp,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ export PKG_CONFIG="" \
+ && MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \
+ --enable-static \
+ --with-pic \
+ --disable-shared \
+ --disable-gl \
+ --disable-sdl \
+ --disable-png \
+ --disable-jpeg \
+ --disable-tiff \
+ --disable-gif \
+ --disable-wic \
+ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
+ CFLAGS="$(CFLAGS) $(call gb_ExternalProject_get_build_flags,libwebp)" \
+ CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
+ LDFLAGS="$(call gb_ExternalProject_get_link_flags,libwebp)" \
+ $(gb_CONFIGURE_PLATFORMS) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,libwebp,EXTERNAL)
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libwebp/Makefile b/external/libwebp/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/libwebp/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/libwebp/Makefile.vc.patch b/external/libwebp/Makefile.vc.patch
new file mode 100644
index 000000000..f13c12410
--- /dev/null
+++ b/external/libwebp/Makefile.vc.patch
@@ -0,0 +1,148 @@
+--- Makefile.vc.sav 2021-07-30 00:55:37.000000000 +0200
++++ Makefile.vc 2022-01-25 17:35:30.206117700 +0100
+@@ -7,11 +7,11 @@
+ LIBWEBPDEMUX_BASENAME = libwebpdemux
+
+ !IFNDEF ARCH
+-!IF ! [ cl 2>&1 | find "x86" > NUL ]
++!IF ! [ $(CC) 2>&1 | grep -q "x86" > NUL ]
+ ARCH = x86
+-!ELSE IF ! [ cl 2>&1 | find "x64" > NUL ]
++!ELSE IF ! [ $(CC) 2>&1 | grep -q "x64" > NUL ]
+ ARCH = x64
+-!ELSE IF ! [ cl 2>&1 | find "ARM" > NUL ]
++!ELSE IF ! [ $(CC) 2>&1 | grep -q "ARM" > NUL ]
+ ARCH = ARM
+ !ELSE
+ !ERROR Unable to auto-detect toolchain architecture! \
+@@ -27,8 +27,8 @@
+ ## Nothing more to do below this line!
+
+ NOLOGO = /nologo
+-CCNODBG = cl.exe $(NOLOGO) /O2 /DNDEBUG
+-CCDEBUG = cl.exe $(NOLOGO) /Od /Zi /D_DEBUG /RTC1
++CCNODBG = $(CC) $(NOLOGO) /O2 /DNDEBUG
++CCDEBUG = $(CC) $(NOLOGO) /Od /Zi /D_DEBUG /RTC1
+ CFLAGS = /I. /Isrc $(NOLOGO) /W3 /EHsc /c
+ CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DWIN32_LEAN_AND_MEAN
+ LDFLAGS = /LARGEADDRESSAWARE /MANIFEST:EMBED /NXCOMPAT /DYNAMICBASE
+@@ -67,7 +67,7 @@
+ RTLIB = /MD
+ RTLIBD = /MDd
+ !ENDIF
+-DIRBASE = $(OUTDIR)\$(CFG)\$(ARCH)
++DIRBASE = $(OUTDIR)
+ DIROBJ = $(DIRBASE)\obj
+ DIRLIB = $(DIRBASE)\lib
+ DIRINC = $(DIRBASE)\include
+@@ -86,10 +86,10 @@
+
+ # Target configuration
+ !IF "$(CFG)" == "release-static"
+-CC = $(CCNODBG)
++CC_ = $(CCNODBG)
+ STATICLIBBUILD = TRUE
+ !ELSE IF "$(CFG)" == "debug-static"
+-CC = $(CCDEBUG)
++CC_ = $(CCDEBUG)
+ RTLIB = $(RTLIBD)
+ STATICLIBBUILD = TRUE
+ LIBWEBPDECODER_BASENAME = $(LIBWEBPDECODER_BASENAME)_debug
+@@ -97,11 +97,11 @@
+ LIBWEBPMUX_BASENAME = $(LIBWEBPMUX_BASENAME)_debug
+ LIBWEBPDEMUX_BASENAME = $(LIBWEBPDEMUX_BASENAME)_debug
+ !ELSE IF "$(CFG)" == "release-dynamic"
+-CC = $(CCNODBG)
++CC_ = $(CCNODBG)
+ RC = $(RCNODBG)
+ DLLBUILD = TRUE
+ !ELSE IF "$(CFG)" == "debug-dynamic"
+-CC = $(CCDEBUG)
++CC_ = $(CCDEBUG)
+ RC = $(RCDEBUG)
+ RTLIB = $(RTLIBD)
+ DLLBUILD = TRUE
+@@ -112,7 +112,7 @@
+ !ENDIF
+
+ !IF "$(STATICLIBBUILD)" == "TRUE"
+-CC = $(CC) $(RTLIB)
++CC_ = $(CC_) $(RTLIB)
+ CFGSET = TRUE
+ LIBWEBPDECODER = $(DIRLIB)\$(LIBWEBPDECODER_BASENAME).lib
+ LIBWEBP = $(DIRLIB)\$(LIBWEBP_BASENAME).lib
+@@ -120,7 +120,7 @@
+ LIBWEBPDEMUX = $(DIRLIB)\$(LIBWEBPDEMUX_BASENAME).lib
+ !ELSE IF "$(DLLBUILD)" == "TRUE"
+ DLLINC = webp_dll.h
+-CC = $(CC) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL
++CC_ = $(CC_) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL
+ LIBWEBPDECODER = $(DIRLIB)\$(LIBWEBPDECODER_BASENAME)_dll.lib
+ LIBWEBP = $(DIRLIB)\$(LIBWEBP_BASENAME)_dll.lib
+ LIBWEBPMUX = $(DIRLIB)\$(LIBWEBPMUX_BASENAME)_dll.lib
+@@ -421,7 +421,7 @@
+ $(DIROBJ)\$(DLLINC)
+
+ {$(DIROBJ)}.c{$(DIROBJ)}.obj:
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$@ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$@ $<
+
+ {src}.rc{$(DIROBJ)}.res:
+ $(RC) /fo$@ $<
+@@ -469,41 +469,41 @@
+ # File-specific flag builds. Note batch rules take precedence over wildcards,
+ # so for now name each file individually.
+ $(DIROBJ)\examples\anim_diff.obj: examples\anim_diff.c
+- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
+ /Fo$(DIROBJ)\examples\ examples\$(@B).c
+ $(DIROBJ)\examples\anim_dump.obj: examples\anim_dump.c
+- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
+ /Fo$(DIROBJ)\examples\ examples\$(@B).c
+ $(DIROBJ)\examples\anim_util.obj: examples\anim_util.c
+- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
+ /Fo$(DIROBJ)\examples\ examples\$(@B).c
+ $(DIROBJ)\examples\gif2webp.obj: examples\gif2webp.c
+- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
+ /Fo$(DIROBJ)\examples\ examples\$(@B).c
+ $(DIROBJ)\examples\gifdec.obj: examples\gifdec.c
+- $(CC) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
++ $(CC_) $(CFLAGS) /DWEBP_HAVE_GIF /Fd$(LIBWEBP_PDBNAME) \
+ /Fo$(DIROBJ)\examples\ examples\$(@B).c
+ # Batch rules
+ {examples}.c{$(DIROBJ)\examples}.obj::
+- $(CC) $(CFLAGS) /Fd$(DIROBJ)\examples\ /Fo$(DIROBJ)\examples\ $<
++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\examples\ /Fo$(DIROBJ)\examples\ $<
+ {extras}.c{$(DIROBJ)\extras}.obj::
+- $(CC) $(CFLAGS) /Fd$(DIROBJ)\extras\ /Fo$(DIROBJ)\extras\ $<
++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\extras\ /Fo$(DIROBJ)\extras\ $<
+ {imageio}.c{$(DIROBJ)\imageio}.obj::
+- $(CC) $(CFLAGS) /Fd$(DIROBJ)\imageio\ /Fo$(DIROBJ)\imageio\ $<
++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\imageio\ /Fo$(DIROBJ)\imageio\ $<
+ {sharpyuv}.c{$(DIROBJ)\sharpyuv}.obj::
+- $(CC) $(CFLAGS) /Fd$(DIROBJ)\sharpyuv\ /Fo$(DIROBJ)\sharpyuv\ $<
++ $(CC_) $(CFLAGS) /Fd$(DIROBJ)\sharpyuv\ /Fo$(DIROBJ)\sharpyuv\ $<
+ {src\dec}.c{$(DIROBJ)\dec}.obj::
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dec\ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dec\ $<
+ {src\demux}.c{$(DIROBJ)\demux}.obj::
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\demux\ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\demux\ $<
+ {src\dsp}.c{$(DIROBJ)\dsp}.obj::
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dsp\ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\dsp\ $<
+ {src\enc}.c{$(DIROBJ)\enc}.obj::
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\enc\ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\enc\ $<
+ {src\mux}.c{$(DIROBJ)\mux}.obj::
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\mux\ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\mux\ $<
+ {src\utils}.c{$(DIROBJ)\utils}.obj::
+- $(CC) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\utils\ $<
++ $(CC_) $(CFLAGS) /Fd$(LIBWEBP_PDBNAME) /Fo$(DIROBJ)\utils\ $<
+
+ LNKLIBS = ole32.lib windowscodecs.lib shlwapi.lib
+ !IF "$(UNICODE)" == "1"
diff --git a/external/libwebp/Module_libwebp.mk b/external/libwebp/Module_libwebp.mk
new file mode 100644
index 000000000..b89056ac3
--- /dev/null
+++ b/external/libwebp/Module_libwebp.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,libwebp))
+
+$(eval $(call gb_Module_add_targets,libwebp,\
+ ExternalProject_libwebp \
+ UnpackedTarball_libwebp \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/libwebp/README b/external/libwebp/README
new file mode 100644
index 000000000..1308c278b
--- /dev/null
+++ b/external/libwebp/README
@@ -0,0 +1 @@
+libwebp is a library to encode and decode images in WebP format, from [https://developers.google.com/speed/webp/]
diff --git a/external/libwebp/UnpackedTarball_libwebp.mk b/external/libwebp/UnpackedTarball_libwebp.mk
new file mode 100644
index 000000000..67f797157
--- /dev/null
+++ b/external/libwebp/UnpackedTarball_libwebp.mk
@@ -0,0 +1,20 @@
+# -*- 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,libwebp))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,libwebp,$(LIBWEBP_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,libwebp,0))
+
+$(eval $(call gb_UnpackedTarball_add_patches,libwebp,\
+ external/libwebp/Makefile.vc.patch \
+))
+
+# vim: set noet sw=4 ts=4: