summaryrefslogtreecommitdiff
path: root/otp_build
diff options
context:
space:
mode:
authorDan Gudmundsson <dgud@erlang.org>2020-01-08 12:36:02 +0100
committerDan Gudmundsson <dgud@erlang.org>2020-01-08 12:36:02 +0100
commit8ff0284174252788bafb6b616d0fa09ef51a1ed6 (patch)
tree67e68124b6a6b6bea84fa22964facf6a6e221ae3 /otp_build
parent83c68a5e9cebdd00d00bbf8e5de20ce928e0172f (diff)
parent9249a4479ce4c7956eea6bfba731b6a2af7fc123 (diff)
downloaderlang-8ff0284174252788bafb6b616d0fa09ef51a1ed6.tar.gz
Merge branch 'dgud/build-WSL'
* dgud/build-WSL: Add missing files to gitignore Make build installer work from WSL Fix deps generation on Windows Support ssl-1.1.1 on windows when building crypto Setup VC env in otp_build Add wsl config as an environment to otp build tools
Diffstat (limited to 'otp_build')
-rwxr-xr-xotp_build77
1 files changed, 73 insertions, 4 deletions
diff --git a/otp_build b/otp_build
index 76bdc8d2f8..8f611240e7 100755
--- a/otp_build
+++ b/otp_build
@@ -754,6 +754,66 @@ echo_env_msys ()
echo_envinfo
}
+echo_env_wsl ()
+{
+ X64=$1
+ #echo_envinfo
+ if [ X"$SHELL" = X"" ]; then
+ echo "You need to export the shell variable first," \
+ "for bourne-like shells, type:" >&2
+ echo 'export SHELL' >&2
+ echo "and for csh-like shells, type:" >&2
+ echo 'setenv SHELL $SHELL' >&2
+ echo " - then try again." >&2
+ exit 1
+ fi
+ echo_env_erltop
+
+ 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 ';'
+ fi
+ echo_setenv WSLcross true ';'
+ echo_setenv CC cc.sh ';'
+ echo_setenv CXX cc.sh ';'
+ echo_setenv AR ar.sh ';'
+ echo_setenv RANLIB true ';'
+ if [ X"$X64" = X"true" ]; then
+ if [ -f "$ERL_TOP/erts/autoconf/win64.config.cache.static" ]; then
+ echo_setenv OVERRIDE_CONFIG_CACHE_STATIC "$ERL_TOP/erts/autoconf/win64.config.cache.static" ';'
+ fi
+ echo_setenv OVERRIDE_CONFIG_CACHE "$ERL_TOP/erts/autoconf/win64.config.cache" ';'
+ else
+ if [ -f "$ERL_TOP/erts/autoconf/win32.config.cache.static" ]; then
+ echo_setenv OVERRIDE_CONFIG_CACHE_STATIC "$ERL_TOP/erts/autoconf/win32.config.cache.static" ';'
+ fi
+ echo_setenv OVERRIDE_CONFIG_CACHE "$ERL_TOP/erts/autoconf/win32.config.cache" ';'
+ fi
+ echo_setenv WIN32_WRAPPER_PATH "$WIN32_WRAPPER_PATH" ';'
+ echo_setenv PATH "$WIN32_WRAPPER_PATH:$PATH" ';'
+ 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
@@ -1044,8 +1104,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
@@ -1162,7 +1227,9 @@ case "$1" in
if [ x"$2" = x"x64" -o x"$2" = x"amd64" ]; then
ISX64=true
fi
- if [ -x /usr/bin/msys-?.0.dll ]; then
+ if [ -x /bin/wslpath ]; then
+ echo_env_wsl $ISX64
+ elif [ -x /usr/bin/msys-?.0.dll ]; then
echo_env_msys $ISX64
else
echo_env_cygwin $ISX64
@@ -1170,7 +1237,9 @@ case "$1" in
env_mingw32)
echo_env_mingw32;;
env_win64)
- if [ -x /usr/bin/msys-?.0.dll ]; then
+ if [ -x /bin/wslpath ]; then
+ echo_env_wsl true
+ elif [ -x /usr/bin/msys-?.0.dll ]; then
echo_env_msys true
else
echo_env_cygwin true