aboutsummaryrefslogtreecommitdiffstats
path: root/otp_build
diff options
context:
space:
mode:
Diffstat (limited to 'otp_build')
-rwxr-xr-xotp_build360
1 files changed, 321 insertions, 39 deletions
diff --git a/otp_build b/otp_build
index 44bbab22b5..85be25a8a1 100755
--- a/otp_build
+++ b/otp_build
@@ -2,7 +2,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 2002-2011. All Rights Reserved.
+# Copyright Ericsson AB 2002-2012. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -51,7 +51,6 @@ usage ()
echo " release <target_dir> - creates a small release to <target_dir>"
echo " release [-a] <target_dir> - creates full release to <target_dir>"
echo " smp [-a] - build an Erlang system, smp flavor only"
- echo " hybrid [-a] - build an Erlang system, hybrid flavor only"
echo " tests <dir> - Build testsuites to <dir>"
echo ""
echo "These are for cleaning up an open source distribution"
@@ -65,8 +64,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 " - 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"
@@ -76,7 +83,7 @@ usage ()
;;
git)
echo ""
- echo "update_primary - build and commit a new primary bootstrap"
+ echo "update_primary [--no-commit] - build and maybe commit a new primary bootstrap"
;;
esac
@@ -85,7 +92,7 @@ usage ()
;;
git)
echo ""
- echo "update_preloaded - build and commit the preloaded modules"
+ echo "update_preloaded [--no-commit] - build and maybe commit the preloaded modules"
;;
esac
}
@@ -174,9 +181,9 @@ set_config_flags ()
# the cross configuration have been moved here).
if target_contains linux; then
- XX=`echo $* | grep -v able-hipe`
+ XX=`echo $* | grep -v able-fp-exceptions`
if [ "$*" = "$XX" ]; then
- CONFIG_FLAGS="$CONFIG_FLAGS --disable-hipe"
+ CONFIG_FLAGS="$CONFIG_FLAGS --disable-fp-exceptions"
fi
fi
if target_contains "univel-sysv4"; then
@@ -255,9 +262,62 @@ create_lib_configure_in()
}
}
+find_sum()
+{
+ candidates="sum cksum md5sum sha1sum"
+ SUM_CMD="wc"
+ for x in $candidates; do
+ if (echo foo | $x > /dev/null 2>&1); then
+ SUM_CMD=$x
+ break
+ fi
+ done
+}
+
+chk_eq()
+{
+ master=$1
+ shift
+ slaves="$@"
+ master_sum=`$SUM_CMD $master | awk '{print $1}'`
+ for x in $slaves; do
+ 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
+ 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
+}
+
+check_config_helpers ()
+{
+
+ aclocals="./aclocal.m4 ./lib/erl_interface/aclocal.m4 ./lib/odbc/aclocal.m4 ./lib/wx/aclocal.m4"
+ install_shs="./lib/common_test/priv/auxdir/install-sh ./lib/erl_interface/src/auxdir/install-sh ./lib/test_server/src/install-sh"
+ config_guesses="./lib/common_test/priv/auxdir/config.guess ./lib/erl_interface/src/auxdir/config.guess ./lib/test_server/src/config.guess"
+ config_subs="./lib/common_test/priv/auxdir/config.sub ./lib/erl_interface/src/auxdir/config.sub ./lib/test_server/src/config.sub"
+
+ aclocal_master="./erts/aclocal.m4"
+ install_sh_master="./erts/autoconf/install-sh"
+ config_guess_master="./erts/autoconf/config.guess"
+ config_sub_master="./erts/autoconf/config.sub"
+
+ find_sum
+
+ chk_eq $aclocal_master $aclocals
+ chk_eq $install_sh_master $install_shs
+ chk_eq $config_guess_master $config_guesses
+ chk_eq $config_sub_master $config_subs
+
+}
+
do_autoconf ()
{
create_lib_configure_in
+ check_config_helpers
if target_contains win32; then
# Select the correct autoconf on cygwin
@@ -324,16 +384,6 @@ do_autoconf ()
fi
}
-mk_targetdir ()
-{
- if [ ! -d $ERL_TOP/$TARGET ]; then
- echo "creating $ERL_TOP/$TARGET"
- mkdir $ERL_TOP/$TARGET
- else
- echo "existing $ERL_TOP/$TARGET is used"
- fi
-}
-
run_configure ()
{
cdir="$ERL_TOP"
@@ -491,6 +541,7 @@ maybe_copy_static_cache ()
{
if [ '!' -z "$OVERRIDE_CONFIG_CACHE_STATIC" ]; then
if [ '!' -z "$OVERRIDE_CONFIG_CACHE" ]; then
+ echo "Copying static configure cache $OVERRIDE_CONFIG_CACHE_STATIC to $OVERRIDE_CONFIG_CACHE"
cp -f "$OVERRIDE_CONFIG_CACHE_STATIC" "$OVERRIDE_CONFIG_CACHE"
fi
fi
@@ -499,7 +550,6 @@ maybe_copy_static_cache ()
do_configure ()
{
setup_make
- mk_targetdir
# Get `erl_build_tool_vars'
. "$ERL_TOP/erl-build-tool-vars.sh" || exit 1
@@ -513,7 +563,6 @@ do_configure ()
hide_vars OVERRIDE_TARGET TARGET
TARGET=$BUILDSYS
export TARGET
- mk_targetdir
set_config_flags "$@"
run_configure "$@"
restore_vars OVERRIDE_TARGET TARGET;;
@@ -743,7 +792,9 @@ echo_env_win32 ()
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 CC cc.sh ';'
echo_setenv CXX cc.sh ';'
@@ -753,7 +804,8 @@ echo_env_win32 ()
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 PATH "$ERL_TOP/erts/etc/win32/cygwin_tools/vc:$ERL_TOP/erts/etc/win32/cygwin_tools:$P3" ';'
+ echo_setenv WIN32_WRAPPER_PATH "$WIN32_WRAPPER_PATH" ';'
+ echo_setenv PATH "$WIN32_WRAPPER_PATH:$P3" ';'
echo_envinfo
}
@@ -815,6 +867,7 @@ echo_env_mingw32 ()
echo "needed for message file compilation: http://wine.sourceforge.net!!" >&2
return
fi
+ WIN32_WRAPPER_PATH="$ERL_TOP/erts/etc/win32/cygwin_tools/mingw:$ERL_TOP/erts/etc/win32/cygwin_tools"
echo_setenv OVERRIDE_TARGET win32 ';'
@@ -824,10 +877,184 @@ echo_env_mingw32 ()
echo_setenv CXX cc.sh ';'
echo_setenv AR ar.sh ';'
echo_setenv RANLIB true ';'
- echo_setenv PATH "$ERL_TOP/erts/etc/win32/cygwin_tools/mingw:$ERL_TOP/erts/etc/win32/cygwin_tools:$P3"
+ echo_setenv WIN32_WRAPPER_PATH "$WIN32_WRAPPER_PATH" ';'
+ echo_setenv PATH "$WIN32_WRAPPER_PATH:$P3" ';'
+ echo_envinfo
+}
+
+# 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
+ 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 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
+}
+
+
lookup_prog_in_path ()
{
PROG=$1
@@ -866,33 +1093,61 @@ setup_make ()
fi
export MAKE
}
-
+
+get_do_commit ()
+{
+ if [ "x$1" = "x" ]; then
+ do_commit=true
+ elif [ "$1" = "--no-commit" ]; then
+ do_commit=false
+ else
+ echo "Unknown option '$1'" 1>&2
+ exit 1
+ fi
+}
+
do_primary_git ()
{
+ get_do_commit $1
setup_make
if [ "x$OVERRIDE_TARGET" != "x" -a "x$OVERRIDE_TARGET" != "xwin32" ]; then
do_primary_cross
else
$MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET primary_bootstrap || exit 1;
fi
- git add -A bootstrap/lib/kernel \
- bootstrap/lib/stdlib \
- bootstrap/lib/compiler \
- bootstrap/bin
- find bootstrap -name egen -o -name '*.script' -o \
- -name '*.app' -o -name '*.appup' |
+ if [ $do_commit = true ]; then
+ git add -A bootstrap/lib/kernel \
+ bootstrap/lib/stdlib \
+ bootstrap/lib/compiler \
+ bootstrap/bin
+ find bootstrap -name egen -o -name '*.script' -o \
+ -name '*.app' -o -name '*.appup' |
xargs git reset HEAD
- git commit --no-verify -m 'Update primary bootstrap'
+ git commit --no-verify -m 'Update primary bootstrap'
+ echo "Primary bootstrap updated and commited."
+ else
+ echo ""
+ echo "Primary bootstrap rebuilt. Use \"git add bootstrap/...\" to stage changed files."
+ echo ""
+ fi
}
do_update_prel_git ()
{
+ get_do_commit $1
setup_make
(cd $ERL_TOP/erts/preloaded/src && $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET clean)
$MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET preloaded || exit 1
(cd $ERL_TOP/erts/preloaded/src && $MAKE MAKE="$MAKE" BOOTSTRAP_ROOT=$BOOTSTRAP_ROOT TARGET=$TARGET copy)
- git add -A $ERL_TOP/erts/preloaded/ebin/*.beam
- git commit -m 'Update preloaded modules'
+ if [ $do_commit = true ]; then
+ git add -A $ERL_TOP/erts/preloaded/ebin/*.beam
+ git commit -m 'Update preloaded modules'
+ echo "Preloaded updated and commited."
+ else
+ echo ""
+ echo "Preloaded rebuilt. Use \"git add erts/preloaded/ebin/...\" to stage changed beam files."
+ echo ""
+ fi
}
do_boot ()
@@ -1053,8 +1308,8 @@ cd $ERL_TOP
determine_version_controller
-# Unset ERL_FLAGS and ERL_<Release>_FLAGS to prevent, for instance,
-# a value of "-hybrid" to run the hybrid emulator during bootstrap.
+# Unset ERL_FLAGS and ERL_<Release>_FLAGS during bootstrap to
+# prevent potential problems
sys_vsn=`awk '/SYSTEM_VSN = / {print $3}' < erts/vsn.mk`
sys_erl_flags="ERL_${sys_vsn}_FLAGS"
unset ERL_FLAGS
@@ -1070,7 +1325,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
@@ -1079,8 +1334,19 @@ case $TARGET in
exit 1
fi
fi;;
+ *-mingw32)
+ 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_win32`' >&2
+ echo 'or' >&2
+ echo 'eval `./otp_build env_win32 x64`' >&2
+ echo 'please note that there are backticks (``) in' \
+ 'the command'
+ exit 1
+ fi;;
*)
- ;;
+ ;;
esac
if [ ! -z "$OVERRIDE_TARGET" ]; then
@@ -1153,7 +1419,7 @@ case "$1" in
do_lazy_configure_target_clean;;
opt)
do_boot;;
- plain|smp|hybrid)
+ plain|smp)
if [ $minus_a_flag = false ]; then
TYPE=opt
fi;
@@ -1164,12 +1430,12 @@ case "$1" in
do_boot;;
update_primary)
case $version_controller in
- git) do_primary_git ;;
+ git) do_primary_git "$2";;
none) git_required ;;
esac ;;
update_preloaded)
case $version_controller in
- git) do_update_prel_git ;;
+ git) do_update_prel_git "$2";;
none) git_required ;;
esac ;;
primary)
@@ -1207,9 +1473,25 @@ 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)
echo_env_vxworks "$2";;
env_cross)