aboutsummaryrefslogtreecommitdiffstats
path: root/kerl
diff options
context:
space:
mode:
Diffstat (limited to 'kerl')
-rwxr-xr-xkerl65
1 files changed, 61 insertions, 4 deletions
diff --git a/kerl b/kerl
index 11d6fe2..090021d 100755
--- a/kerl
+++ b/kerl
@@ -30,6 +30,7 @@ KERL_VERSION="1.3.4"
GREP_OPTIONS=''
ERLANG_DOWNLOAD_URL="http://www.erlang.org/download"
+KERL_CONFIG_STORAGE_FILENAME=".kerl_config"
if [ -z "$HOME" ]; then
echo "Error: \$HOME is empty or not set." 1>&2
@@ -68,6 +69,9 @@ fi
if [ -n "$KERL_INSTALL_MANPAGES" ]; then
_KIM="$KERL_INSTALL_MANPAGES"
fi
+if [ -n "$KERL_INSTALL_HTMLDOCS" ]; then
+ _KIHD="$KERL_INSTALL_HTMLDOCS"
+fi
if [ -n "$KERL_BUILD_PLT" ]; then
_KBPLT="$KERL_BUILD_PLT"
fi
@@ -85,6 +89,7 @@ KERL_SASL_STARTUP=
KERL_DEPLOY_SSH_OPTIONS=
KERL_DEPLOY_RSYNC_OPTIONS=
KERL_INSTALL_MANPAGES=
+KERL_INSTALL_HTMLDOCS=
KERL_BUILD_PLT=
KERL_BUILD_DOCS=
KERL_BUILD_BACKEND=
@@ -119,6 +124,9 @@ fi
if [ -n "$_KIM" ]; then
KERL_INSTALL_MANPAGES="$_KIM"
fi
+if [ -n "$_KIHD" ]; then
+ KERL_INSTALL_HTMLDOCS="$_KIHD"
+fi
if [ -n "$_KBPLT" ]; then
KERL_BUILD_PLT="$_KBPLT"
fi
@@ -571,6 +579,31 @@ _do_build()
ERL_TOP="$KERL_BUILD_DIR/$2/otp_src_$1"
cd "$ERL_TOP" || exit 1
LOGFILE="$KERL_BUILD_DIR/$2/otp_build_$1.log"
+
+ # Check to see if configuration options need to be stored or have changed
+ TMPOPT="/tmp/kerloptions.$$"
+ echo "$CFLAGS" > "$TMPOPT"
+ echo "$KERL_CONFIGURE_OPTIONS" >> "$TMPOPT"
+ SUM=$($MD5SUM "$TMPOPT" | cut -d ' ' -f $MD5SUM_FIELD)
+ # Check for a .kerl_config.md5 file
+ if [ -e "./$KERL_CONFIG_STORAGE_FILENAME.md5" ]; then
+ # Compare our current options to the saved ones
+ OLD_SUM=read -r < "./$KERL_CONFIG_STORAGE_FILENAME.md5"
+ if [ "$SUM" -ne "$OLD_SUM" ]; then
+ echo "Configure options have changed. Reconfiguring..."
+ rm -f configure
+ mv "$TMPOPT" "./$KERL_CONFIG_STORAGE_FILENAME"
+ echo "$SUM" > "./$KERL_CONFIG_STORAGE_FILENAME.md5"
+ else
+ # configure options are the same
+ rm -f "$TMPOPT"
+ fi
+ else
+ # no file exists, so write one
+ mv "$TMPOPT" ./.kerl_config
+ echo "$SUM" > ./.kerl_config.md5
+ fi
+
# Don't apply patches to "custom" git builds. We have no idea if they will apply
# cleanly or not.
if [ "$1" != "git" ]; then
@@ -620,6 +653,7 @@ _do_build()
fi
done
fi
+
CFLAGS="$CFLAGS" ./otp_build boot -a $KERL_CONFIGURE_OPTIONS >> "$LOGFILE" 2>&1
if [ $? -ne 0 ]; then
show_logfile "Build failed." "$LOGFILE"
@@ -836,7 +870,7 @@ if ( -f "$KERL_CONFIG.csh" ) then
endif
if ( \$?KERL_ENABLE_PROMPT ) then
- set _KERL_SAVED_PROMP = "\$prompt"
+ set _KERL_SAVED_PROMPT = "\$prompt"
if ( \$?KERL_PROMPT_FORMAT ) then
set FRMT = "\$KERL_PROMPT_FORMAT"
@@ -874,6 +908,9 @@ ACTIVATE_CSH
fi
fi
+ KERL_CONFIG_STORAGE_PATH="$KERL_BUILD_DIR/$1/otp_src_$rel/$KERL_CONFIG_STORAGE_FILENAME"
+ [ -e "$KERL_CONFIG_STORAGE_PATH" ] && cp "$KERL_CONFIG_STORAGE_PATH" "$absdir/$KERL_CONFIG_STORAGE_FILENAME"
+
if [ -n "$KERL_BUILD_PLT" ]; then
echo "Building Dialyzer PLT..."
build_plt "$absdir"
@@ -923,7 +960,7 @@ build_plt()
do_plt()
{
- ACTIVE_PATH=`get_active_path`
+ ACTIVE_PATH="$1"
if [ -n "$ACTIVE_PATH" ]; then
plt=$ACTIVE_PATH/dialyzer/plt
if [ -f "$plt" ]; then
@@ -940,6 +977,19 @@ do_plt()
fi
}
+print_buildopts()
+{
+ buildopts="$1/$KERL_CONFIG_STORAGE_FILENAME"
+ if [ -f "$buildopts" ]; then
+ echo "The build options for the active installation are:"
+ cat "$buildopts"
+ return 0
+ else
+ echo "The build options for the active installation are not available."
+ return 1
+ fi
+}
+
do_deploy()
{
if [ -z "$1" ]; then
@@ -1537,7 +1587,7 @@ case "$1" in
fi
;;
plt)
- if ! do_plt; then
+ if ! do_plt get_active_path; then
exit 1;
fi
;;
@@ -1549,7 +1599,14 @@ case "$1" in
list_print installations
echo "----------"
if do_active; then
- do_plt
+ ACTIVE_PATH=`get_active_path`
+ if [ -n "$ACTIVE_PATH" ]; then
+ do_plt "$ACTIVE_PATH"
+ print_buildopts "$ACTIVE_PATH"
+ else
+ echo "No Erlang/OTP installation is currently active."
+ exit 1
+ fi
fi
exit 0
;;