gstreamer-1.0-osx-framework.recipe 1.75 KB
Newer Older
1
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
2
3
4
import re
import shutil
from cerbero.utils.shell import async_call_output
5
6
7
8
9
10
11
from cerbero.ide.xcode.fwlib import DynamicFrameworkLibrary

class Recipe(recipe.Recipe):
    name = 'gstreamer-1.0-osx-framework'
    version = '0.1'
    stype = SourceType.CUSTOM
    btype = BuildType.CUSTOM
12
    deps = ['pkg-config', 'gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-bad-1.0']
13
14
15

    files_library = ['lib/GStreamer']

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    async def _get_installed_gst_libs(self):
        args = [self.env['PKG_CONFIG'], '--list-all']
        out = await async_call_output(args, logfile=self.logfile, cpu_bound=False, env=self.env)
        gstlibs = []
        gstlib_regex = re.compile(r'^(gstreamer-.*1\.0)\s+')
        for line in out.split('\n'):
            m = gstlib_regex.search(line)
            # Not a gstreamer pkgconfig file
            if not m:
                continue
            gstlib = m.groups()[0]
            # Not a gstreamer library pkgconfig file
            if 'gstreamer-plugins-' in gstlib:
                continue
            # The gst-rtsp-server library should not be in this; only core,
            # base, and bad libraries are allowed.
            if 'rtsp-server' in gstlib:
                continue
            gstlibs.append(gstlib)
        return gstlibs

37
    async def install(self):
38
        install_name = os.path.join(self.config.prefix, 'lib', 'GStreamer')
39
40
41
        libs = await self._get_installed_gst_libs()
        if not libs:
            raise FatalError('No gstreamer libraries were found in the prefix!')
42
        fwlib = DynamicFrameworkLibrary(self.config.min_osx_sdk_version, self.config.target_distro, install_name, install_name, libs, self.config.target_arch, env=self.env)
43
        fwlib.create()