summaryrefslogtreecommitdiff
path: root/recipes/fontconfig.recipe
blob: 2fa875b2d0d15a23fada55f4fe8e3f69173d3ba0 (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
55
56
57
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import os
from cerbero.tools.libtool import LibtoolLibrary
from cerbero.tools.libtool import get_libtool_versions

class Recipe(recipe.Recipe):
    name = 'fontconfig'
    version = '2.13.93'
    stype = SourceType.TARBALL
    url = 'https://www.freedesktop.org/software/fontconfig/release/fontconfig-%(version)s.tar.gz'
    tarball_checksum = '0f302a18ee52dde0793fe38b266bf269dfe6e0c0ae140e30d72c6cca5dc08db5'
    licenses = [{License.MIT: ['COPYING']}]
    btype = BuildType.MESON
    meson_options = {'doc': 'disabled', 'tests': 'disabled', 'tools': 'disabled'}
    deps = ['expat', 'freetype', 'zlib', 'bzip2']
    patches = [
        # From git master post-2.13.93
        'fontconfig/0001-meson-error-out-in-script-if-gperf-preprocessing-fai.patch',
        # https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/138/
        'fontconfig/0001-handle-absolute-sysconfdir-when-installing-symlinks.patch',
        # https://gitlab.freedesktop.org/fontconfig/fontconfig/-/merge_requests/165
        'fontconfig/0001-meson-fix-cross-compilation-issues-with-gperf-header.patch',
        # From git master post-2.13.93
        'fontconfig/0001-Windows-Fix-symlink-privilege-error-detection.patch',
        'fontconfig/0001-Overwrite-symlinks-for-config-files.patch',
    ]

    files_libs = ['libfontconfig']
    files_etc = [
        'etc/fonts/conf.d',
        'etc/fonts/fonts.conf',
        'share/fontconfig'
        ]
    files_devel = ['lib/pkgconfig/fontconfig.pc', 'include/fontconfig']


    def prepare(self):
        if self.config.target_platform in (Platform.WINDOWS, Platform.ANDROID):
            self.deps.append('libiconv')

    def post_install(self):
        # Meson does not generate la files
        major, minor, micro = get_libtool_versions(self.version)
        libtool_la = LibtoolLibrary('fontconfig', major, minor, micro,
                                    self.config.libdir, self.config.target_platform,
                                    deps=['expat', 'freetype', 'bz2', 'z'])
        libtool_la.save()
        # Create relative symlinks to prevent breakage during packaging
        if self.config.platform != Platform.WINDOWS:
            confddir = os.path.join(self.config.prefix, 'etc', 'fonts', 'conf.d')
            linksrc = os.path.join('..', '..', '..', 'share', 'fontconfig', 'conf.avail')
            for f in os.listdir(confddir):
                if not f.endswith('.conf'):
                    continue
                os.remove(os.path.join(confddir, f))
                os.symlink(os.path.join(linksrc, f), os.path.join(confddir, f))
        super().post_install()