Bug 1249167 - Fix dependencies involving stdc++compat and clang-plugin. r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 18 Feb 2016 09:03:01 +0900
changeset 284796 73277ffc0146e58e8db94ec3b03f62c5b8db309e
parent 284795 94e55d77578dd3341b035bcfd7bb9a4e578f615b
child 284797 f385fb62ec918e367bb0f9506642b842ff10a65c
push idunknown
push userunknown
push dateunknown
reviewersmshal
bugs1249167
milestone47.0a1
Bug 1249167 - Fix dependencies involving stdc++compat and clang-plugin. r=mshal
build/templates.mozbuild
config/moz.build
config/recurse.mk
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -85,21 +85,27 @@ def Framework(name):
 def HostStdCppCompat():
     '''Template for libstdc++ compatibility for host binaries.'''
 
     if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
         HOST_USE_LIBS += ['host_stdc++compat']
 
 
 @template
-def HostProgram(name):
+def HostProgram(name, c_only=False):
     '''Template for build tools executables.'''
     HOST_PROGRAM = name
 
-    HostStdCppCompat()
+    # With context-based templates, this won't be needed anymore, and will
+    # work better than relying on the caller setting it, but at the moment,
+    # this is the best we have. And it doesn't matter /that/ much, so there's
+    # really only one place using this, where it does matter to avoid the
+    # extra dependency (because it creates a circular one).
+    if not c_only:
+        HostStdCppCompat()
 
 
 @template
 def HostSimplePrograms(names, ext='.cpp'):
     '''Template for simple build tools executables.
 
     Those have a single source with the same base name as the executable.
     '''
--- a/config/moz.build
+++ b/config/moz.build
@@ -19,17 +19,20 @@ CONFIGURE_SUBST_FILES += [
     'tests/src-simple/Makefile',
 ]
 
 if CONFIG['HOST_OS_ARCH'] != 'WINNT':
     HOST_SOURCES += [
         'nsinstall.c',
         'pathsub.c',
     ]
-    HostProgram('nsinstall_real')
+    # stdc++compat depends on config/export, so avoid a circular
+    # dependency added by HostProgram depending on stdc++compat,
+    # while the program here is in C.
+    HostProgram('nsinstall_real', c_only=True)
 
 if CONFIG['MOZ_SHARED_ICU']:
     DEFINES['MOZ_SHARED_ICU'] = True
 
 PYTHON_UNIT_TESTS += [
     'tests/test_mozbuild_reading.py',
     'tests/unit-expandlibs.py',
     'tests/unit-mozunit.py',
--- a/config/recurse.mk
+++ b/config/recurse.mk
@@ -147,17 +147,17 @@ accessible/xpcom/export: xpcom/xpidl/exp
 # The widget binding generator code is part of the annotationProcessors.
 widget/android/bindings/export: build/annotationProcessors/export
 
 # The roboextender addon includes a classes.dex containing a test Java addon.
 # The test addon must be built first.
 mobile/android/tests/browser/robocop/roboextender/tools: mobile/android/tests/javaaddons/tools
 
 ifdef ENABLE_CLANG_PLUGIN
-$(filter-out build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
+$(filter-out config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
 build/clang-plugin/tests/target: build/clang-plugin/target
 endif
 
 # Interdependencies that moz.build world don't know about yet for compilation.
 # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
 toolkit/library/target: widget/gtk/mozgtk/gtk3/target
 endif
@@ -171,8 +171,11 @@ endif
 ifdef MOZ_CRT
 mozglue/crt/target: mozglue/build/target
 endif
 # js/src/target can end up invoking js/src/host rules (through object files
 # depending on jsautokw.h, which depends on host_jskwgen, and that can't
 # happen at the same time (bug #1146738)
 js/src/target: js/src/host
 endif
+# Most things are built during compile (target/host), but some things happen during export
+# Those need to depend on config/export for system wrappers.
+$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/target: config/export