summaryrefslogtreecommitdiff
path: root/recipes/flac.recipe
blob: c1e030ae2d34b97a99aedf977cebce2533d84cdb (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from cerbero.utils import shell


class Recipe(recipe.Recipe):
    name = 'flac'
    version = '1.3.3'
    # only libraries are Xiph.org (aka BSD-like), tools are GPLv2+ and defined below
    licenses = [{License.BSD_like: ['COPYING.Xiph']}]
    stype = SourceType.TARBALL
    url = 'xiph://'
    tarball_checksum = '213e82bd716c9de6db2f98bcadbc4c24c7e2efe8c75939a1a84e28539c4e1748'
    deps = ['libogg']
    configure_options = ' --disable-cpplibs --enable-static'

    files_libs = ['libFLAC']

    files_bins = ['flac', 'metaflac']
    licenses_bins = [License.GPLv2Plus]

    files_devel = [
        '%(libdir)s/pkgconfig/flac.pc',
        'include/FLAC',
    ]

    # Skipping because it takes too long
    make_check = None

    def prepare(self):
        if self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
            if self.config.target_arch == Architecture.X86:
                self.configure_options += ' --disable-asm-optimizations'
        if self.config.target_platform in [Platform.ANDROID, Platform.IOS]:
            self.autoreconf = True
        if self.config.target_platform == Platform.WINDOWS:
            # Newer MinGW requires this define for sscanf in stdio.h
            self.append_env('CFLAGS', '-D__USE_MINGW_ANSI_STDIO=1')

    async def configure(self):
        if self.config.target_platform == Platform.ANDROID:
            if self.config.target_arch == Architecture.X86:
                # for missing sys/ucontext.h
                shell.replace(os.path.join(self.build_dir, 'src', 'libFLAC',
                    'cpu.c'),
                    {'#  undef USE_OBSOLETE_SIGCONTEXT_FLAVOR':
                     '#define USE_OBSOLETE_SIGCONTEXT_FLAVOR'})
        await super(Recipe, self).configure()