aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Allen <[email protected]>2017-02-02 20:02:01 -0600
committerMark Allen <[email protected]>2017-02-02 20:02:01 -0600
commitda69d269d0e58f207bc361abbefad529f6b5a453 (patch)
tree25399fab07ff4080e3c061bf92d5ff759f1854f8
parent0484b5cfaf72e44be5d058e623f28b70d3cac311 (diff)
downloadkerl-config.tar.gz
kerl-config.tar.bz2
kerl-config.zip
Store build configuration in a fileconfig
This change implements storing the build configuration in a file which can later be compared to a potentially new configuration which might trigger the need to re-run the OTP configuration steps. We also copy the build configuration into the installation directory so that at some future time we can write or enhance a command which shows the build configuration. Addresses #162 #158
-rwxr-xr-xkerl30
1 files changed, 30 insertions, 0 deletions
diff --git a/kerl b/kerl
index a494256..8a6eb8b 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
@@ -549,6 +550,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
@@ -598,6 +624,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"
@@ -852,6 +879,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"