summaryrefslogtreecommitdiff
path: root/recipes/librtmp.recipe
blob: 152d50f9dee2dcbc579d14806be4e949d2a5b37f (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.tools.libtool import LibtoolLibrary


class Recipe(recipe.Recipe):
    name = 'librtmp'
    version = '2.4_p20151223'
    stype = SourceType.TARBALL
    btype = BuildType.MAKEFILE
    url = 'https://gstreamer.freedesktop.org/data/src/mirror/rtmpdump-2.4_p20151223.tar.gz'
    tarball_checksum = 'b066f2583fd20aeb7b9c48535027e28026f8a38bc00d446fc81e09a597f38654'
    # Binaries are GPLv2+, but we don't distribute them
    licenses = [License.LGPLv2_1Plus]
    srcdir = 'librtmp'
    tarball_dirname = 'rtmpdump-%(version)s'
    patches = [name + '/0001-Fix-support-for-cross-compilation.patch',
               name + '/0002-ios-Remove-flags-incompatible-with-fembed-bitcode.patch']
    deps = ['gnutls', 'nettle']
    files_libs = ['librtmp']
    files_devel = ['include/librtmp/', 'lib/pkgconfig/librtmp.pc' ]


    def prepare (self):
        if self.config.target_platform == Platform.WINDOWS:
            system = 'mingw'
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            system = 'darwin'
        if self.config.target_platform in [Platform.LINUX, Platform.ANDROID]:
            system = 'posix'
        # LDFLAGS are passed via XLDFLAGS, and are needed for at least Android
        if self.config.platform == Platform.WINDOWS:
            self.make = 'make SYS=%s prefix=$CERBERO_PREFIX CRYPTO=GNUTLS XLDFLAGS=\\"$LDFLAGS\\" XCFLAGS=\\"$CFLAGS\\" CC=\\"$CC\\" LD=\\"$LD\\"' % (system)
            self.make_install = 'make install SYS=%s prefix=$CERBERO_PREFIX CRYPTO=GNUTLS XLDFLAGS=\\"$LDFLAGS\\" XCFLAGS=\\"$CFLAGS\\" CC=\\"$CC\\" LD=\\"$LD\\"' % (system)
        else:
            self.make = 'make SYS=%s prefix=$CERBERO_PREFIX CRYPTO=GNUTLS XLDFLAGS="$LDFLAGS" XCFLAGS="$CFLAGS" CC="$CC" LD="$LD"' % (system)
            self.make_install = 'make install SYS=%s prefix=$CERBERO_PREFIX CRYPTO=GNUTLS XLDFLAGS="$LDFLAGS" XCFLAGS="$CFLAGS" CC="$CC" LD="$LD"' % (system)

    def post_install(self):
        soversion = 1
        # On Windows, rtmp installs a duplicate DLL by trying to symlink which
        # results in a copy under MinGW since symlinks aren't supported there.
        if self.config.target_platform == Platform.WINDOWS:
            dlldir = os.path.join(self.config.prefix, 'bin')
            real_rtmp_dll = os.path.join(dlldir, 'librtmp-{}.dll'.format(soversion))
            dupe_rtmp_dll = os.path.join(dlldir, 'librtmp.dll')
            print(dupe_rtmp_dll)
            if os.path.isfile(dupe_rtmp_dll) and os.path.isfile(real_rtmp_dll):
                os.remove(dupe_rtmp_dll)
        deps = ['gnutls']
        libtool_la = LibtoolLibrary('rtmp', soversion, None, None,
                self.config.libdir, self.config.target_platform, deps)
        libtool_la.save()
        super().post_install()