summaryrefslogtreecommitdiff
path: root/otp_build
diff options
context:
space:
mode:
authorDan Gudmundsson <dgud@erlang.org>2019-11-11 15:43:49 +0100
committerDan Gudmundsson <dgud@erlang.org>2019-11-12 07:51:31 +0100
commit73d3d02d887408e99489a9df3877dd409021cc82 (patch)
treeb06d5d49a43c4f3ab61ab6d11f8a5638816ee91a /otp_build
parent3a162745c62b1f46580bdc0851f17ac46937197c (diff)
downloaderlang-73d3d02d887408e99489a9df3877dd409021cc82.tar.gz
Setup VC env in otp_build
If there is no cl.exe in path try to setup the paths and the needed env variables. Use vcvarsall.bat from VC so we get the correct path and libraries. Search some default installations paths
Diffstat (limited to 'otp_build')
-rwxr-xr-xotp_build27
1 files changed, 25 insertions, 2 deletions
diff --git a/otp_build b/otp_build
index ed00a3ed7e..8d9854614e 100755
--- a/otp_build
+++ b/otp_build
@@ -777,6 +777,13 @@ echo_env_wsl ()
WIN32_WRAPPER_PATH="$ERL_TOP/erts/etc/win32/wsl_tools/vc:$ERL_TOP/erts/etc/win32/wsl_tools"
+ if [ ! -n "`lookup_prog_in_path cl`" ]; then
+ if [ X"$X64" = X"true" ]; then
+ setup_win32_cl_env "x64" `wslpath -a -m erts/etc/win32/wsl_tools/SetupWSLcross.bat`
+ else
+ setup_win32_cl_env "x86" `wslpath -a -m erts/etc/win32/wsl_tools/SetupWSLcross.bat`
+ fi
+ fi
echo_setenv OVERRIDE_TARGET win32 ';'
if [ X"$X64" = X"true" ]; then
echo_setenv CONFIG_SUBTYPE win64 ';'
@@ -802,6 +809,17 @@ echo_env_wsl ()
echo_envinfo
}
+
+setup_win32_cl_env ()
+{
+ eval `cmd.exe /c $2 $1`
+ echo_setenv INCLUDE "$INCLUDE" ';'
+ echo_setenv LIB "$LIB" ';'
+ echo_setenv LIBPATH "$LIBPATH" ';'
+ echo_setenv VCToolsRedistDir "$VCToolsRedistDir" ';'
+ echo_setenv WSLENV "$WSLENV" ';'
+}
+
lookup_prog_in_path ()
{
PROG=$1
@@ -1092,8 +1110,13 @@ case $TARGET in
'the command'
exit 1
fi;;
- *)
- ;;
+ *)
+ if [ -x /bin/wslpath -a X"$OVERRIDE_TARGET" = X"" \
+ -a X"$1" != X"env_win32" -a X"$1" != X"env_msys32" -a X"$1" != X"env_msys64" ]; then
+ echo "Building linux binary; if you intended to cross build for win32 use" >&2
+ echo ' eval `./otp_build env_win32`\n' >&2
+ fi
+ ;;
esac
if [ ! -z "$OVERRIDE_TARGET" ]; then