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

import os
import shutil

class Recipe(recipe.Recipe):
    """
    Sets up build based on the tinyalsa library.
    """
    name = 'tinyalsa'
    version = '0.1'
    licenses = [License.Apachev2]
    btype = BuildType.MAKEFILE
    remotes = {'origin': 'https://github.com/tinyalsa/tinyalsa'}
    commit = '1.1.1'

    files_devel = [ 'include/tinyalsa/asoundlib.h' ]

    files_libs = [ 'libtinyalsa' ]

    def prepare(self):
        if self.config.target_platform != Platform.LINUX and self.config.target_platform != Platform.ANDROID:
            raise InvalidRecipeError(self, "Invalid platform")

    async def install(self):
        include_path = os.path.join(self.config.prefix, 'include', 'tinyalsa')
        library_path = os.path.join(self.config.prefix, 'lib')

        tinyalsa_header = os.path.join(self.build_dir, 'include', 'tinyalsa', 'asoundlib.h')
        tinyalsa_lib = os.path.join(self.build_dir, 'src', 'libtinyalsa.a')

        if not os.path.exists(include_path):
            os.makedirs(include_path)

        shutil.copy(tinyalsa_header, include_path)
        shutil.copy(tinyalsa_lib, library_path)