aboutsummaryrefslogtreecommitdiffstats
path: root/otp_build
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2011-10-25 12:31:54 +0200
committerPatrik Nyblom <[email protected]>2011-12-02 15:21:10 +0100
commite78a1582dc13d770bf1a9de64ff817369c741ef5 (patch)
treee2aa3f037e3c3a9c8c72080f5d8c4c0e4f0c4c8b /otp_build
parente1d960cb615a86faae67c16dc2d185b367f1c385 (diff)
downloadotp-e78a1582dc13d770bf1a9de64ff817369c741ef5.tar.gz
otp-e78a1582dc13d770bf1a9de64ff817369c741ef5.tar.bz2
otp-e78a1582dc13d770bf1a9de64ff817369c741ef5.zip
Make Win64 build work both under MSYS and Cygwin
Diffstat (limited to 'otp_build')
-rwxr-xr-xotp_build152
1 files changed, 143 insertions, 9 deletions
diff --git a/otp_build b/otp_build
index 0222e4923b..a4e25510c1 100755
--- a/otp_build
+++ b/otp_build
@@ -65,9 +65,16 @@ usage ()
echo " installer_win32 <dir> - creates a windows installer from <dir>"
echo ""
echo "Before trying to build on windows, consider the following option"
- echo " env_win32 - echo environment settings for win32 with visual C++, use with eval"
+ echo " env_win32 [<arch>] - echo environment settings for win32 with visual C++, use with eval"
+ echo " The optional <arch> can be x64 for 64bit Windows 7"
+ echo " or x86 for 32bit Windows XP+"
+ echo " env_win64 - echo environment settings for win32 with visual C++, use with eval"
+ echo " Note that env_win32 x64 gives the same result, Windows 7 64bit"
echo " env_mingw32 - echo environment settings for win32 with MinGW, use with eval"
- echo " env_msys64 - echo environment settings for win32 with visual C++ running msys and mingw, use with eval"
+ echo " - experimental!"
+ echo " env_msys64 - echo environment settings for win32 with visual C++ running "
+ echo " msys and mingw, use with eval"
+ echo " - experimental!"
echo ""
echo "Before trying to build for vxworks, consider the following option"
echo " env_vxworks <cpu> - echo environment settings for vxworks, use with eval"
@@ -278,7 +285,10 @@ chk_eq()
s=`$SUM_CMD $x | awk '{print $1}'`
if test "$s" != "$master_sum"; then
echo "Error: $master and $x are not equal, make sure they are!" >&2
- exit 1
+ echo "Maybe you would want to:" >&2
+ echo "for x in $slaves; do cp $master \$x; done" >&2
+ echo "? Or something else is wrong." 2>&1
+ exit 2
fi
done
}
@@ -876,6 +886,119 @@ echo_env_mingw32 ()
# N.B. In Erlang, and the build system, win32 means windows, so we keep
# everything as terget win32, but add the CONFIG_SUBTYPE win64, which can
# be handled by configure, setting WINDOWS_64BIT in headers and such
+echo_env_win64 ()
+{
+ #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
+ # Try to cope with paths containing unexpected things like stray
+ # mixed paths (c:/something/bin) and quotes. Only C and D drive
+ # handled.
+ CCYGPATH=`cygpath c:\\`
+ DCYGPATH=`cygpath d:\\`
+ P2=`echo :$PATH | \
+ sed "s,\",,g;s,:[cC]:,:$CCYGPATH,g;s,:[dD]:,:$DCYGPATH,g;s,^:,,"`
+ P3=""
+ save_ifs=$IFS
+ IFS=:
+ for p in $P2; do
+ if [ -d "$p" ]; then
+ C1="`(cygpath -d $p 2>/dev/null || cygpath -w $p)`" 2> /dev/null
+ C2=`cygpath "$C1" 2> /dev/null` 2> /dev/null
+ else
+ C2=""
+ fi
+ if [ ! -z "$C2" ]; then
+ if [ -z "$P3" ];then
+ P3="$C2"
+ else
+ P3="$P3:$C2"
+ fi
+ fi
+ done
+ IFS=$save_ifs
+ WIN32_WRAPPER_PATH="$ERL_TOP/erts/etc/win32/cygwin_tools/vc:$ERL_TOP/erts/etc/win32/cygwin_tools"
+
+
+ echo_setenv OVERRIDE_TARGET win32 ';'
+ echo_setenv CONFIG_SUBTYPE win64 ';'
+ echo_setenv CC cc.sh ';'
+ echo_setenv CXX cc.sh ';'
+ echo_setenv AR ar.sh ';'
+ echo_setenv RANLIB true ';'
+ 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" ';'
+ echo_setenv WIN32_WRAPPER_PATH "$WIN32_WRAPPER_PATH" ';'
+ echo_setenv PATH "$WIN32_WRAPPER_PATH:$P3" ';'
+ echo_envinfo
+}
+
+echo_env_msys32 ()
+{
+ #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
+ # Try to cope with paths containing unexpected things like stray
+ # mixed paths (c:/something/bin) and quotes. Only C and D drive
+ # handled.
+ P2=`echo :$PATH | \
+ sed "s,\",,g;s,:\([a-zA-Z]\):,:/\L\1,g;s,^:,,"`
+ P3=""
+ save_pwd=`pwd`
+ save_ifs=$IFS
+ IFS=:
+ for p in $P2; do
+ if [ -d "$p" ]; then
+ C1=`(cd "$p" && cmd //C "for %i in (".") do @echo %~fsi")`
+ C2=`echo "$C1" | sed 's,^\([a-zA-Z]\):\\\\,/\L\1/,;s,\\\\,/,g'`
+ else
+ C2=""
+ fi
+ if [ ! -z "$C2" ]; then
+ if [ -z "$P3" ];then
+ P3="$C2"
+ else
+ P3="$P3:$C2"
+ fi
+ fi
+ done
+ IFS=$save_ifs
+ WIN32_WRAPPER_PATH="$ERL_TOP/erts/etc/win32/msys_tools/vc:$ERL_TOP/erts/etc/win32/msys_tools"
+
+ echo_setenv OVERRIDE_TARGET win32 ';'
+ echo_setenv CC cc.sh ';'
+ echo_setenv CXX cc.sh ';'
+ echo_setenv AR ar.sh ';'
+ echo_setenv RANLIB true ';'
+ 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" ';'
+ echo_setenv WIN32_WRAPPER_PATH "$WIN32_WRAPPER_PATH" ';'
+ echo_setenv PATH "$WIN32_WRAPPER_PATH:$P3" ';'
+ echo_envinfo
+}
+
+
echo_env_msys64 ()
{
#echo_envinfo
@@ -900,11 +1023,8 @@ echo_env_msys64 ()
IFS=:
for p in $P2; do
if [ -d "$p" ]; then
- #echo 'p =' "|$p|"
C1=`(cd "$p" && cmd //C "for %i in (".") do @echo %~fsi")`
- #echo 'C1 =' "|$C1|"
C2=`echo "$C1" | sed 's,^\([a-zA-Z]\):\\\\,/\L\1/,;s,\\\\,/,g'`
- #echo 'C2 =' "|$C2|"
else
C2=""
fi
@@ -1178,7 +1298,7 @@ BUILDSYS=$TARGET
case $TARGET in
*-cygwin)
if [ X"$BUILD_FOR_CYGWIN" = X"" ]; then
- if [ X"$OVERRIDE_TARGET" = X"" -a X"$1" != X"env_win32" -a X"$1" != X"env_mingw32" ];then
+ if [ X"$OVERRIDE_TARGET" = X"" -a X"$1" != X"env_win32" -a X"$1" != X"env_win64" -a X"$1" != X"env_mingw32" ];then
echo "Building for windows, you should do the " \
"following first:" >&2
echo 'eval `./otp_build env_win32`' >&2
@@ -1188,7 +1308,7 @@ case $TARGET in
fi
fi;;
*-mingw32)
- if [ X"$OVERRIDE_TARGET" = X"" -a X"$1" != X"env_msys64" ];then
+ if [ 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 for windows, you should do the " \
"following first:" >&2
echo 'eval `./otp_build env_msys64`' >&2
@@ -1324,9 +1444,23 @@ case "$1" in
fi;
do_debuginfo_win32 "$2";;
env_win32)
- echo_env_win32;;
+ if [ x"$2" = x"x64" -o x"$2" = x"amd64" ]; then
+ if [ -x /usr/bin/msysinfo ]; then
+ echo_env_msys64
+ else
+ echo_env_win64
+ fi
+ else
+ if [ -x /usr/bin/msysinfo ]; then
+ echo_env_msys32
+ else
+ echo_env_win32
+ fi
+ fi;;
env_mingw32)
echo_env_mingw32;;
+ env_win64)
+ echo_env_win64;;
env_msys64)
echo_env_msys64;;
env_vxworks)