Debian Codegraph @

misc/scripts/install_vulkan_sdk_macos.sh

raw symbols SCIP
1 #!/usr/bin/env sh
2
3 set -euo pipefail
4 IFS=$'\n\t'
5 new_ver_full=''
6
7 # Check currently installed and latest available Vulkan SDK versions.
8 if command -v jq 2>&1 >/dev/null; then
9 curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/config.json" -o /tmp/vulkan-sdk.json
10
11 new_ver_full=`jq -r '.version' /tmp/vulkan-sdk.json`
12 new_ver=`echo "$new_ver_full" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`
13
14 rm -f /tmp/vulkan-sdk.json
15
16 for f in $HOME/VulkanSDK/*; do
17 if [ -d "$f" ]; then
18 f=`echo "${f##*/}" | awk -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';`
19 if [ $f -ge $new_ver ]; then
20 echo 'Latest or newer Vulkan SDK is already installed. Skipping installation.'
21 exit 0
22 fi
23 fi
24 done
25 else
26 echo 'Error: Could not find 'jq' command. Is jq installed? Try running "brew install jq" or "port install jq" and rerunning this script.'
27 exit 1
28 fi
29
30 # Download and install the Vulkan SDK.
31 curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zip
32 unzip /tmp/vulkan-sdk.zip -d /tmp
33
34 if [ -d "/tmp/vulkansdk-macOS-$new_ver_full.app" ]; then
35 /tmp/vulkansdk-macOS-$new_ver_full.app/Contents/MacOS/vulkansdk-macOS-$new_ver_full --accept-licenses --default-answer --confirm-command install
36 rm -rf /tmp/vulkansdk-macOS-$new_ver_full.app
37 else
38 echo "Couldn't install the Vulkan SDK, the unzipped contents may no longer match what this script expects."
39 exit 1
40 fi
41
42 rm -f /tmp/vulkan-sdk.zip
43
44 echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".'