|
2 | 2 |
|
3 | 3 | set -euo pipefail |
4 | 4 | IFS=$'\n\t' |
| 5 | +new_ver_full='' |
5 | 6 |
|
6 | 7 | # Check currently installed and latest available Vulkan SDK versions. |
7 | | -if [ -d "$HOME/VulkanSDK" ]; then |
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=`jq -r '.version' /tmp/vulkan-sdk.json` |
12 | | - new_ver=`echo "$new_ver" | 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 |
| 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 |
23 | 22 | fi |
24 | | - done |
25 | | - fi |
| 23 | + fi |
| 24 | + done |
26 | 25 | fi |
27 | 26 |
|
28 | 27 | # Download and install the Vulkan SDK. |
29 | 28 | curl -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zip |
30 | 29 | unzip /tmp/vulkan-sdk.zip -d /tmp |
31 | | -/tmp/InstallVulkan.app/Contents/MacOS/InstallVulkan \ |
32 | | - --accept-licenses --default-answer --confirm-command install |
33 | 30 |
|
| 31 | +if [ -d "/tmp/InstallVulkan-$new_ver_full.app" ]; then |
| 32 | + /tmp/InstallVulkan-$new_ver_full.app/Contents/MacOS/InstallVulkan-$new_ver_full --accept-licenses --default-answer --confirm-command install |
| 33 | + rm -rf /tmp/InstallVulkan-$new_ver_full.app |
| 34 | +elif [ -d "/tmp/InstallVulkan.app" ]; then |
| 35 | + /tmp/InstallVulkan.app/Contents/MacOS/InstallVulkan --accept-licenses --default-answer --confirm-command install |
| 36 | + rm -rf /tmp/InstallVulkan.app |
| 37 | +fi |
34 | 38 |
|
35 | | -rm -rf /tmp/InstallVulkan.app |
36 | 39 | rm -f /tmp/vulkan-sdk.zip |
37 | 40 |
|
38 | 41 | echo 'Vulkan SDK installed successfully! You can now build Godot by running "scons".' |
0 commit comments