summaryrefslogtreecommitdiffstats
path: root/external/cairo
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /external/cairo
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/cairo')
-rw-r--r--external/cairo/ExternalPackage_cairo.mk22
-rw-r--r--external/cairo/ExternalPackage_pixman.mk23
-rw-r--r--external/cairo/ExternalProject_cairo.mk79
-rw-r--r--external/cairo/ExternalProject_pixman.mk48
-rw-r--r--external/cairo/Makefile7
-rw-r--r--external/cairo/Module_cairo.mk21
-rw-r--r--external/cairo/README6
-rw-r--r--external/cairo/UnpackedTarball_cairo.mk37
-rw-r--r--external/cairo/UnpackedTarball_pixman.mk24
-rw-r--r--external/cairo/cairo/cairo-1.10.2.ios.patch27
-rw-r--r--external/cairo/cairo/cairo-1.10.2.no-atsui.patch22
-rw-r--r--external/cairo/cairo/cairo-1.10.2.patch226
-rw-r--r--external/cairo/cairo/cairo-libtool-rpath.patch.112
-rw-r--r--external/cairo/cairo/cairo.GL_RGBA.patch49
-rwxr-xr-xexternal/cairo/cairo/dummy_pkg_config3
-rw-r--r--external/cairo/pixman/Makefile.win32.common54
-rw-r--r--external/cairo/pixman/pixman-0.24.4.patch91
-rw-r--r--external/cairo/pixman/pixman-ofz4372.patch16
-rw-r--r--external/cairo/pixman/pixman-ubsan.patch33
19 files changed, 800 insertions, 0 deletions
diff --git a/external/cairo/ExternalPackage_cairo.mk b/external/cairo/ExternalPackage_cairo.mk
new file mode 100644
index 000000000..3b78a52fe
--- /dev/null
+++ b/external/cairo/ExternalPackage_cairo.mk
@@ -0,0 +1,22 @@
+# -*- 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_ExternalPackage_ExternalPackage,cairo,cairo))
+
+$(eval $(call gb_ExternalPackage_use_external_project,cairo,cairo))
+
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+ifneq ($(OS),ANDROID)
+
+$(eval $(call gb_ExternalPackage_add_file,cairo,$(LIBO_LIB_FOLDER)/libcairo.so.2,src/.libs/libcairo.so.2.1160$(CAIRO_VERSION_MICRO).0))
+
+endif
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/ExternalPackage_pixman.mk b/external/cairo/ExternalPackage_pixman.mk
new file mode 100644
index 000000000..288a9701a
--- /dev/null
+++ b/external/cairo/ExternalPackage_pixman.mk
@@ -0,0 +1,23 @@
+# -*- 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_ExternalPackage_ExternalPackage,pixman,pixman))
+
+$(eval $(call gb_ExternalPackage_use_external_project,pixman,pixman))
+
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+ifneq ($(OS),ANDROID)
+
+$(eval $(call gb_ExternalPackage_add_file,pixman,$(LIBO_LIB_FOLDER)/libpixman-1.so.0,pixman/.libs/libpixman-1.so.0.34.0))
+
+endif
+endif
+
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
new file mode 100644
index 000000000..43b4a7b53
--- /dev/null
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -0,0 +1,79 @@
+# -*- 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,cairo))
+
+$(eval $(call gb_ExternalProject_use_external_project,cairo,pixman))
+
+$(eval $(call gb_ExternalProject_use_externals,cairo,\
+ freetype \
+ libpng \
+ zlib \
+))
+
+ifeq ($(OS),ANDROID)
+$(eval $(call gb_ExternalProject_use_unpacked,cairo,fontconfig))
+$(eval $(call gb_ExternalProject_use_unpacked,cairo,libpng))
+endif
+
+$(eval $(call gb_ExternalProject_register_targets,cairo,\
+ build \
+))
+
+ifeq ($(OS),WNT)
+
+$(call gb_ExternalProject_get_state_target,cairo,build) :
+ $(call gb_Trace_StartRange,cairo,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(MAKE) -f Makefile.win32 CFG=release ZLIB3RDLIB=zlib.lib \
+ )
+ $(call gb_Trace_EndRange,cairo,EXTERNAL)
+
+
+else
+
+# overwrite src/cairo-version.h because that is just a dummy file and included
+# from cairo.h in non-overridable way
+
+$(call gb_ExternalProject_get_state_target,cairo,build) :
+ $(call gb_Trace_StartRange,cairo,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ ./configure \
+ $(if $(debug),STRIP=" ") \
+ $(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
+ $(if $(filter-out ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" ) \
+ $(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
+ LIBS="$(ZLIB_LIBS)" \
+ $(if $(filter -fsanitize=%,$(LDFLAGS)),LDFLAGS="$(LDFLAGS) -fuse-ld=bfd") \
+ pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \
+ pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1 \
+ $(if $(filter LINUX,$(OS)),-Wl$(COMMA)-z$(COMMA)origin \
+ -Wl$(COMMA)-rpath$(COMMA)\\\$$\$$ORIGIN)" \
+ png_REQUIRES="trick_configure_into_using_png_CFLAGS_and_LIBS" \
+ png_CFLAGS="$(LIBPNG_CFLAGS)" png_LIBS="$(LIBPNG_LIBS)" \
+ $(if $(SYSTEM_FREETYPE),,FREETYPE_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,freetype)/include") \
+ $(if $(SYSTEM_FONTCONFIG),,FONTCONFIG_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,fontconfig)") \
+ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
+ $(if $(filter ANDROID iOS,$(OS)),--disable-xlib --disable-xcb,$(if $(filter TRUE,$(DISABLE_GUI)),--disable-xlib --disable-xcb,--enable-xlib --enable-xcb)) \
+ $(if $(filter iOS,$(OS)),--enable-quartz --enable-quartz-font) \
+ --disable-valgrind \
+ $(if $(filter iOS,$(OS)),--disable-ft,--enable-ft --enable-fc) \
+ --disable-svg --enable-gtk-doc=no --enable-test-surfaces=no \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+ $(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no ax_cv_c_float_words_bigendian=no)) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+ && cp cairo-version.h src/cairo-version.h \
+ && cd src && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,cairo,EXTERNAL)
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
new file mode 100644
index 000000000..fec943762
--- /dev/null
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -0,0 +1,48 @@
+# -*- 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,pixman))
+
+$(eval $(call gb_ExternalProject_register_targets,pixman,\
+ build \
+))
+
+ifeq ($(OS),WNT)
+
+$(call gb_ExternalProject_get_state_target,pixman,build) :
+ $(call gb_Trace_StartRange,pixman,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ $(MAKE) -f Makefile.win32 MMX=on SSE2=on CFG=release \
+ ,pixman)
+ $(call gb_Trace_EndRange,pixman,EXTERNAL)
+
+else
+
+# ANDROID:
+# The pixman-cpu.c code wants to read /proc/<pid>/auxv, but
+# the Android headers don't define Elf32_auxv_t.
+#
+# Maybe we should instead just patch the arm_has_* booleans in
+# pixman-cpu.c to be hardcoded as TRUE and patch out the run-time
+# check?
+$(call gb_ExternalProject_get_state_target,pixman,build) :
+ $(call gb_Trace_StartRange,pixman,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ ./configure \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static)) \
+ $(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
+ $(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,pixman,EXTERNAL)
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/Makefile b/external/cairo/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/cairo/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/cairo/Module_cairo.mk b/external/cairo/Module_cairo.mk
new file mode 100644
index 000000000..6d8a29add
--- /dev/null
+++ b/external/cairo/Module_cairo.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_Module_Module,cairo))
+
+$(eval $(call gb_Module_add_targets,cairo,\
+ ExternalPackage_cairo \
+ ExternalPackage_pixman \
+ ExternalProject_cairo \
+ ExternalProject_pixman \
+ UnpackedTarball_cairo \
+ UnpackedTarball_pixman \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/README b/external/cairo/README
new file mode 100644
index 000000000..3d955dcd0
--- /dev/null
+++ b/external/cairo/README
@@ -0,0 +1,6 @@
+The graphics library, used for anti-aliasing. From [http://cairographics.org/].
+
+This code is used by default only on Linux, though it is also
+available on Mac. There is a cairo-canvas implementation that is the
+main customer, and it is enabled via 'use hardware acceleration' in
+the general options.
diff --git a/external/cairo/UnpackedTarball_cairo.mk b/external/cairo/UnpackedTarball_cairo.mk
new file mode 100644
index 000000000..8e45e9c28
--- /dev/null
+++ b/external/cairo/UnpackedTarball_cairo.mk
@@ -0,0 +1,37 @@
+# -*- 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,cairo))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,cairo,$(CAIRO_TARBALL),,cairo))
+
+$(eval $(call gb_UnpackedTarball_add_patches,cairo,\
+ external/cairo/cairo/cairo-1.10.2.patch \
+ external/cairo/cairo/cairo-libtool-rpath.patch.1 \
+))
+
+ifeq ($(OS),iOS)
+$(eval $(call gb_UnpackedTarball_add_patches,cairo,\
+ external/cairo/cairo/cairo-1.10.2.no-atsui.patch \
+ external/cairo/cairo/cairo-1.10.2.ios.patch \
+))
+endif
+
+# To be applied only when ENABLE_ANDROID_LOK is not defined
+ifeq ($(OS)$(ENABLE_ANDROID_LOK),ANDROID)
+$(eval $(call gb_UnpackedTarball_add_patches,cairo,\
+ external/cairo/cairo/cairo.GL_RGBA.patch \
+))
+endif
+
+ifneq (,$(filter ANDROID iOS,$(OS)))
+$(eval $(call gb_UnpackedTarball_add_file,cairo,.,external/cairo/cairo/dummy_pkg_config))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/UnpackedTarball_pixman.mk b/external/cairo/UnpackedTarball_pixman.mk
new file mode 100644
index 000000000..cc3dbd11d
--- /dev/null
+++ b/external/cairo/UnpackedTarball_pixman.mk
@@ -0,0 +1,24 @@
+# -*- 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,pixman))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,pixman,$(PIXMAN_TARBALL),,cairo))
+
+$(eval $(call gb_UnpackedTarball_add_patches,pixman,\
+ external/cairo/pixman/pixman-0.24.4.patch \
+ external/cairo/pixman/pixman-ofz4372.patch \
+ external/cairo/pixman/pixman-ubsan.patch \
+))
+
+ifeq ($(OS),WNT)
+$(eval $(call gb_UnpackedTarball_add_file,pixman,pixman,external/cairo/pixman/Makefile.win32.common))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/cairo/cairo/cairo-1.10.2.ios.patch b/external/cairo/cairo/cairo-1.10.2.ios.patch
new file mode 100644
index 000000000..c61faf333
--- /dev/null
+++ b/external/cairo/cairo/cairo-1.10.2.ios.patch
@@ -0,0 +1,27 @@
+--- misc/cairo-1.10.2/configure 2011-12-16 10:02:39.626077757 +0100
++++ misc/build/cairo-1.10.2/configure 2011-12-16 10:02:23.518237109 +0100
+@@ -22766,11 +22766,13 @@
+
+
+ ac_fn_c_check_header_mongrel "$LINENO" "ApplicationServices/ApplicationServices.h" "ac_cv_header_ApplicationServices_ApplicationServices_h" "$ac_includes_default"
++if false; then
+ if test "x$ac_cv_header_ApplicationServices_ApplicationServices_h" = x""yes; then :
+
+ else
+ use_quartz="no (requires ApplicationServices framework)"
+ fi
++fi
+
+
+ if test "x$use_quartz" != "xyes" ; then
+--- misc/cairo-1.10.2/src/cairo-quartz.h 2011-12-16 10:02:39.639079241 +0100
++++ misc/build/cairo-1.10.2/src/cairo-quartz.h 2011-12-16 10:01:18.404789245 +0100
+@@ -40,7 +40,7 @@
+
+ #if CAIRO_HAS_QUARTZ_SURFACE
+
+-#include <ApplicationServices/ApplicationServices.h>
++#include <CoreGraphics/CoreGraphics.h>
+
+ CAIRO_BEGIN_DECLS
+
diff --git a/external/cairo/cairo/cairo-1.10.2.no-atsui.patch b/external/cairo/cairo/cairo-1.10.2.no-atsui.patch
new file mode 100644
index 000000000..51b98afa5
--- /dev/null
+++ b/external/cairo/cairo/cairo-1.10.2.no-atsui.patch
@@ -0,0 +1,22 @@
+--- misc/cairo-1.10.2/src/cairo-quartz-font.c 2010-12-25 15:21:34.000000000 +0100
++++ misc/build/cairo-1.10.2/src/cairo-quartz-font.c 2011-12-16 09:54:18.672445207 +0100
+@@ -777,7 +777,7 @@
+ return ffont->cgFont;
+ }
+
+-#ifndef __LP64__
++#if 0
+ /*
+ * compat with old ATSUI backend
+ */
+--- misc/cairo-1.10.2/src/cairo-quartz.h 2010-06-18 13:47:13.000000000 +0200
++++ misc/build/cairo-1.10.2/src/cairo-quartz.h 2011-12-16 09:52:53.081501547 +0100
+@@ -66,7 +66,7 @@
+ cairo_public cairo_font_face_t *
+ cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
+
+-#ifndef __LP64__
++#if 0
+ cairo_public cairo_font_face_t *
+ cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id);
+ #endif
diff --git a/external/cairo/cairo/cairo-1.10.2.patch b/external/cairo/cairo/cairo-1.10.2.patch
new file mode 100644
index 000000000..f50501926
--- /dev/null
+++ b/external/cairo/cairo/cairo-1.10.2.patch
@@ -0,0 +1,226 @@
+diff -ruNw misc/cairo-1.10.2/build/Makefile.win32.features misc/build/cairo-1.10.2/build/Makefile.win32.features
+--- misc/cairo-1.10.2/build/Makefile.win32.features 2015-10-27 17:04:21.000000000 -0400
++++ misc/build/cairo-1.10.2/build/Makefile.win32.features 2017-11-24 21:43:14.103524768 -0500
+@@ -30,7 +30,7 @@
+ CAIRO_HAS_FC_FONT=0
+ CAIRO_HAS_PS_SURFACE=1
+ CAIRO_HAS_PDF_SURFACE=1
+-CAIRO_HAS_SVG_SURFACE=1
++CAIRO_HAS_SVG_SURFACE=0
+ CAIRO_HAS_TEST_SURFACES=0
+ CAIRO_HAS_TEE_SURFACE=0
+ CAIRO_HAS_XML_SURFACE=0
+diff -ruNw misc/cairo-1.10.2/configure misc/build/cairo-1.10.2/configure
+--- misc/cairo-1.10.2/configure 2015-12-09 15:41:45.000000000 -0500
++++ misc/build/cairo-1.10.2/configure 2017-11-24 21:43:14.103524768 -0500
+@@ -20580,61 +20580,12 @@
+ rm -f confcache
+
+
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5
+-$as_echo_n "checking for compress in -lz... " >&6; }
+-if ${ac_cv_lib_z_compress+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lz $LIBS"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-
+-/* Override any GCC internal prototype to avoid an error.
+- Use char because int might match the return type of a GCC
+- builtin and then its argument prototype would still apply. */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char compress ();
+-int
+-main ()
+-{
+-return compress ();
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+- ac_cv_lib_z_compress=yes
+-else
+- ac_cv_lib_z_compress=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+- conftest$ac_exeext conftest.$ac_ext
+-LIBS=$ac_check_lib_save_LIBS
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5
+-$as_echo "$ac_cv_lib_z_compress" >&6; }
+-if test "x$ac_cv_lib_z_compress" = xyes; then :
+- ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+-if test "x$ac_cv_header_zlib_h" = xyes; then :
+
+ have_libz=yes
+
+ $as_echo "#define HAVE_ZLIB 1" >>confdefs.h
+
+
+-else
+- have_libz="no (requires zlib http://www.gzip.org/zlib/)"
+-fi
+-
+-
+-else
+- have_libz="no (requires zlib http://www.gzip.org/zlib/)"
+-fi
+-
+-
+ save_LIBS="$LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo2a_decompress in -llzo2" >&5
+ $as_echo_n "checking for lzo2a_decompress in -llzo2... " >&6; }
+@@ -30069,7 +30020,7 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_VERSION - OK" >&5
+ $as_echo "$FREETYPE_VERSION - OK" >&6; }
+ ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
+- ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`
++ ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs | $SED -e 's/-lz//g'`
+ else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_VERSION - Too old" >&5
+ $as_echo "$FREETYPE_VERSION - Too old" >&6; }
+ use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"
+@@ -30079,7 +30030,7 @@
+ fi
+
+ ft_CFLAGS="$FREETYPE_CFLAGS"
+- ft_LIBS="$FREETYPE_LIBS"
++ ft_LIBS=`echo "$FREETYPE_LIBS" | $SED -e 's/-lz//g'`
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's FreeType font backend feature could be enabled" >&5
+@@ -30686,7 +30637,7 @@
+
+ # The ps backend requires zlib.
+ use_ps=$have_libz
+- ps_NONPKGCONFIG_LIBS=-lz
++ ps_NONPKGCONFIG_LIBS=$ZLIB3RDLIB
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's PostScript surface backend feature could be enabled" >&5
+@@ -31082,7 +31033,7 @@
+
+ # The pdf backend requires zlib.
+ use_pdf=$have_libz
+- pdf_NONPKGCONFIG_LIBS=-lz
++ pdf_NONPKGCONFIG_LIBS=$ZLIB3RDLIB
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's PDF surface backend feature could be enabled" >&5
+@@ -32973,7 +32924,7 @@
+
+
+ use_xml=$have_libz
+- xml_NONPKGCONFIG_LIBS=-lz
++ xml_NONPKGCONFIG_LIBS=$ZLIB3RDLIB
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's xml surface backend feature could be enabled" >&5
+diff -ruNw misc/cairo-1.10.2/src/cairo.h misc/build/cairo-1.10.2/src/cairo.h
+--- misc/cairo-1.10.2/src/cairo.h 2015-10-27 17:04:21.000000000 -0400
++++ misc/build/cairo-1.10.2/src/cairo.h 2017-12-17 12:09:59.880406411 -0500
+@@ -397,6 +397,8 @@
+ * with red in the upper 5 bits, then green in the middle
+ * 6 bits, and blue in the lower 5 bits. (Since 1.2)
+ * @CAIRO_FORMAT_RGB30: like RGB24 but with 10bpc. (Since 1.12)
++ * @CAIRO_FORMAT_RGB24_888: each pixel is a 24-bit quantity,
++ * with Red, Green, Blue taking 8-bits each, in that order. (Since 1.1x)
+ *
+ * #cairo_format_t is used to identify the memory format of
+ * image data.
+@@ -412,9 +414,16 @@
+ CAIRO_FORMAT_A8 = 2,
+ CAIRO_FORMAT_A1 = 3,
+ CAIRO_FORMAT_RGB16_565 = 4,
+- CAIRO_FORMAT_RGB30 = 5
++ CAIRO_FORMAT_RGB30 = 5,
++ CAIRO_FORMAT_RGB24_888 = 6
+ } cairo_format_t;
+
++/**
++ * Need this until CAIRO_FORMAT_RGB24_888 is in some official release.
++ * Otherwise we can't reliably check if this is available or we should
++ * convert from 24-bit RGB to 32-bit RGB before passing to Cairo.
++ **/
++#define HAVE_CAIRO_FORMAT_RGB24_888
+
+ /**
+ * cairo_write_func_t:
+diff -ruNw misc/cairo-1.10.2/src/cairo-image-source.c misc/build/cairo-1.10.2/src/cairo-image-source.c
+--- misc/cairo-1.10.2/src/cairo-image-source.c 2015-10-27 17:04:30.000000000 -0400
++++ misc/build/cairo-1.10.2/src/cairo-image-source.c 2017-12-17 12:09:56.076344387 -0500
+@@ -508,6 +508,19 @@
+ color.blue = expand_channel(pixel & 0x3fff, 10);
+ return pixman_image_create_solid_fill (&color);
+
++ case CAIRO_FORMAT_RGB24_888:
++ pixel = *(uint32_t *) (image->data + y * image->stride + 3 * x);
++ pixel &= 0x00ffffff; /* ignore next pixel bits */
++ if (pixel == 0)
++ return _pixman_black_image ();
++ if (pixel == 0x00ffffff)
++ return _pixman_white_image ();
++
++ color.red = (pixel >> 16 & 0xff) | (pixel >> 8 & 0xff00);
++ color.green = (pixel >> 8 & 0xff) | (pixel & 0xff00);
++ color.blue = (pixel & 0xff) | (pixel << 8 & 0xff00);
++ return pixman_image_create_solid_fill (&color);
++
+ case CAIRO_FORMAT_ARGB32:
+ case CAIRO_FORMAT_RGB24:
+ pixel = *(uint32_t *) (image->data + y * image->stride + 4 * x);
+diff -ruNw misc/cairo-1.10.2/src/cairo-image-surface.c misc/build/cairo-1.10.2/src/cairo-image-surface.c
+--- misc/cairo-1.10.2/src/cairo-image-surface.c 2015-10-27 17:04:30.000000000 -0400
++++ misc/build/cairo-1.10.2/src/cairo-image-surface.c 2017-12-17 12:09:59.876406346 -0500
+@@ -104,13 +104,15 @@
+ return CAIRO_FORMAT_A1;
+ case PIXMAN_r5g6b5:
+ return CAIRO_FORMAT_RGB16_565;
++ case PIXMAN_r8g8b8:
++ return CAIRO_FORMAT_RGB24_888;
+ #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,22,0)
+ case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8:
+ #endif
+ #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,27,2)
+ case PIXMAN_a8r8g8b8_sRGB:
+ #endif
+- case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
++ case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8:
+ case PIXMAN_b8g8r8: case PIXMAN_b5g6r5:
+ case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
+ case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
+@@ -320,6 +322,9 @@
+ case CAIRO_FORMAT_RGB16_565:
+ ret = PIXMAN_r5g6b5;
+ break;
++ case CAIRO_FORMAT_RGB24_888:
++ ret = PIXMAN_r8g8b8;
++ break;
+ case CAIRO_FORMAT_ARGB32:
+ case CAIRO_FORMAT_INVALID:
+ default:
+@@ -718,6 +723,8 @@
+ case CAIRO_FORMAT_RGB30:
+ case CAIRO_FORMAT_RGB24:
+ return 32;
++ case CAIRO_FORMAT_RGB24_888:
++ return 24;
+ case CAIRO_FORMAT_RGB16_565:
+ return 16;
+ case CAIRO_FORMAT_A8:
+diff -ruNw misc/cairo-1.10.2/src/cairoint.h misc/build/cairo-1.10.2/src/cairoint.h
+--- misc/cairo-1.10.2/src/cairoint.h 2015-10-27 17:04:30.000000000 -0400
++++ misc/build/cairo-1.10.2/src/cairoint.h 2017-12-17 12:09:59.880406411 -0500
+@@ -1486,7 +1486,7 @@
+ * in cairo-xlib-surface.c--again see -Wswitch-enum).
+ */
+ #define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \
+- (format) <= CAIRO_FORMAT_RGB30)
++ (format) <= CAIRO_FORMAT_RGB24_888)
+
+ /* pixman-required stride alignment in bytes. */
+ #define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
diff --git a/external/cairo/cairo/cairo-libtool-rpath.patch.1 b/external/cairo/cairo/cairo-libtool-rpath.patch.1
new file mode 100644
index 000000000..dffa25414
--- /dev/null
+++ b/external/cairo/cairo/cairo-libtool-rpath.patch.1
@@ -0,0 +1,12 @@
+Prevent libtool from adding annoying stuff to RPATH
+
+--- cairo/configure.orig 2018-10-19 22:20:08.000000000 +0200
++++ cairo/configure 2019-09-04 17:53:00.927539686 +0200
+@@ -16592,6 +16592,7 @@
+ esac
+ ;;
+ esac
++hardcode_libdir_flag_spec=
+ ;;
+
+ lynxos*)
diff --git a/external/cairo/cairo/cairo.GL_RGBA.patch b/external/cairo/cairo/cairo.GL_RGBA.patch
new file mode 100644
index 000000000..5f50dd13f
--- /dev/null
+++ b/external/cairo/cairo/cairo.GL_RGBA.patch
@@ -0,0 +1,49 @@
+--- misc/cairo-1.10.2/src/cairo-image-surface.c
++++ misc/cairo-1.10.2/src/cairo-image-surface.c
+@@ -92,11 +92,11 @@
+ _cairo_format_from_pixman_format (pixman_format_code_t pixman_format)
+ {
+ switch (pixman_format) {
+- case PIXMAN_a8r8g8b8:
++ case PIXMAN_a8b8g8r8: //tweaked
+ return CAIRO_FORMAT_ARGB32;
+ case PIXMAN_x2r10g10b10:
+ return CAIRO_FORMAT_RGB30;
+- case PIXMAN_x8r8g8b8:
++ case PIXMAN_x8b8g8r8: //tweaked
+ return CAIRO_FORMAT_RGB24;
+ case PIXMAN_a8:
+ return CAIRO_FORMAT_A8;
+@@ -112,7 +112,7 @@
+ #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,27,2)
+ case PIXMAN_a8r8g8b8_sRGB:
+ #endif
+- case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8:
++ case PIXMAN_a8r8g8b8: case PIXMAN_x8r8g8b8: //tweaked
+ case PIXMAN_b8g8r8: case PIXMAN_b5g6r5:
+ case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
+ case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
+@@ -314,7 +314,7 @@
+ ret = PIXMAN_a8;
+ break;
+ case CAIRO_FORMAT_RGB24:
+- ret = PIXMAN_x8r8g8b8;
++ ret = PIXMAN_x8b8g8r8; //tweaked
+ break;
+ case CAIRO_FORMAT_RGB30:
+ ret = PIXMAN_x2r10g10b10;
+@@ -323,12 +323,12 @@
+ ret = PIXMAN_r5g6b5;
+ break;
+ case CAIRO_FORMAT_RGB24_888:
+- ret = PIXMAN_r8g8b8;
++ ret = PIXMAN_b8g8r8; // tweaked
+ break;
+ case CAIRO_FORMAT_ARGB32:
+ case CAIRO_FORMAT_INVALID:
+ default:
+- ret = PIXMAN_a8r8g8b8;
++ ret = PIXMAN_a8b8g8r8; //tweaked
+ break;
+ }
+ return ret;
diff --git a/external/cairo/cairo/dummy_pkg_config b/external/cairo/cairo/dummy_pkg_config
new file mode 100755
index 000000000..829303ea5
--- /dev/null
+++ b/external/cairo/cairo/dummy_pkg_config
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+
diff --git a/external/cairo/pixman/Makefile.win32.common b/external/cairo/pixman/Makefile.win32.common
new file mode 100644
index 000000000..30b94e7b1
--- /dev/null
+++ b/external/cairo/pixman/Makefile.win32.common
@@ -0,0 +1,54 @@
+LIBRARY = pixman-1
+
+CC = cl
+LD = link
+AR = lib
+PERL = perl
+
+ifeq ($(top_builddir),)
+top_builddir = $(top_srcdir)
+endif
+
+CFG_VAR = $(CFG)
+ifeq ($(CFG_VAR),)
+CFG_VAR = release
+endif
+
+ifeq ($(CFG_VAR),debug)
+CFG_CFLAGS = -MD -Od -Zi
+CFG_LDFLAGS = -DEBUG
+else
+CFG_CFLAGS = -MD -O2
+CFG_LDFLAGS =
+endif
+
+# Package definitions, to be used instead of those provided in config.h
+PKG_CFLAGS = -DPACKAGE=$(LIBRARY) -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT=""
+
+BASE_CFLAGS = -nologo -I. -I$(top_srcdir) -I$(top_srcdir)/pixman
+
+PIXMAN_CFLAGS = $(BASE_CFLAGS) $(PKG_CFLAGS) $(CFG_CFLAGS) $(CFLAGS)
+PIXMAN_LDFLAGS = -nologo $(CFG_LDFLAGS) $(LDFLAGS)
+PIXMAN_ARFLAGS = -nologo $(LDFLAGS)
+
+
+inform:
+ifneq ($(CFG),release)
+ifneq ($(CFG),debug)
+ifneq ($(CFG),)
+ @echo "Invalid specified configuration option: "$(CFG)"."
+ @echo
+ @echo "Possible choices for configuration are 'release' and 'debug'"
+ @exit 1
+endif
+ @echo "Using default RELEASE configuration... (use CFG=release or CFG=debug)"
+endif
+endif
+
+
+$(CFG_VAR)/%.obj: %.c $(BUILT_SOURCES)
+ @mkdir -p $(CFG_VAR)
+ @$(CC) -c $(PIXMAN_CFLAGS) -Fo"$@" $<
+
+clean: inform
+ @$(RM) $(CFG_VAR)/*.{exe,ilk,lib,obj,pdb} $(BUILT_SOURCES) || exit 0
diff --git a/external/cairo/pixman/pixman-0.24.4.patch b/external/cairo/pixman/pixman-0.24.4.patch
new file mode 100644
index 000000000..6d871e37b
--- /dev/null
+++ b/external/cairo/pixman/pixman-0.24.4.patch
@@ -0,0 +1,91 @@
+--- misc/pixman-0.24.4/Makefile.in 2011-11-06 22:11:25.000000000 +0100
++++ misc/build/pixman-0.24.4/Makefile.in 2011-12-16 09:06:45.317211035 +0100
+@@ -272,7 +272,7 @@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = pixman demos test
++SUBDIRS = pixman
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = pixman-1.pc
+ GPGKEY = 3892336E
+--- misc/pixman-0.24.4/pixman/pixman-utils.c
++++ misc/build/pixman-0.24.4/pixman/pixman-utils.c
+@@ -27,6 +27,7 @@
+ #endif
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <limits.h>
+
+ #include "pixman-private.h"
+
+--- misc/pixman-0.24.4/pixman/pixman-glyph.c 2015-06-30 05:48:31.000000000 -0400
++++ misc/build/pixman-0.24.4/pixman/pixman-glyph.c 2017-11-25 13:26:33.075558418 -0500
+@@ -38,6 +38,7 @@
+
+ /* XXX: These numbers are arbitrary---we've never done any measurements.
+ */
++#define N_PIXELS_HIGH_WATER (4 * 1024 * 1024)
+ #define N_GLYPHS_HIGH_WATER (16384)
+ #define N_GLYPHS_LOW_WATER (8192)
+ #define HASH_SIZE (2 * N_GLYPHS_HIGH_WATER)
+@@ -58,6 +59,7 @@
+ int n_glyphs;
+ int n_tombstones;
+ int freeze_count;
++ long n_pixels;
+ pixman_list_t mru;
+ glyph_t * glyphs[HASH_SIZE];
+ };
+@@ -133,6 +135,7 @@
+ if (*loc == TOMBSTONE)
+ cache->n_tombstones--;
+ cache->n_glyphs++;
++ cache->n_pixels += glyph->image->bits.width * glyph->image->bits.height;
+
+ *loc = glyph;
+ }
+@@ -150,6 +153,7 @@
+ cache->glyphs[idx & HASH_MASK] = TOMBSTONE;
+ cache->n_tombstones++;
+ cache->n_glyphs--;
++ cache->n_pixels -= glyph->image->bits.width * glyph->image->bits.height;
+
+ /* Eliminate tombstones if possible */
+ if (cache->glyphs[(idx + 1) & HASH_MASK] == NULL)
+@@ -180,6 +184,7 @@
+
+ cache->n_glyphs = 0;
+ cache->n_tombstones = 0;
++ cache->n_pixels = 0;
+ }
+
+ PIXMAN_EXPORT pixman_glyph_cache_t *
+@@ -194,6 +199,7 @@
+ cache->n_glyphs = 0;
+ cache->n_tombstones = 0;
+ cache->freeze_count = 0;
++ cache->n_pixels = 0;
+
+ pixman_list_init (&cache->mru);
+
+@@ -220,9 +226,9 @@
+ pixman_glyph_cache_thaw (pixman_glyph_cache_t *cache)
+ {
+ if (--cache->freeze_count == 0 &&
+- cache->n_glyphs + cache->n_tombstones > N_GLYPHS_HIGH_WATER)
++ (cache->n_glyphs + cache->n_tombstones > N_GLYPHS_HIGH_WATER || cache->n_pixels > N_PIXELS_HIGH_WATER))
+ {
+- if (cache->n_tombstones > N_GLYPHS_HIGH_WATER)
++ if (cache->n_tombstones > N_GLYPHS_LOW_WATER)
+ {
+ /* More than half the entries are
+ * tombstones. Just dump the whole table.
+@@ -230,7 +236,7 @@
+ clear_table (cache);
+ }
+
+- while (cache->n_glyphs > N_GLYPHS_LOW_WATER)
++ while (cache->n_glyphs > N_GLYPHS_LOW_WATER || cache->n_pixels > N_PIXELS_HIGH_WATER)
+ {
+ glyph_t *glyph = CONTAINER_OF (glyph_t, mru_link, cache->mru.tail);
diff --git a/external/cairo/pixman/pixman-ofz4372.patch b/external/cairo/pixman/pixman-ofz4372.patch
new file mode 100644
index 000000000..aaf83f11d
--- /dev/null
+++ b/external/cairo/pixman/pixman-ofz4372.patch
@@ -0,0 +1,16 @@
+--- misc/pixman/pixman/pixman-solid-fill.c
++++ misc/build/pixman/pixman/pixman-solid-fill.c
+@@ -30,10 +30,10 @@ static uint32_t
+ color_to_uint32 (const pixman_color_t *color)
+ {
+ return
+- (color->alpha >> 8 << 24) |
+- (color->red >> 8 << 16) |
++ ((uint32_t)color->alpha >> 8 << 24) |
++ ((uint32_t)color->red >> 8 << 16) |
+ (color->green & 0xff00) |
+- (color->blue >> 8);
++ ((uint32_t)color->blue >> 8);
+ }
+
+ static argb_t
diff --git a/external/cairo/pixman/pixman-ubsan.patch b/external/cairo/pixman/pixman-ubsan.patch
new file mode 100644
index 000000000..583706ae1
--- /dev/null
+++ b/external/cairo/pixman/pixman-ubsan.patch
@@ -0,0 +1,33 @@
+--- misc/pixman/pixman/pixman.h
++++ misc/build/pixman/pixman/pixman.h
+@@ -127,7 +127,7 @@
+ #define pixman_fixed_1_minus_e (pixman_fixed_1 - pixman_fixed_e)
+ #define pixman_fixed_minus_1 (pixman_int_to_fixed(-1))
+ #define pixman_fixed_to_int(f) ((int) ((f) >> 16))
+-#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) << 16))
++#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) * (1 << 16)))
+ #define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1)
+ #define pixman_double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0))
+ #define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e)
+--- misc/pixman/pixman/pixman-fast-path.c
++++ misc/build/pixman/pixman/pixman-fast-path.c
+@@ -2836,7 +2836,7 @@
+ sgtot = CLIP (sgtot, 0, 0xff);
+ sbtot = CLIP (sbtot, 0, 0xff);
+
+- buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
++ buffer[k] = ((uint32_t)satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
+
+ next:
+ vx += ux;
+--- misc/pixman/pixman/pixman-bits-image.c
++++ misc/build/pixman/pixman/pixman-bits-image.c
+@@ -306,7 +306,7 @@
+ sgtot = CLIP (sgtot, 0, 0xff);
+ sbtot = CLIP (sbtot, 0, 0xff);
+
+- return ((satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot));
++ return (((uint32_t)satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot));
+ }
+
+ static force_inline uint32_t