# -*- 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.17.4' stype = SourceType.TARBALL #url = 'https://cairographics.org/releases/cairo-%(version)s.tar.xz' url = 'https://cairographics.org/snapshots/cairo-%(version)s.tar.xz' tarball_checksum = '74b24c1ed436bbe87499179a3b27c43f4143b8676d8ad237a6fa787401959705' # 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 = {'tests': 'disabled', 'xcb': 'disabled', 'xlib': 'disabled'} patches = [ # From git master, post 1.17.4 snapshot release 'cairo/0001-meson-fix-library-versioning.patch', 'cairo/0001-meson-fix-macOS-build-and-add-macOS-ci.patch', 'cairo/0001-meson-Generate-cairo-script-interpreter.pc-needed-by.patch', # TODO: This should probably be rewritten along the same lines as in # https://gitlab.freedesktop.org/cairo/cairo/-/commit/9a19ef185884da1e7d5344b301f48aa2ba0f88b6 # but unclear if it's still a problem with newer Android (api 28 CI works) 'cairo/0001-Fix-compilation-with-Android-s-bionic-libc.patch', # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/38 'cairo/0001-win32-Make-font-dc-thread-local.patch', # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/110/ 'cairo/0001-meson-only-build-cairo-boilerplate-and-cairo-missing.patch', # FIXME: remove once freetype recipe has been moved to Meson as well 'cairo/0001-cairo-ft-font-fix-build-with-MSVC-if-freetype-was-bu.patch', # https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/151 'cairo/0001-atomic-Add-support-for-WIN32-atomic-operations.patch', ] files_libs = ['libcairo', 'libcairo-gobject', 'libcairo-script-interpreter'] files_devel = [ 'lib/pkgconfig/cairo-fc.pc', 'lib/pkgconfig/cairo.pc', 'lib/pkgconfig/cairo-ps.pc', 'lib/pkgconfig/cairo-ft.pc', 'lib/pkgconfig/cairo-pdf.pc', 'lib/pkgconfig/cairo-svg.pc', 'lib/pkgconfig/cairo-gobject.pc', 'lib/pkgconfig/cairo-png.pc', 'include/cairo', ] platform_files_devel = { Platform.WINDOWS: [ 'lib/pkgconfig/cairo-win32-font.pc', 'lib/pkgconfig/cairo-win32.pc'], Platform.DARWIN: ['lib/pkgconfig/cairo-quartz-font.pc', 'lib/pkgconfig/cairo-quartz-image.pc', 'lib/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 += ['lib/pkgconfig/cairo-xlib-xrender.pc', # 'lib/pkgconfig/cairo-xlib.pc'] if self.config.target_platform == Platform.DARWIN: self.meson_options['quartz'] = 'enabled' 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()