summaryrefslogtreecommitdiff
path: root/recipes/libvpx.recipe
blob: 0985d049fbda9b4333bd96564b81890cc3e71b95 (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
62
63
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.utils import shell
from cerbero.utils import messages as m
from cerbero.tools.libtool import LibtoolLibrary
import os
import shutil

class Recipe(recipe.Recipe):
    name = 'libvpx'
    version = 'v1.13.1'
    stype = SourceType.TARBALL
    url = 'https://github.com/webmproject/libvpx/archive/%(version)s.tar.gz'
    tarball_dirname = 'libvpx-' + version[1:]
    tarball_checksum = '00dae80465567272abd077f59355f95ac91d7809a2d3006f9ace2637dd429d14'
    licenses = [{License.BSD: ['LICENSE'], License.Misc: ['PATENTS']}]

    btype = BuildType.MESON
    library_type = LibraryType.STATIC
    meson_options = {
        'size_limit': '16384x16384',
        'unit_tests': 'disabled',
        'postproc': 'enabled',
        'multi_res_encoding': 'enabled',
        'temporal_denoising': 'enabled',
        'vp9_temporal_denoising': 'enabled',
        'vp9_postproc': 'enabled',
        'vp9_highbitdepth': 'enabled',
        'tools': 'disabled',
        'examples': 'disabled',
        'docs': 'disabled',
    }

    patches = [
        'libvpx/0001-Fix-implicit-argument-conversion-on-UWP.patch',
        'libvpx/0002-vp9_diamond_search_sad_neon-use-DECLARE_ALIGNED.patch',
        'libvpx/0003-Add-Meson-build.patch',
    ]

    files_libs = ['libvpx']
    files_devel = ['include/vpx', '%(libdir)s/pkgconfig/vpx.pc']

    def prepare(self):
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            # make sure the linker uses the correct stdlib when building with
            # 10.13 which makes the usage of libstdc++ a hard error.
            self.append_env('LDFLAGS', '-stdlib=libc++')
        if self.config.target_platform == Platform.DARWIN:
            self.library_type = LibraryType.SHARED
        elif self.config.target_platform == Platform.IOS:
            self.library_type = LibraryType.STATIC
        elif self.config.target_platform == Platform.WINDOWS:
            self.library_type = LibraryType.STATIC
        elif self.config.target_platform == Platform.ANDROID:
            self.library_type = LibraryType.STATIC
            # See https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/71
            self.meson_options['cpu_features_path'] = os.path.join(self.config.toolchain_prefix, 'sources', 'android', 'cpufeatures')

    def post_install(self):
        # Meson does not generate la files
        LibtoolLibrary('vpx', None, None, None,
                       self.config.libdir, self.config.target_platform,
                       static_only=self.library_type == LibraryType.STATIC).save()
        super().post_install()