Move tryrun to importing project (dotnet/coreclr#27717)
authorViktor Hofer <viktor.hofer@microsoft.com>
Thu, 7 Nov 2019 01:19:34 +0000 (02:19 +0100)
committerSantiago Fernandez Madero <safern@microsoft.com>
Thu, 7 Nov 2019 01:19:34 +0000 (17:19 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/c373d864c05fa4c4b68e764cf47d2a623c4b2baa

src/coreclr/src/pal/tools/gen-buildsys.sh
src/coreclr/src/pal/tools/tryrun.cmake [moved from src/coreclr/cross/tryrun.cmake with 100% similarity]

index a599b5f..b8701ea 100755 (executable)
@@ -3,6 +3,19 @@
 # This file invokes cmake and generates the build system for Clang.
 #
 
+source="${BASH_SOURCE[0]}"
+
+# resolve $SOURCE until the file is no longer a symlink
+while [[ -h $source ]]; do
+  scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+  source="$(readlink "$source")"
+
+  # if $source was a relative symlink, we need to resolve it relative to the path where the
+  # symlink file was located
+  [[ $source != /* ]] && source="$scriptroot/$source"
+done
+scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
+
 if [ $# -lt 4 ]
 then
   echo "Usage..."
@@ -56,7 +69,7 @@ if [ "$CROSSCOMPILE" == "1" ]; then
         CONFIG_DIR="$1/cross"
     fi
     export TARGET_BUILD_ARCH=$build_arch
-    cmake_extra_defines="$cmake_extra_defines -C $CONFIG_DIR/tryrun.cmake"
+    cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
     cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$CONFIG_DIR/toolchain.cmake"
 fi