Bug 762358 - Don't create a .mozconfig.mk file, and re-run configure when .mozconfig changed. r=ted

This commit is contained in:
Mike Hommey 2012-06-19 09:12:43 +02:00
Родитель 0a66a023f2
Коммит 39147d2cc2
2 изменённых файлов: 19 добавлений и 24 удалений

Просмотреть файл

@ -11,7 +11,7 @@
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.
@ -20,11 +20,11 @@ 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() {
@ -35,14 +35,14 @@ mk_add_options() {
_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
}
@ -51,23 +51,19 @@ mk_echo_options() {
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
@ -78,15 +74,9 @@ if [ -n $isfoundset ]; then
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

Просмотреть файл

@ -95,10 +95,15 @@ 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
# As $(shell) doesn't preserve newlines, use sed to replace them with an
# unlikely sequence (||), which is then replaced back to newlines by make
# before evaluation.
$(eval $(subst ||,$(CR),$(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/')))
ifndef MOZ_OBJDIR
MOZ_OBJDIR = obj-$(CONFIG_GUESS)
@ -293,7 +298,7 @@ configure-preqs = \
save-mozconfig \
$(NULL)
save-mozconfig:
save-mozconfig: $(FOUND_MOZCONFIG)
-cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig
configure:: $(configure-preqs)