summaryrefslogtreecommitdiff
path: root/recipes/pixman.recipe
blob: 7276222f8ea46ac69908121bc4a8f282f19a447f (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
58
59
60
61
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python

from cerbero.utils import messages as m
import shutil

from cerbero.tools.libtool import LibtoolLibrary

class Recipe(recipe.Recipe):
    name = 'pixman'
    version = '0.43.2'
    stype = SourceType.TARBALL
    btype = BuildType.MESON
    url = 'https://www.x.org/releases/individual/lib/pixman-%(version)s.tar.xz'
    tarball_checksum = 'b43dc9549c02c598fb11321d6fca47151f739a076c73fcd8971b5c023a06949e'
    meson_options = {'openmp': 'disabled',
                     'gtk': 'disabled',
                     'libpng': 'disabled',
                     'demos' : 'disabled',
                     'tests' : 'disabled'}
    licenses = [{License.MIT: ['COPYING']}]
    patches = []

    files_libs = ['libpixman-1']
    files_devel = ['include/pixman-1', '%(libdir)s/pkgconfig/pixman-1.pc']

    def prepare(self):
        # clang from xcode has a known bug, avoid codepath that trigger it
        # More info : https://github.com/Homebrew/homebrew/issues/41056
        if self.config.target_platform in [ Platform.DARWIN, Platform.IOS ] and \
           self.config.target_arch in [ Architecture.X86, Architecture.X86_64 ]:
            self.meson_options['mmx'] = 'disabled'
        if self.config.target_platform == Platform.IOS:
            self.append_env('CFLAGS', '-DPIXMAN_NO_TLS')
        if self.config.target_platform == Platform.ANDROID:
            # FIXME: Fails to link because of undefined __builtin_* symbols
            self.meson_options['iwmmxt'] = 'disabled'
            if self.config.target_arch in [Architecture.ARMv7, Architecture.ARM64]:
                # Needs https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/78/
                self.meson_options['neon'] = 'disabled'
                self.meson_options['arm-simd'] = 'disabled'
                if self.config.target_arch == Architecture.ARM64:
                    self.meson_options['a64-neon'] = 'enabled'
            self.meson_options['cpu-features-path'] = os.path.join(self.config.toolchain_prefix, 'sources', 'android', 'cpufeatures')
            # Prevent symbol conflicts
            self.append_env('CFLAGS',
                '-Dandroid_getCpuFamily=pixman_android_getCpuFamily',
                '-Dandroid_getCpuFeatures=pixman_android_getCpuFeatures',
                '-Dandroid_getCpuCount=pixman_android_getCpuCount',
                '-Dandroid_cpuInit=pixman_android_cpuInit',
                '-Dandroid_cpuInitDummy=pixman_android_cpuInitDummy',
                '-Dandroid_getCpuIdArm=pixman_android_getCpuIdArm',
                '-Dandroid_setCpu=pixman_android_setCpu',
                '-Dandroid_setCpuArm=pixman_android_setCpuArm')

    def post_install(self):
        pixman_deps = []
        # Meson does not generate la files
        LibtoolLibrary('pixman-1', None, None, None,
                self.config.libdir, self.config.target_platform,
                deps=pixman_deps).save()
        super().post_install()