Bug 861453 - Restore empty substs after bug 857557, but put them in a separate file, unlisted as a dependency for everything. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 16 Apr 2013 08:23:18 +0200
changeset 128943 2248290342c9de4ad264ceb2447e32d1f6f98565
parent 128942 ba88d9730af65d8c6223f5e42761a144428cc475
child 128944 11336b456004a26bddc089d8907fc1b9abc73e4c
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-esr52@d7ce90899997 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs861453, 857557
milestone23.0a1
Bug 861453 - Restore empty substs after bug 857557, but put them in a separate file, unlisted as a dependency for everything. r=gps
build/macosx/universal/flight.mk
config/autoconf.mk.in
config/emptyvars.mk.in
config/moz.build
js/src/config/autoconf.mk.in
js/src/config/emptyvars.mk.in
js/src/configure.in
python/mozbuild/mozbuild/backend/configenvironment.py
python/mozbuild/mozbuild/test/backend/test_configenvironment.py
--- a/build/macosx/universal/flight.mk
+++ b/build/macosx/universal/flight.mk
@@ -11,16 +11,17 @@ OBJDIR_ARCH_1 = $(MOZ_OBJDIR)/$(firstwor
 OBJDIR_ARCH_2 = $(MOZ_OBJDIR)/$(word 2,$(MOZ_BUILD_PROJECTS))
 DIST_ARCH_1 = $(OBJDIR_ARCH_1)/dist
 DIST_ARCH_2 = $(OBJDIR_ARCH_2)/dist
 DIST_UNI = $(DIST_ARCH_1)/universal
 OBJDIR = $(OBJDIR_ARCH_1)
 endif
 
 topsrcdir = $(TOPSRCDIR)
+DEPTH = $(OBJDIR)
 include $(OBJDIR)/config/autoconf.mk
 
 core_abspath = $(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1))
 
 DIST = $(OBJDIR)/dist
 
 postflight_all:
 	mkdir -p $(DIST_UNI)/$(MOZ_PKG_APPNAME)
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -1,2 +1,3 @@
+include $(DEPTH)/config/emptyvars.mk
 @ALLSUBSTS@
 include $(topsrcdir)/config/baseconfig.mk
new file mode 100644
--- /dev/null
+++ b/config/emptyvars.mk.in
@@ -0,0 +1,1 @@
+@ALLEMPTYSUBSTS@
--- a/config/moz.build
+++ b/config/moz.build
@@ -1,14 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 CONFIGURE_SUBST_FILES += [
     'autoconf.mk',
+    'emptyvars.mk',
     'doxygen.cfg',
     'makefiles/test/Makefile',
     'tests/makefiles/autodeps/Makefile',
     'tests/src-simple/Makefile',
 ]
 
--- a/js/src/config/autoconf.mk.in
+++ b/js/src/config/autoconf.mk.in
@@ -1,2 +1,3 @@
+include $(DEPTH)/config/emptyvars.mk
 @ALLSUBSTS@
 include $(topsrcdir)/config/baseconfig.mk
new file mode 100644
--- /dev/null
+++ b/js/src/config/emptyvars.mk.in
@@ -0,0 +1,1 @@
+@ALLEMPTYSUBSTS@
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -4379,17 +4379,17 @@ AC_HAVE_FUNCS(localeconv)
 
 AC_SUBST(MOZILLA_VERSION)
 
 AC_SUBST(ac_configure_args)
 
 dnl Spit out some output
 dnl ========================================================
 
-AC_OUTPUT([js-confdefs.h Makefile config/autoconf.mk])
+AC_OUTPUT([js-confdefs.h Makefile config/autoconf.mk config/emptyvars.mk])
 
 # Produce the js-config script at configure time; see the comments for
 # 'js-config' in Makefile.in.
 AC_MSG_RESULT(invoking $MAKE to create js-config script)
 $MAKE js-config
 
 # Build jsctypes if it's enabled.
 if test "$JS_HAS_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then
--- a/python/mozbuild/mozbuild/backend/configenvironment.py
+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
@@ -81,23 +81,25 @@ class ConfigEnvironment(object):
     ConfigEnvironment automatically defines two additional substs variables
     from all the defines not appearing in non_global_defines:
       - ACDEFINES contains the defines in the form -DNAME=VALUE, for use on
         preprocessor command lines. The order in which defines were given
         when creating the ConfigEnvironment is preserved.
       - ALLDEFINES contains the defines in the form #define NAME VALUE, in
         sorted order, for use in config files, for an automatic listing of
         defines.
-    and another additional subst variable from all the other substs:
+    and two other additional subst variables from all the other substs:
       - ALLSUBSTS contains the substs in the form NAME = VALUE, in sorted
         order, for use in autoconf.mk. It includes ACDEFINES, but doesn't
         include ALLDEFINES. Only substs with a VALUE are included, such that
         the resulting file doesn't change when new empty substs are added.
         This results in less invalidation of build dependencies in the case
         of autoconf.mk..
+      - ALLEMPTYSUBSTS contains the substs with an empty value, in the form
+        NAME =.
 
     ConfigEnvironment expects a "top_srcdir" subst to be set with the top
     source directory, in msys format on windows. It is used to derive a
     "srcdir" subst when treating config files. It can either be an absolute
     path or a path relative to the topobjdir.
     """
 
     def __init__(self, topsrcdir, topobjdir, defines=[], non_global_defines=[],
@@ -108,16 +110,18 @@ class ConfigEnvironment(object):
         self.topsrcdir = topsrcdir
         self.topobjdir = topobjdir
         global_defines = [name for name, value in defines
             if not name in non_global_defines]
         self.substs['ACDEFINES'] = ' '.join(['-D%s=%s' % (name,
             shell_escape(self.defines[name])) for name in global_defines])
         self.substs['ALLSUBSTS'] = '\n'.join(sorted(['%s = %s' % (name,
             self.substs[name]) for name in self.substs if self.substs[name]]))
+        self.substs['ALLEMPTYSUBSTS'] = '\n'.join(sorted(['%s =' % name
+            for name in self.substs if not self.substs[name]]))
         self.substs['ALLDEFINES'] = '\n'.join(sorted(['#define %s %s' % (name,
             self.defines[name]) for name in global_defines]))
 
     @staticmethod
     def from_config_status(path):
         config = BuildConfig.from_config_status(path)
 
         return ConfigEnvironment(config.topsrcdir, config.topobjdir,
--- a/python/mozbuild/mozbuild/test/backend/test_configenvironment.py
+++ b/python/mozbuild/mozbuild/test/backend/test_configenvironment.py
@@ -17,24 +17,24 @@ class ConfigEnvironment(ConfigStatus.Con
             if os.path.isabs(self.topsrcdir):
                 self.substs['top_srcdir'] = self.topsrcdir.replace(os.sep, '/')
             else:
                 self.substs['top_srcdir'] = os.path.relpath(self.topsrcdir, self.topobjdir).replace(os.sep, '/')
 
 
 class TestEnvironment(unittest.TestCase):
     def test_auto_substs(self):
-        '''Test the automatically set values of ACDEFINES, ALLDEFINES
-        and ALLSUBSTS.
+        '''Test the automatically set values of ACDEFINES, ALLDEFINES,
+        ALLSUBSTS and ALLEMPTYSUBSTS.
         '''
         env = ConfigEnvironment('.', '.',
                   defines = [ ('foo', 'bar'), ('baz', 'qux 42'),
                               ('abc', 'def'), ('extra', 'foobar') ],
                   non_global_defines = ['extra', 'ignore'],
-                  substs = [ ('FOO', 'bar'), ('ABC', 'def'),
+                  substs = [ ('FOO', 'bar'), ('FOOBAR', ''), ('ABC', 'def'),
                              ('bar', 'baz qux'), ('zzz', '"abc def"'),
                              ('qux', '') ])
         # non_global_defines should be filtered out in ACDEFINES and
         # ALLDEFINES.
         # Original order of the defines need to be respected in ACDEFINES
         self.assertEqual(env.substs['ACDEFINES'], '''-Dfoo=bar -Dbaz=qux\ 42 -Dabc=def''')
         # ALLDEFINES, on the other hand, needs to be sorted
         self.assertEqual(env.substs['ALLDEFINES'], '''#define abc def
@@ -42,16 +42,19 @@ class TestEnvironment(unittest.TestCase)
 #define foo bar''')
         # Likewise for ALLSUBSTS, which also mustn't contain ALLDEFINES
         # but contain ACDEFINES
         self.assertEqual(env.substs['ALLSUBSTS'], '''ABC = def
 ACDEFINES = -Dfoo=bar -Dbaz=qux\ 42 -Dabc=def
 FOO = bar
 bar = baz qux
 zzz = "abc def"''')
+        # ALLEMPTYSUBSTS contains all substs with no value.
+        self.assertEqual(env.substs['ALLEMPTYSUBSTS'], '''FOOBAR =
+qux =''')
 
     def test_config_file(self):
         '''Test the creation of config files.
         '''
         with MockedOpen({'file.in': '''#ifdef foo
 @foo@
 @bar@
 '''}):