summaryrefslogtreecommitdiff
path: root/recipes/fontconfig.recipe
blob: 2bb4eca6d982bac9ca1e453ab91f605e7d17f26b (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python

import os

class Recipe(recipe.Recipe):
    name = 'fontconfig'
    version = '2.11.1'
    stype = SourceType.TARBALL
    url = 'http://www.freedesktop.org/software/fontconfig/release/fontconfig-%(version)s.tar.gz'
    licenses = [License.MIT]
    configure_options = '--disable-docs'
    deps = ['expat', 'freetype', 'zlib', 'bzip2']
    patches = ['fontconfig/0001-Ensure-we-use-our-installed-headers-instead-of-syste.patch',
               'fontconfig/0002-Port-to-Android.patch',
               'fontconfig/0003-configure-Allow-static-build.patch']

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

    autoreconf = True

    def prepare(self):
        if self.config.target_platform == Platform.WINDOWS:
            if self.config.target_arch == Architecture.X86_64:
                self.configure_options += ' --with-arch=x86_64 '
            else:
                self.configure_options += ' --with-arch=i686 '

    def post_install(self):
        # Create relative symlinks to prevent breakage during packaging
        if self.config.target_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))