summaryrefslogtreecommitdiff
path: root/recipes/libdca.recipe
blob: c597bd9315a5efdedb51b7e29adefc30f8b16ee0 (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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
from pathlib import Path

class Recipe(recipe.Recipe):
    name = 'libdca'
    version = '0.0.5'
    stype = SourceType.TARBALL
    url = 'https://download.videolan.org/pub/videolan/libdca/%(version)s/libdca-%(version)s.tar.bz2'
    tarball_checksum = 'dba022e022109a5bacbe122d50917769ff27b64a7bba104bd38ced8de8510642'
    licenses = [License.GPLv2Plus]

    files_libs = ['libdca']
    files_bins = ['extract_dca', 'extract_dcs', 'dcadec', 'dcsdec']
    files_devel = ['include/dca.h', 'include/dts.h',
                   '%(libdir)s/pkgconfig/libdca.pc', '%(libdir)s/pkgconfig/libdts.pc']

    def prepare(self):
        if self.config.target_platform == Platform.ANDROID:
            self.configure_options += ' --disable-oss'
        if self.config.platform != Platform.WINDOWS:
            self.autoreconf = True
        # Don't enable always-inline, breaks the build on macos (space is significant)
        self.set_env('ac_cv_c_inline', 'inline ')

    def post_install(self):
        # Create relative symlinks to prevent breakage during packaging
        if self.config.platform != Platform.WINDOWS:
            dangling = [
                ('libdca.a', self.config.libdir + '/libdts.a'),
                ('extract_dca.1', 'share/man/man1/extract_dts.1'),
                ('dcadec.1', 'share/man/man1/dtsdec.1'),
            ]
            prefix = Path(self.config.prefix)
            for src, dest in dangling:
                dest = prefix / dest
                dest.unlink()
                dest.symlink_to(src)
        super().post_install()