toolchain: Fix update script for macOS
authorCody Northrop <cnorthrop@google.com>
Fri, 2 Dec 2016 16:10:20 +0000 (09:10 -0700)
committerCody Northrop <cnorthrop@google.com>
Fri, 2 Dec 2016 18:33:24 +0000 (11:33 -0700)
readlink -f is not supported on macOS
brew is already a requirement to build for macOS

update_external_sources.sh

index a33c850..9db212f 100755 (executable)
@@ -3,7 +3,13 @@
 
 set -e
 
-CURRENT_DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
+if [[ $(uname) == "Linux" ]]; then
+    CURRENT_DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
+elif [[ $(uname) == "Darwin" ]]; then
+    # Get greadlink with "brew install coreutils"
+    CURRENT_DIR="$(dirname "$(greadlink -f ${BASH_SOURCE[0]})")"
+fi
+
 REVISION_DIR="$CURRENT_DIR/external_revisions"
 
 GLSLANG_REVISION=$(cat "${REVISION_DIR}/glslang_revision")