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