| 1 | #!/usr/bin/envscip-shell filesystem . . `/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/nullscip-shell filesystem . . `/dev/null`.; then |
| 9 | curlscip-shell system . . curl. -L "https://sdk.lunarg.com/sdk/download/latest/mac/config.json" -o /tmp/vulkan-sdk.jsonscip-shell filesystem . . `/tmp/vulkan-sdk.json`. |
| 10 | |
| 11 | new_ver_full=`jqscip-shell system . . jq. -r '.version' /tmp/vulkan-sdk.jsonscip-shell filesystem . . `/tmp/vulkan-sdk.json`.` |
| 12 | new_ver=`echoscip-shell system . . echo. "$new_ver_full" | awkscip-shell system . . awk. -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';` |
| 13 | |
| 14 | rmscip-shell system . . rm. -f /tmp/vulkan-sdk.jsonscip-shell filesystem . . `/tmp/vulkan-sdk.json`. |
| 15 | |
| 16 | for f in $HOME/VulkanSDK/*; do |
| 17 | if [scip-shell system . . `[`. -d "$f" ]; then |
| 18 | f=`echoscip-shell system . . echo. "${f##*/}" | awkscip-shell system . . awk. -F. '{ printf("%d%02d%04d%02d\n", $1,$2,$3,$4); }';` |
| 19 | if [scip-shell system . . `[`. $f -ge $new_ver ]; then |
| 20 | echoscip-shell system . . echo. 'Latest or newer Vulkan SDK is already installed. Skipping installation.' |
| 21 | exit 0 |
| 22 | fi |
| 23 | fi |
| 24 | done |
| 25 | else |
| 26 | echoscip-shell system . . 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 | curlscip-shell system . . curl. -L "https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip" -o /tmp/vulkan-sdk.zipscip-shell filesystem . . `/tmp/vulkan-sdk.zip`. |
| 32 | unzip /tmp/vulkan-sdk.zipscip-shell filesystem . . `/tmp/vulkan-sdk.zip`. -d /tmpscip-shell filesystem . . `/tmp`. |
| 33 | |
| 34 | if [scip-shell system . . `[`. -d "/tmp/vulkansdk-macOS-$new_ver_full.app" ]; then |
| 35 | /tmp/vulkansdk-macOS-$scip-shell filesystem . . `/tmp/vulkansdk-macOS-$new_ver_full.app/Contents/MacOS/vulkansdk-macOS-$new_ver_full`.new_ver_full.app/Contents/MacOS/vulkansdk-macOS-$scip-shell filesystem . . `/tmp/vulkansdk-macOS-$new_ver_full.app/Contents/MacOS/vulkansdk-macOS-$new_ver_full`.new_ver_full --accept-licenses --default-answer --confirm-command install |
| 36 | rmscip-shell system . . rm. -rf /tmp/vulkansdk-macOS-$new_ver_full.app |
| 37 | else |
| 38 | echoscip-shell system . . 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 | rmscip-shell system . . rm. -f /tmp/vulkan-sdk.zipscip-shell filesystem . . `/tmp/vulkan-sdk.zip`. |
| 43 | |
| 44 | echoscip-shell system . . echo. 'Vulkan SDK installed successfully! You can now build Godot by running "scons".' |