Port bug 762358 - .mozconfig changes don't cause configure to run - to comm-central to fix unit test sync dirs bustage. r=bustage-fix
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 07 Jun 2012 12:12:10 +0200
changeset 12701 edc7794adaf5429688b2ec302dba876780934780
parent 12700 c7c81c0bcc94a0c1a02369b69ffb6d260451fa79
child 12702 8cce5c4cbec8bc7250117295affbfa013505ecf6
push idunknown
push userunknown
push dateunknown
reviewersbustage-fix
bugs762358
Port bug 762358 - .mozconfig changes don't cause configure to run - to comm-central to fix unit test sync dirs bustage. r=bustage-fix
build/autoconf/mozconfig2client-mk
client.mk
--- a/build/autoconf/mozconfig2client-mk
+++ b/build/autoconf/mozconfig2client-mk
@@ -6,87 +6,77 @@
 
 # mozconfig2client-mk - Translates .mozconfig into options for client.mk.
 #    Prints defines to stdout.
 #
 # See mozconfig2configure for more details
 
 print_header() {
   _mozconfig=${MOZCONFIG:-$HOME/.mozconfig}
-  cat >> $tmp_file <<EOF
+  cat <<EOF
 # gmake
 # This file is automatically generated for client.mk.
 # Do not edit. Edit $_mozconfig instead.
 
 EOF
 }
 
 ac_add_options() {
-  echo "# $* is used by configure (not client.mk)" >> $tmp_file
+  echo "# $* is used by configure (not client.mk)"
 }
 
 ac_add_app_options() {
-  echo "# $* is used by configure (not client.mk)" >> $tmp_file
+  echo "# $* is used by configure (not client.mk)"
 }
 
 mk_add_options() {
   for _opt
   do
     # Escape shell characters, space, tab, dollar, quote, backslash,
     # and substitute '@<word>@' with '$(<word>)'.
     _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'`
     echo $_opt;
     opts="${opts:+$opts^}$_opt";
-  done >> $tmp_file
+  done
 }
 
 mk_echo_options() {
-  echo "Adding client.mk options from $FOUND_MOZCONFIG:"
+  echo "Adding client.mk options from $FOUND_MOZCONFIG:" >&2
   IFS=^
   for _opt in $opts; do
-    echo "    $_opt"
+    echo "    $_opt" >&2
   done
 }
 
 # Main
 #--------------------------------------------------
 
 scriptdir=`dirname $0`
 topsrcdir=$1
-out_file=$2
-tmp_file="$out_file-tmp$$"
 opts=""
 
-trap "rm -f $tmp_file; exit 1" 1 2 15
-
-print_header > $tmp_file
+print_header
 
 # If the path changes, configure should be rerun
-echo "# PATH=$PATH" >> $tmp_file
+echo "# PATH=$PATH"
 
 # If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out
 isfoundset=${FOUND_MOZCONFIG+yes}
 if [ -z $isfoundset ]; then
   FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir`
   if [ $? -ne 0 ]; then
-    echo '$(error Fix above errors before continuing.)' >> $tmp_file
+    echo '$(error Fix above errors before continuing.)'
   else
     isfoundset=yes
   fi
 fi
 
 if [ -n $isfoundset ]; then
   if [ "$FOUND_MOZCONFIG" ]
   then
     . "$FOUND_MOZCONFIG"
   fi
-  echo "export FOUND_MOZCONFIG := $FOUND_MOZCONFIG" >> $tmp_file
+  echo "export FOUND_MOZCONFIG := $FOUND_MOZCONFIG"
 
   if [ "$opts" ]; then
     mk_echo_options
   fi
 fi
-
-if test -f $out_file && cmp -s $tmp_file $out_file; then
-  rm $tmp_file
-else
-  mv -f $tmp_file $out_file
-fi
--- a/client.mk
+++ b/client.mk
@@ -94,20 +94,22 @@ endif
 # Load mozconfig Options
 
 # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
 
 MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk
 MOZCONFIG_FINDER := build/autoconf/mozconfig-find
 MOZCONFIG_MODULES := build/unix/uniq.pl
 
-run_for_side_effects := \
-  $(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) $(TOPSRCDIR)/.mozconfig.mk > $(TOPSRCDIR)/.mozconfig.out)
+define CR
+
 
-include $(TOPSRCDIR)/.mozconfig.mk
+endef
+
+$(eval $(subst ||,$(CR),$(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/')))
 
 ifndef MOZ_OBJDIR
   MOZ_OBJDIR = obj-$(CONFIG_GUESS)
 else
 # On Windows Pymake builds check MOZ_OBJDIR doesn't start with "/"
   ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
   ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(MOZ_OBJDIR))))
   $(error For Windows Pymake builds, MOZ_OBJDIR must be a Windows [and not MSYS] style path.)