summaryrefslogtreecommitdiff
path: root/recipes/gst-android-1.0.recipe
blob: c4df6bf8c7b52ee4507d01f968f36ed52270286e (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import os
import shutil
from cerbero.utils import shell
from custom import list_gstreamer_1_0_plugins_by_category

class Recipe(recipe.Recipe):
    name = 'gst-android-1.0'
    version = '0.1'
    licenses = [License.LGPLv2_1Plus]
    stype = SourceType.CUSTOM
    btype = BuildType.CUSTOM
    deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0',
        'gst-plugins-ugly-1.0', 'gst-plugins-bad-1.0', 'gst-libav-1.0',
        'gst-devtools-1.0', 'gst-rtsp-server-1.0', 'gst-editing-services-1.0'
    ]

    files_devel = [
        'share/gst-android/ndk-build/gstreamer_android-1.0.c.in',
        'share/gst-android/ndk-build/gstreamer-1.0.mk',
        'share/gst-android/ndk-build/gstreamer_prebuilt.mk',
        'share/gst-android/ndk-build/tools.mk',
        'share/gst-android/ndk-build/plugins.mk',
        'share/gst-android/ndk-build/tools',
        'share/gst-android/ndk-build/fontconfig',
    ]

    def prepare(self):
        if self.config.variants.rust:
            self.deps.append('gst-plugins-rs')

    async def install(self):
        ndk_build_dir_dst = os.path.join(self.config.prefix, 'share', 'gst-android', 'ndk-build')
        if not os.path.exists(ndk_build_dir_dst):
            os.makedirs(ndk_build_dir_dst)
        ndk_build_dir_src = os.path.join(self.config.data_dir, 'ndk-build')
        for f in self.files_devel:
            fname = os.path.basename(f)
            s = os.path.join(ndk_build_dir_src, fname)
            d = os.path.join(ndk_build_dir_dst, fname)
            if os.path.isfile(s):
                shutil.copy(s, d)
            else:
                shell.copy_dir(s, d)

        plugins = list_gstreamer_1_0_plugins_by_category(self.config)
        f = open(os.path.join(ndk_build_dir_dst, 'plugins.mk'), 'w')
        for c, p in plugins.items():
            p = ' '.join(p)
            f.write('GSTREAMER_PLUGINS_%s := %s\n' % (c.upper(), p))
        f.close()