summaryrefslogtreecommitdiff
path: root/recipes/librsvg.recipe
blob: f89ea567b33c8201b8d021c13d6f1514c0bcdd04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python

from pathlib import Path

class Recipe(recipe.Recipe):
    name = 'librsvg'
    version = '2.40.20'
    licenses = [License.LGPLv2Plus]
    deps = ['libcroco', 'gdk-pixbuf', 'pango', 'cairo']
    stype = SourceType.TARBALL
    url = 'gnome://'
    tarball_checksum = 'cff4dd3c3b78bfe99d8fcfad3b8ba1eee3289a0823c0e118d78106be6b84c92b'

    files_libs = ['librsvg-2']
    files_bins = ['rsvg-convert']
    licenses_bins = [License.GPLv2Plus]
    files_loader = ['lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg%(mext)s']
    files_devel = ['include/librsvg-2.0/librsvg/*.h',
                   'lib/pkgconfig/librsvg-2.0.pc',
                   'lib/librsvg-2.a', 'lib/librsvg-2.la']
    files_typelibs = ['Rsvg-2.0']

    patches = ['librsvg/0001-build-Fix-enumtypes-on-MinGW-inside-MSYS-Windows.patch']

    def prepare(self):
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            self.configure_options += ' --disable-Bsymbolic'
        # Fails on cross-ios and cross-win32
        if self.config.cross_compiling():
            self.configure_options += ' --disable-pixbuf-loader'
            self.files_loader.clear()

        if self.config.platform != Platform.WINDOWS:
            # GTK3 support just builds rsvg-view-3, which is useless for Cerbero
            self.configure_options += ' --without-gtk3 '
            self.autoreconf = True
            self.autoreconf_sh = 'mkdir -p m4 && autoreconf -fiv'
            self.patches += [
                'librsvg/option-enable-disable-gtk.patch',
                'librsvg/0001-Use-ACLOCAL_FLAGS.patch',
            ]
        else:
            self.autoreconf = False
               

    async def compile(self):
        # glib-mkenums has #!/usr/bin/env python3, which looks for `python3`,
        # but on Windows Python 3 is `python.exe`. Meson already handles this
        # for us, but Autotools can't.
        # NOTE: Remove this when the recipe is ported to Meson.
        if self.config.platform == Platform.WINDOWS:
            with (Path(self.build_dir) / 'python3').open('w') as f:
                f.write('#!/bin/sh\n"{}" "$@"'.format(self.config.python_exe))
        await super().compile()