summaryrefslogtreecommitdiff
path: root/recipes/gstreamer-1.0.recipe
blob: cc0b4407936ab4576e111ec57748f34d36b05a32 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
import shutil

GST_CONFIG_UNVERSAL='''\
#ifdef __i386__
#include "i386/gstconfig.h"
#elif defined(__ppc__)
#include "ppc/gstconfig.h"
#elif defined(__x86_64__)
#include "x86_64/gstconfig.h"
#elif defined(__arm__)
#include "arm/gstconfig.h"
#elif defined(__arm64__)
#include "arm64/gstconfig.h"
#else
#error "Unsupported Architecture"
#endif
'''

class Recipe(recipe.Recipe):
    name = 'gstreamer-1.0'
    version = '1.7'
    licenses = [License.LGPLv2_1Plus]
    config_sh = 'sh ./autogen.sh --noconfigure && ./configure'
    configure_options = "--enable-static --program-prefix= --disable-examples "
    remotes = {'origin': 'git://anongit.freedesktop.org/gstreamer/gstreamer'}
    commit = 'origin/master'
    deps = ['glib', 'gtk-doc-lite']

    files_bins = ['gst-inspect-1.0',
                  'gst-typefind-1.0',
                  'gst-launch-1.0']

    files_libs = ['libgstbase-1.0', 'libgstcontroller-1.0',
                  'libgstnet-1.0', 'libgstreamer-1.0']

    platform_files_libs = {
        Platform.LINUX: ['libgstcheck-1.0'],
        Platform.ANDROID: ['libgstcheck-1.0'],
        Platform.DARWIN: ['libgstcheck-1.0'],
    }

    files_plugins_core = ['lib/gstreamer-1.0/libgstcoreelements%(mext)s']

    files_misc = ['libexec/gstreamer-1.0/gst-plugin-scanner%(bext)s']

    platform_files_misc = {
        Platform.LINUX: ['libexec/gstreamer-1.0/gst-ptp-helper%(bext)s'],
        Platform.DARWIN: ['libexec/gstreamer-1.0/gst-ptp-helper%(bext)s'],
    }

    files_devel = [
            'include/gstreamer-1.0/gst/*.h',
            'include/gstreamer-1.0/gst/base',
            'include/gstreamer-1.0/gst/controller',
            'include/gstreamer-1.0/gst/net',
            'lib/gstreamer-1.0/include/gst/*.h',
            'lib/pkgconfig/gstreamer-1.0.pc',
            'lib/pkgconfig/gstreamer-base-1.0.pc',
            'lib/pkgconfig/gstreamer-controller-1.0.pc',
            'lib/pkgconfig/gstreamer-net-1.0.pc',
    ]

    platform_files_devel = {
        Platform.LINUX: ['include/gstreamer-1.0/gst/check', 'lib/pkgconfig/gstreamer-check-1.0.pc', 'share/aclocal/gst-element-check-1.0.m4'],
        Platform.ANDROID: ['include/gstreamer-1.0/gst/check', 'lib/pkgconfig/gstreamer-check-1.0.pc', 'share/aclocal/gst-element-check-1.0.m4'],
        Platform.DARWIN: ['include/gstreamer-1.0/gst/check', 'lib/pkgconfig/gstreamer-check-1.0.pc', 'share/aclocal/gst-element-check-1.0.m4'],
    }

    files_lang = ['gstreamer-1.0']

    files_typelibs = [
        'Gst-1.0',
        'GstBase-1.0',
        'GstCheck-1.0',
        'GstController-1.0',
        'GstNet-1.0'
        ]


    def prepare(self):
        self.append_env['CFLAGS'] = " -Wno-error "
        self.append_env['CXXFLAGS'] = " -Wno-error "
        self.append_env['CPPFLAGS'] = " -Wno-error "
        if self.config.target_platform != Platform.LINUX:
            self.configure_options += ' --disable-gtk-doc --disable-docbook'

        if self.config.target_platform == Platform.IOS:
            # iOS only supports static builds so plugins must be linked
            # and registered statically.
            self.configure_options += ' --disable-registry '

        if self.config.variants.nodebug:
            self.append_env['CFLAGS'] += ' -DGST_LEVEL_MAX=GST_LEVEL_FIXME'

        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            arch = self.config.target_arch
            if arch == Architecture.X86:
                arch = 'i386'
            elif arch == Architecture.ARM64:
                arch = 'arm64'
            elif Architecture.is_arm(arch):
                arch = 'arm'
            self.files_devel.append(os.path.join('lib', 'gstreamer-1.0', 'include', 'gst', '*', 'gstconfig.h'))

    def post_install(self):
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            # For the universal build we need to ship gstconfig.h of both
            # architectures in a subfolder and include the correct one depending
            # on the compiler architecture
            arch = self.config.target_arch
            if arch == Architecture.X86:
                arch = 'i386'
            elif arch == Architecture.ARM64:
                arch = 'arm64'
            elif Architecture.is_arm(arch):
                arch = 'arm'

            arch_dir = os.path.join(self.config.prefix, 'lib', 'gstreamer-1.0',
                                     'include', 'gst', arch)
            if not os.path.exists(arch_dir):
                os.makedirs(arch_dir)
            shutil.copyfile(os.path.join(self.build_dir, 'gst', 'gstconfig.h'),
                        os.path.join(arch_dir, 'gstconfig.h'))
            with open(os.path.join(self.config.prefix, 'lib', 'gstreamer-1.0',
                                   'include', 'gst', 'gstconfig.h'), 'w+') as f:
                f.write(GST_CONFIG_UNVERSAL)