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
50
51
52
53
54
55
56
57
58
59
60
|
# -*- 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.182.0'
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 = '9e89291283e41d62673bf48007dac764e99a504d145ee4d70d2d32e328f7ee40'
btype = BuildType.CUSTOM
# The binaries from the SDK are already signed and do not require relocation
skip_steps = [BuildSteps.RELOCATE_OSX_LIBRARIES, BuildSteps.CODE_SIGN]
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")
async def install(self):
srcdir = self.config.moltenvk_prefix
prefix = self.config.prefix
if os.path.exists(srcdir):
shutil.rmtree(srcdir)
# https://vulkan.lunarg.com/doc/sdk/1.2.182.0/mac/getting_started.html
vulkan_installer = os.path.join(self.build_dir, 'InstallVulkan.app/Contents/MacOS/InstallVulkan')
await shell.async_call([vulkan_installer,
'--root', self.config.moltenvk_prefix,
'--accept-licenses',
'--default-answer',
'--confirm-command',
'install',
'copy_only=1'],
env=self.env, logfile=self.logfile)
for bin in self.files_bins:
shutil.copy(os.path.join(srcdir, 'macOS', 'bin', bin), os.path.join(prefix, 'bin', bin))
patch = os.path.join(self.config.recipes_dir, 'build-tools',
self.name, 'ifdef-new-metal-types.patch')
moltenvk_dir = os.path.join(self.config.moltenvk_prefix, 'MoltenVK')
shell.apply_patch(patch, moltenvk_dir, logfile=self.logfile)
|