Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/msvc
diff options
context:
space:
mode:
authorlateralusX <lateralusx.github@gmail.com>2019-05-02 18:25:27 +0300
committerlateralusX <lateralusx.github@gmail.com>2019-05-03 16:14:21 +0300
commit568813b93bdd3f5f000bc4bdbc88e71f8158d9ca (patch)
treea5c3bfee92be91cb58e2986f98c0f7cfbcdff60b /msvc
parent488e15e8ab3245bd6faca4f8388f3844d3066314 (diff)
Add support for cygwin and WSL in helper build scripts.
Diffstat (limited to 'msvc')
-rwxr-xr-xmsvc/mono-sgen-msvc.sh33
-rwxr-xr-xmsvc/run-msbuild.sh33
2 files changed, 62 insertions, 4 deletions
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" "$@"