diff options
Diffstat (limited to 'otp_build')
-rwxr-xr-x | otp_build | 74 |
1 files changed, 43 insertions, 31 deletions
@@ -52,7 +52,7 @@ usage () echo " release [-a] <target_dir> - creates full release to <target_dir>" echo " smp [-a] - build an Erlang system, smp flavor only" echo " tests <dir> - Build testsuites to <dir>" - echo " patch_app <target_dir> <app1>... - build given apps to <target_dir>" + echo " patch_app [-f] <target_dir> <app1>... - build given apps to <target_dir>" echo " If core apps are patched, new start scripts will be created" echo " and 'Install' must be run again." echo "" @@ -1209,25 +1209,37 @@ do_patch_app () if [ X`$MAKE is_cross_configured` = Xyes ]; then TARGET=`$MAKE target_configured` fi + if [ "x$1" = "x-f" ]; then + force="-force" + shift + else + force= + fi target_dir=$1 - if [ ! -d $target_dir/releases/$otp_major_vsn ]; then + if [ ! -d "$target_dir/releases/$otp_major_vsn" ]; then echo "No OTP $otp_major_vsn installation in $target_dir" 1>&2 exit 1 fi shift - otp_version=`cat "$target_dir/OTP_VERSION"` || { echo "Not able to read $target_dir/OTP_VERSION" 1>&2; exit 1; } - { echo "$otp_version" | sed "s|^\([^\*]*\)\**|\1\*\*|g" > $target_dir/OTP_VERSION; } 2>/dev/null || { echo "Not able to update $target_dir/OTP_VERSION" 1>&2; exit 1; } + otp_version=`cat "$target_dir/releases/$otp_major_vsn/OTP_VERSION"` || { echo "Not able to read $target_dir/releases/$otp_major_vsn/OTP_VERSION" 1>&2; exit 1; } + { echo "$otp_version" | sed "s|^\([^\*]*\)\**|\1\*\*|g" > "$target_dir/releases/$otp_major_vsn/OTP_VERSION"; } 2>/dev/null || { echo "Not able to update $target_dir/OTP_VERSION" 1>&2; exit 1; } + + PATH="$ERL_TOP/bootstrap/bin:$PATH" $ERL_TOP/make/verify_runtime_dependencies -release "$otp_major_vsn" -source "$ERL_TOP" -target "$target_dir" $force "$@" + + if [ $? -ne 0 ]; then + exit $? + fi # Build all applications to target for app in "$@"; do if [ "$app" = "erts" ] && [ -d $ERL_TOP/$app ]; then (cd $ERL_TOP/$app && $MAKE MAKE="$MAKE" TARGET=$TARGET \ - TESTROOT=$target_dir release) || exit 1 + TESTROOT="$target_dir" release) || exit 1 elif [ "$app" != "erts" ] && [ -d $ERL_TOP/lib/$app ]; then (cd $ERL_TOP/lib/$app && $MAKE MAKE="$MAKE" TARGET=$TARGET \ - TESTROOT=$target_dir release) || exit 1 + TESTROOT="$target_dir" release) || exit 1 else echo "Invalid application $app" 1>&2 exit 1 @@ -1254,19 +1266,19 @@ do_patch_app () # and find the old versions for those not included if [ "X$update_rel" != "X" ]; then if [ "X$erts_vsn" = "X" ]; then - erts_vsns=`ls -d $target_dir/erts-* | sed "s|$target_dir/erts-\([0-9\.].*\)|\1|g"` + erts_vsns=`ls -d "$target_dir"/erts-* | sed "s|$target_dir/erts-\([0-9\.].*\)|\1|g"` erts_vsn=`echo "$erts_vsns" | sort -t '.' -g | tail -n 1` fi if [ "X$kernel_vsn" = "X" ]; then - kernel_vsns=`ls -d $target_dir/lib/kernel-* | sed "s|$target_dir/lib/kernel-\([0-9\.].*\)|\1|g"` + kernel_vsns=`ls -d "$target_dir"/lib/kernel-* | sed "s|$target_dir/lib/kernel-\([0-9\.].*\)|\1|g"` kernel_vsn=`echo "$kernel_vsns" | sort -t '.' -g | tail -n 1` fi if [ "X$stdlib_vsn" = "X" ]; then - stdlib_vsns=`ls -d $target_dir/lib/stdlib-* | sed "s|$target_dir/lib/stdlib-\([0-9\.].*\)|\1|g"` + stdlib_vsns=`ls -d "$target_dir"/lib/stdlib-* | sed "s|$target_dir/lib/stdlib-\([0-9\.].*\)|\1|g"` stdlib_vsn=`echo "$stdlib_vsns" | sort -t '.' -g | tail -n 1` fi if [ "X$sasl_vsn" = "X" ]; then - sasl_vsns=`ls -d $target_dir/lib/sasl-* | sed "s|$target_dir/lib/sasl-\([0-9\.].*\)|\1|g"` + sasl_vsns=`ls -d "$target_dir"/lib/sasl-* | sed "s|$target_dir/lib/sasl-\([0-9\.].*\)|\1|g"` sasl_vsn=`echo "$sasl_vsns" | sort -t '.' -g | tail -n 1` fi @@ -1274,42 +1286,42 @@ do_patch_app () start_clean="{release, {\"OTP APN 181 01\",\"$otp_major_vsn\"}, {erts, \"$erts_vsn\"},\n [{kernel,\"$kernel_vsn\"},\n {stdlib,\"$stdlib_vsn\"}]}.\n" start_sasl="{release, {\"OTP APN 181 01\",\"$otp_major_vsn\"}, {erts, \"$erts_vsn\"},\n [{kernel,\"$kernel_vsn\"},\n {stdlib,\"$stdlib_vsn\"},\n {sasl,\"$sasl_vsn\"}]}.\n" - tmp_dir=$target_dir/tmp; - if [ ! -d $tmp_dir ]; then - mkdir $tmp_dir + tmp_dir="$target_dir/tmp"; + if [ ! -d "$tmp_dir" ]; then + mkdir "$tmp_dir" fi - echo $start_sasl > $tmp_dir/start_sasl.rel - echo $start_clean > $tmp_dir/start_clean.rel - echo $start_clean > $tmp_dir/no_dot_erlang.rel + echo "$start_sasl" > "$tmp_dir/start_sasl.rel" + echo "$start_clean" > "$tmp_dir/start_clean.rel" + echo "$start_clean" > "$tmp_dir/no_dot_erlang.rel" - erlc=$ERL_TOP/bootstrap/bin/erlc - if [ ! -x $erlc ]; then + erlc="$ERL_TOP/bootstrap/bin/erlc" + if [ ! -x "$erlc" ]; then echo "erlc not found, can not create .script and .boot files" 1>&2 exit 1 fi - $erlc -I$target_dir/lib/*/ebin -o$tmp_dir $tmp_dir/start_sasl.rel || exit 1 - $erlc -I$target_dir/lib/*/ebin -o$tmp_dir +no_warn_sasl $tmp_dir/start_clean.rel || exit 1 - $erlc -I$target_dir/lib/*/ebin -o$tmp_dir +no_warn_sasl +no_dot_erlang $tmp_dir/no_dot_erlang.rel || exit 1 + $erlc -I"$target_dir"/lib/*/ebin -o$tmp_dir $tmp_dir/start_sasl.rel || exit 1 + $erlc -I"$target_dir"/lib/*/ebin -o$tmp_dir +no_warn_sasl $tmp_dir/start_clean.rel || exit 1 + $erlc -I"$target_dir"/lib/*/ebin -o$tmp_dir +no_warn_sasl +no_dot_erlang $tmp_dir/no_dot_erlang.rel || exit 1 # Generate RELEASES file - erl=$ERL_TOP/bootstrap/bin/erl - if [ ! -x $erl ]; then + erl="$ERL_TOP/bootstrap/bin/erl" + if [ ! -x "$erl" ]; then echo "erl not found, can not create RELEASES file" 1>&2 exit 1 fi - $erl -noinput +B -eval "release_handler:create_RELEASES(\"%ERL_ROOT%\", \"$tmp_dir\", \"$tmp_dir/start_sasl.rel\", []), halt()" || exit 1 + "$erl" -noinput +B -eval "release_handler:create_RELEASES(\"%ERL_ROOT%\", \"$tmp_dir\", \"$tmp_dir/start_sasl.rel\", []), halt()" || exit 1 # If all good so far, move generated files into target area - mv $tmp_dir/RELEASES $target_dir/releases/RELEASES.src - mv $tmp_dir/* $target_dir/releases/$otp_major_vsn - rmdir $tmp_dir + mv "$tmp_dir/RELEASES" "$target_dir/releases/RELEASES.src" + mv "$tmp_dir"/* "$target_dir/releases/$otp_major_vsn" + rmdir "$tmp_dir" # Remove old start scripts (forces a new run of Install) - rm -f $target_dir/releases/RELEASES - rm -f $target_dir/bin/*.script - rm -f $target_dir/bin/*.boot - rm -f $target_dir/bin/erl + rm -f "$target_dir"/releases/RELEASES + rm -f "$target_dir"/bin/*.script + rm -f "$target_dir"/bin/*.boot + rm -f "$target_dir"/bin/erl fi } |