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

class Recipe(recipe.Recipe):
    name = 'vulkan-android'
    version = '1.1.114.0'
    licenses = [License.Apachev2]
    stype = SourceType.CUSTOM
    btype = BuildType.CUSTOM

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

    async def install(self):
        to_copy = []

        v = DistroVersion.get_android_api_version(self.config.target_distro_version)
        if v < 24:
            # Hacky way of copying the earliest version (android-24) of
            # libvulkan.so so we can build the vulkan plugin with a newer
            # version than what may be built by the rest of cerbero.
            srcdir = os.path.join(self.config.sysroot, 'usr', 'lib', self.config.host, '24')
            destdir = self.config.libdir
            to_copy += [
                (os.path.join(srcdir, 'libvulkan.so'),
                os.path.join(destdir, 'libvulkan.so'), False)
            ]

        for src, dest, is_dir in to_copy:
            if is_dir:
                shell.copy_dir(src, dest)
            else:
                if not os.path.exists(os.path.dirname(dest)):
                    os.makedirs(os.path.dirname(dest))
                shutil.copy(src, dest)