# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.tools.libtool import LibtoolLibrary from cerbero.tools.libtool import get_libtool_versions class Recipe(recipe.Recipe): name = 'cairo' version = '1.18.0' stype = SourceType.TARBALL url = 'https://cairographics.org/releases/cairo-%(version)s.tar.xz' tarball_checksum = '243a0736b978a33dee29f9cca7521733b78a65b5418206fef7bd1c3d4cf10b64' # Either LGPL-2.1+ or MPL-1.1 licenses = [License.LGPLv2_1Plus, {License.MPLv1_1: ['COPYING-MPL-1.1']}] deps = ['glib', 'libpng', 'zlib', 'pixman', 'fontconfig', 'freetype'] btype = BuildType.MESON meson_options = { 'fontconfig': 'enabled', 'freetype': 'enabled', 'tests': 'disabled', 'xcb': 'disabled', 'xlib': 'disabled'} patches = [ 'cairo/0001-cairo-ps-surface-fix-Walloc-size.patch', 'cairo/0001-Copy-font-options-during-creation-of-a-fallback-font.patch', 'cairo/0001-Fix-alloca-undefined-with-MSVC.patch', 'cairo/0001-Fix-surface-type-mismatch-error-in-pdf-interchange.patch', 'cairo/0001-quartz-Fix-Cairo-1.18.0-doesn-t-draw-italic-or-bold-.patch', 'cairo/0001-util-remove-malloc-stats.patch', ] files_libs = ['libcairo', 'libcairo-gobject', 'libcairo-script-interpreter'] files_devel = [ '%(libdir)s/pkgconfig/cairo-fc.pc', '%(libdir)s/pkgconfig/cairo.pc', '%(libdir)s/pkgconfig/cairo-ps.pc', '%(libdir)s/pkgconfig/cairo-ft.pc', '%(libdir)s/pkgconfig/cairo-pdf.pc', '%(libdir)s/pkgconfig/cairo-svg.pc', '%(libdir)s/pkgconfig/cairo-gobject.pc', '%(libdir)s/pkgconfig/cairo-png.pc', 'include/cairo', ] platform_files_devel = { Platform.WINDOWS: [ '%(libdir)s/pkgconfig/cairo-win32-font.pc', '%(libdir)s/pkgconfig/cairo-win32.pc'], Platform.DARWIN: ['%(libdir)s/pkgconfig/cairo-quartz-font.pc', '%(libdir)s/pkgconfig/cairo-quartz-image.pc', '%(libdir)s/pkgconfig/cairo-quartz.pc'] } def prepare(self): # extra flags needed for gcc 4.9 if self.config.target_distro == Distro.ARCH: self.append_env('CFLAGS', '-fno-lto') self.append_env('CXXFLAGS', '-fno-lto') self.append_env('CPPFLAGS', '-fno-lto') # Unclear if anything actually needs this # cerbero fedora CI seems misconfigured if x11 variant is enabled but xlib not actually installed #if self.config.variants.x11: # self.meson_options['xlib'] = 'enabled' # self.meson_options['xcb'] = 'auto' # self.files_devel += ['%(libdir)s/pkgconfig/cairo-xlib-xrender.pc', # '%(libdir)s/pkgconfig/cairo-xlib.pc'] if self.config.target_platform == Platform.DARWIN: self.meson_options['quartz'] = 'enabled' # Our mingw is too old for this if not self.using_msvc(): self.meson_options['dwrite'] = 'disabled' def post_install(self): # Meson does not generate la files libtool_la = LibtoolLibrary('libcairo', None, None, None, self.config.libdir, self.config.target_platform, deps=['gobject-2.0', 'pixman-1', 'freetype', 'fontconfig', 'png16', 'z']) libtool_la.save() libtool_la = LibtoolLibrary('libcairo-gobject', None, None, None, self.config.libdir, self.config.target_platform, deps=['cairo', 'gobject-2.0', 'pixman-1', 'freetype', 'fontconfig', 'png16', 'z']) libtool_la.save() super().post_install()