diff options
-rw-r--r-- | llvm/build_llvm_msbuild.sh | 39 | ||||
-rwxr-xr-x | msvc/mono-sgen-msvc.sh | 33 | ||||
-rwxr-xr-x | msvc/run-msbuild.sh | 33 |
3 files changed, 96 insertions, 9 deletions
diff --git a/llvm/build_llvm_msbuild.sh b/llvm/build_llvm_msbuild.sh index 082d083370e..88178717c91 100644 --- a/llvm/build_llvm_msbuild.sh +++ b/llvm/build_llvm_msbuild.sh @@ -13,11 +13,40 @@ # $7 Additional arguments passed to msbuild, needs to be quoted if multiple. # ------------------------------------------------------- +function win32_format_path { + local formatted_path=$1 + local host_win32_wsl=0 + local host_win32_cygwin=0 + + host_uname="$(uname -a)" + case "$host_uname" in + *Microsoft*) + host_win32_wsl=1 + ;; + CYGWIN*) + host_win32_cygwin=1 + ;; + esac + + if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then + formatted_path="$(wslpath -a -w "$1")" + elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then + formatted_path="$(cygpath -a -w "$1")" + fi + + echo "$formatted_path" +} + BUILD_LLVM_MSBUILD_SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd) -BUILD_LLVM_MSBUILD_SCRIPT_PATH=$(cygpath -w "$BUILD_LLVM_MSBUILD_SCRIPT_PATH/build_llvm_msbuild.bat") -MONO_MSVC_SOURCE_DIR=$(cygpath -w "$4") -MONO_LLVM_BUILD_DIR=$(cygpath -w "$5") -MONO_LLVM_INSTALL_DIR=$(cygpath -w "$6") +BUILD_LLVM_MSBUILD_SCRIPT_PATH=$(win32_format_path "$BUILD_LLVM_MSBUILD_SCRIPT_PATH/build_llvm_msbuild.bat") +MONO_MSVC_SOURCE_DIR=$(win32_format_path "$4") +MONO_LLVM_BUILD_DIR=$(win32_format_path "$5") +MONO_LLVM_INSTALL_DIR=$(win32_format_path "$6") + +WINDOWS_CMD=$(which cmd.exe) +if [ ! -f $WINDOWS_CMD ]; then + WINDOWS_CMD=$WINDIR/System32/cmd.exe +fi -"$WINDIR/System32/cmd.exe" /c "$BUILD_LLVM_MSBUILD_SCRIPT_PATH" "$1" "$2" "$3" "$MONO_MSVC_SOURCE_DIR" "$MONO_LLVM_BUILD_DIR" "$MONO_LLVM_INSTALL_DIR" "$7" +"$WINDOWS_CMD" /c "$BUILD_LLVM_MSBUILD_SCRIPT_PATH" "$1" "$2" "$3" "$MONO_MSVC_SOURCE_DIR" "$MONO_LLVM_BUILD_DIR" "$MONO_LLVM_INSTALL_DIR" "$7" diff --git a/msvc/mono-sgen-msvc.sh b/msvc/mono-sgen-msvc.sh index 03757366d09..29331667376 100755 --- a/msvc/mono-sgen-msvc.sh +++ b/msvc/mono-sgen-msvc.sh @@ -11,11 +11,40 @@ # Optimization, only run full build environment when running mono-sgen.exe as AOT compiler. # If not, just run mono-sgen.exe with supplied arguments. +function win32_format_path { + local formatted_path=$1 + local host_win32_wsl=0 + local host_win32_cygwin=0 + + host_uname="$(uname -a)" + case "$host_uname" in + *Microsoft*) + host_win32_wsl=1 + ;; + CYGWIN*) + host_win32_cygwin=1 + ;; + esac + + if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then + formatted_path="$(wslpath -a -w "$1")" + elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then + formatted_path="$(cygpath -a -w "$1")" + fi + + echo "$formatted_path" +} + MONO_SGEN_MSVC_SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd) if [[ "$@" != *"--aot="* ]]; then "$MONO_SGEN_MSVC_SCRIPT_PATH/mono-sgen.exe" "$@" else - MONO_SGEN_MSVC_SCRIPT_PATH=$(cygpath -w "$MONO_SGEN_MSVC_SCRIPT_PATH/mono-sgen-msvc.bat") - "$WINDIR/System32/cmd.exe" /c "$MONO_SGEN_MSVC_SCRIPT_PATH" "$@" + MONO_SGEN_MSVC_SCRIPT_PATH=$(win32_format_path "$MONO_SGEN_MSVC_SCRIPT_PATH/mono-sgen-msvc.bat") + + WINDOWS_CMD=$(which cmd.exe) + if [ ! -f $WINDOWS_CMD ]; then + WINDOWS_CMD=$WINDIR/System32/cmd.exe + fi + "$WINDOWS_CMD" /c "$MONO_SGEN_MSVC_SCRIPT_PATH" "$@" fi diff --git a/msvc/run-msbuild.sh b/msvc/run-msbuild.sh index 7de93f0d9f4..d90d8ac1615 100755 --- a/msvc/run-msbuild.sh +++ b/msvc/run-msbuild.sh @@ -8,7 +8,36 @@ # $4 Additional arguments passed to msbuild, needs to be quoted if multiple. #------------------------------------------------------- +function win32_format_path { + local formatted_path=$1 + local host_win32_wsl=0 + local host_win32_cygwin=0 + + host_uname="$(uname -a)" + case "$host_uname" in + *Microsoft*) + host_win32_wsl=1 + ;; + CYGWIN*) + host_win32_cygwin=1 + ;; + esac + + if [[ $host_win32_wsl = 1 ]] && [[ $1 == "/mnt/"* ]]; then + formatted_path="$(wslpath -a -w "$1")" + elif [[ $host_win32_cygwin = 1 ]] && [[ $1 == "/cygdrive/"* ]]; then + formatted_path="$(cygpath -a -w "$1")" + fi + + echo "$formatted_path" +} + RUN_MSBUILD_SCRIPT_PATH=$(cd "$(dirname "$0")"; pwd) -RUN_MSBUILD_SCRIPT_PATH=$(cygpath -w "$RUN_MSBUILD_SCRIPT_PATH/run-msbuild.bat") +RUN_MSBUILD_SCRIPT_PATH=$(win32_format_path "$RUN_MSBUILD_SCRIPT_PATH/run-msbuild.bat") + +WINDOWS_CMD=$(which cmd.exe) +if [ ! -f $WINDOWS_CMD ]; then + WINDOWS_CMD=$WINDIR/System32/cmd.exe +fi -"$WINDIR/System32/cmd.exe" /c "$RUN_MSBUILD_SCRIPT_PATH" "$@" +"$WINDOWS_CMD" /c "$RUN_MSBUILD_SCRIPT_PATH" "$@" |