summaryrefslogtreecommitdiff
path: root/recipes/build-tools/moltenvk-tools.recipe
blob: 4df8063dac8abe8143ad804f40be29e00bebf012 (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
# -*- 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 = 'moltenvk-tools'
    version = '1.2.162.1'
    licenses = [License.Apachev2]
    stype = SourceType.TARBALL
    tarball_dirname = "vulkansdk-macos-%(version)s"
    # Mirrored because lunarg.com has an extremely small download limit
    #url = 'https://sdk.lunarg.com/sdk/download/%(version)s/mac/' + tarball_dirname + '.dmg'
    url = 'https://gstreamer.freedesktop.org/data/src/mirror/' + tarball_dirname + '.dmg'
    tarball_checksum = '2781c334997598c2828d8a3368aef7b7c94a25204c90d5503396e40c7a03fd5c'
    btype = BuildType.CUSTOM

    files_bins = [
        'glslangValidator',
        'glslc',
        'spirv-as',
        'spirv-cfg',
        'spirv-cross',
        'spirv-dis',
        'spirv-link',
        'spirv-opt',
        'spirv-reduce',
        'spirv-remap',
        'spirv-val',
    ]

    def prepare(self):
        if self.config.target_platform not in (Platform.IOS, Platform.DARWIN):
            raise InvalidRecipeError(self, "Invalid platform")
        # The binaries from the SDK are already signed and do not require relocation
        if BuildSteps.RELOCATE_OSX_LIBRARIES in self._steps:
            self._steps.remove(BuildSteps.RELOCATE_OSX_LIBRARIES)
        if BuildSteps.CODE_SIGN in self._steps:
            self._steps.remove(BuildSteps.CODE_SIGN)

    async def install(self):
        srcdir = self.config.moltenvk_prefix
        prefix = self.config.prefix

        if os.path.exists(srcdir):
            shutil.rmtree(srcdir)
        shell.copy_dir(self.build_dir, srcdir)

        for bin in self.files_bins:
            shutil.copy(os.path.join(srcdir, 'macOS', 'bin', bin), os.path.join(prefix, 'bin', bin))