Bug 800847: Correctly regenerate Makefiles from gyp files, and handle fancy symlinked objdirs r=ted
authorRandell Jesup <rjesup@jesup.org>
Fri, 12 Oct 2012 16:06:33 -0400
changeset 110297 5a5563b58d5b6cd059f4a77f8395b9dc6795ee1a
parent 110296 b8e7df7ac70f75b1564a5c25cf4cda1f2d71f5bb
child 110298 7a75ede979bf04a07ed28b71b67ad7f4e20ed4e8
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersted
bugs800847
milestone19.0a1
Bug 800847: Correctly regenerate Makefiles from gyp files, and handle fancy symlinked objdirs r=ted
configure.in
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
--- a/configure.in
+++ b/configure.in
@@ -8861,17 +8861,19 @@ if test "${OS_TARGET}" = "WINNT"; then
       OS_BITS=32
    fi
    EXTRA_GYP_DEFINES="-D MSVS_VERSION=${_MSVS_VERSION} -D MSVS_OS_BITS=${OS_BITS}"
 fi
 
 if test -n "$MOZ_WEBRTC"; then
    AC_MSG_RESULT("generating WebRTC Makefiles...")
 
-   WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi"
+dnl Any --include files must also appear in -D FORCED_INCLUDE_FILE= entries
+dnl so that regeneration via dependencies works correctly
+   WEBRTC_CONFIG="-D build_with_mozilla=1 --include ${srcdir}/media/webrtc/webrtc_config.gypi -D FORCED_INCLUDE_FILE=${srcdir}/media/webrtc/webrtc_config.gypi"
 
    GYP_WEBRTC_OPTIONS="--format=mozmake ${WEBRTC_CONFIG} ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir}"
 
    $PYTHON ${srcdir}/media/webrtc/trunk/build/gyp_chromium \
      $GYP_WEBRTC_OPTIONS \
      --generator-output=${_objdir}/media/webrtc/trunk \
      ${srcdir}/media/webrtc/trunk/peerconnection.gyp
    if test "$?" != 0; then
--- a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
@@ -435,23 +435,30 @@ def GenerateOutput(target_list, target_d
   else:
     top = topsrcdir
     src = abs_srcdir
   WriteMakefile(makefile_path, topdata, params['build_files'][0],
                 depth,
                 swapslashes(top),
                 swapslashes(src),
                 swapslashes(relative_srcdir))
-  scriptname = topsrcdir_path(__file__)
-  if scriptname[-4:] in ('.pyc', '.pyo'):
-    scriptname = scriptname[:-1]
+  scriptname = "$(topsrcdir)/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py"
+  # Reassemble a commandline from parts so that all the paths are correct
+  # NOTE: this MUST match the commandline generated in configure.in!
+  # since we don't see --include statements, duplicate them in FORCE_INCLUDE_FILE lines
+  # Being in a define, they also get used by the common.mk invocation of gyp so they
+  # they don't disappear in the second round of tail-swallowing
+  forced_includes = ""
+  for option in options.defines:
+    if option[:20] == "FORCED_INCLUDE_FILE=":
+      forced_includes += "--include=%s" % option[20:]
 
-  # Reassemble a commandline from parts so that all the paths are correct
   commandline = [topsrcdir_path(sys.argv[0]),
                  "--format=mozmake",
+                 forced_includes,
                  "--depth=%s" % topsrcdir_path(options.depth),
                  "--generator-output=%s" % objdir_path(options.generator_output),
                  "--toplevel-dir=$(topsrcdir)",
                  #XXX: handle other generator_flags gracefully?
                  "-G OBJDIR=$(DEPTH)"] + \
                  ['-D%s' % d for d in options.defines] + \
                  [topsrcdir_path(b) for b in params['build_files']]