Backout of bug 773423. Breaks linux clobber builds. r=dontbreakthebuild
authorDoug Turner <dougt@dougt.org>
Tue, 28 Aug 2012 15:53:32 -0700
changeset 105760 3e6ed8c7aaa63c8533c5e4612bec1131ac895298
parent 105759 ab88572c117ccfbc6e9924a4fd787268f8771ef6
child 105761 0a5dee7e43fa274074ab02ac87633ec45a83459a
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersdontbreakthebuild
bugs773423
milestone18.0a1
Backout of bug 773423. Breaks linux clobber builds. r=dontbreakthebuild
configure.in
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
--- a/configure.in
+++ b/configure.in
@@ -976,27 +976,16 @@ cc_version=$($CC --version)
 AC_MSG_RESULT([$cc_version])
 
 if test -n "$MAKE"; then
   if test `echo $MAKE | grep -c make.py` != 1; then
      NOT_PYMAKE=$MAKE
   fi
 fi
 
-MOZ_TOPSRCDIR=$_topsrcdir
-if test -z "$NOT_PYMAKE"; then
-  case "$host" in
-  *mingw*)
-     MOZ_TOPSRCDIR=`cd $_topsrcdir && pwd -W`
-     ;;
-  esac
-fi
-# MOZ_TOPSRCDIR is an absolute path, in the correct form
-# for "topsrcdir=" and "srcdir=" in Makefiles
-
 case "$host_os" in
 mingw*)
     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE make gmake, :)
     ;;
 *)
     MOZ_PATH_PROGS(GMAKE, $GMAKE $NOT_PYMAKE gmake make, :)
     ;;
 esac
@@ -8687,24 +8676,18 @@ if test "${OS_TARGET}" = "WINNT"; then
    else
       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...")
-   # msys (on windows) does EVIL things to parameters to python it thinks are msys paths.
-   # Since we already have the path in the format we want (c:/foo for pymake, 
-   # /c/foo for make), we just want to stop msys from mucking with the string.
-   # The underscores will be removed in mozmake.py.  We need the correct form of
-   # absolute path for building topsrcdir= in Makefiles.
-   MOZ_TOPSRCDIR="_${MOZ_TOPSRCDIR:0:2}_${MOZ_TOPSRCDIR:2}"
-
-   GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${EXTRA_GYP_DEFINES} --depth=${srcdir}/media/webrtc/trunk --toplevel-dir=${srcdir} -G OBJDIR=${_objdir} -G TOPSRCDIR=${MOZ_TOPSRCDIR}"
+
+   GYP_WEBRTC_OPTIONS="--format=mozmake -D build_with_mozilla=1 -D enable_protobuf=0 -D include_internal_video_render=0 ${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
       AC_MSG_ERROR([failed to generate WebRTC Makefiles])
    fi
--- a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
+++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py
@@ -193,27 +193,27 @@ def getdepth(s):
   """Given a relative path, return a relative path consisting
   of .. segments that would lead to the parent directory."""
   return "/".join(".." for x in swapslashes(s).split("/") if x)
 
 def Compilable(filename):
   return os.path.splitext(filename)[1] in COMPILABLE_EXTENSIONS
 
 class MakefileGenerator(object):
-  def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, topsrcdir_header):
+  def __init__(self, target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor):
     self.target_dicts = target_dicts
     self.data = data
     self.options = options
     self.depth = depth
     self.relative_srcdir = swapslashes(relative_srcdir)
     self.topsrcdir = swapslashes(topsrcdir)
     self.relative_topsrcdir = swapslashes(relative_topsrcdir)
     self.srcdir = swapslashes(os.path.join(topsrcdir, relative_srcdir))
     self.output_dir = output_dir
-    self.topsrcdir_header = topsrcdir_header
+    self.flavor = flavor
     # Directories to be built in order.
     self.dirs = []
     # Directories that can be built in any order, but before |dirs|.
     self.parallel_dirs = []
     # Targets that have been processed.
     self.visited = set()
     # Link dependencies.
     self.target_link_deps = {}
@@ -364,17 +364,20 @@ class MakefileGenerator(object):
       data['LIBRARY_NAME'] = striplib(spec['target_name'])
       data['FORCE_STATIC_LIB'] = 1
     elif spec['type'] in ('loadable_module', 'shared_library'):
       data['LIBRARY_NAME'] = striplib(spec['target_name'])
       data['FORCE_SHARED_LIB'] = 1
     else:
       # Maybe nothing?
       return False
-    top = self.topsrcdir_header
+    if self.flavor == 'win':
+      top = self.relative_topsrcdir
+    else:
+      top = self.topsrcdir
     WriteMakefile(output_file, data, build_file, depth, top,
                   # we set srcdir up one directory, since the subdir
                   # doesn't actually exist in the source directory
                   swapslashes(os.path.join(top, self.relative_srcdir, os.path.split(rel_path)[0])),
                   self.relative_srcdir)
     return True
 
 def GenerateOutput(target_list, target_dicts, data, params):
@@ -382,31 +385,26 @@ def GenerateOutput(target_list, target_d
   flavor = GetFlavor(params)
   generator_flags = params.get('generator_flags', {})
 
   # Get a few directories into Mozilla-common naming conventions
   # The root of the source repository.
   topsrcdir = os.path.abspath(options.toplevel_dir)
   # The object directory (root of the build).
   objdir = os.path.abspath(generator_flags['OBJDIR'] if 'OBJDIR' in generator_flags else '.')
-  # The topsrcdir in correct format for the header (which changes from make to pymake on windows!)
-  # This is already in absolute format (not relative), with '/'s, with a leading '_' and a
-  # second after two characters to avoid msys modifying it on Windows(!)
-  topsrcdir_header = generator_flags['TOPSRCDIR'] if 'TOPSRCDIR' in generator_flags else topsrcdir
-  topsrcdir_header = topsrcdir_header[1:3] + topsrcdir_header[4:]
   # A relative path from the objdir to the topsrcdir
   relative_topsrcdir = gyp.common.RelativePath(topsrcdir, objdir)
   # The directory containing the gyp file on which gyp was invoked.
   gyp_file_dir = os.path.abspath(os.path.dirname(params['build_files'][0]) or '.')
   # The relative path from topsrcdir to gyp_file_dir
   relative_srcdir = gyp.common.RelativePath(gyp_file_dir, topsrcdir)
   # The relative path from objdir to gyp_file_dir
   srcdir = gyp.common.RelativePath(gyp_file_dir, objdir)
   # The absolute path to the source dir
-  abs_srcdir = topsrcdir_header + "/" + relative_srcdir
+  abs_srcdir = topsrcdir + "/" + relative_srcdir
   # The path to get up to the root of the objdir from the output dir.
   depth = getdepth(relative_srcdir)
   # The output directory.
   output_dir = os.path.abspath(options.generator_output or '.')
   # The path to the root Makefile
   makefile_path = os.path.join(output_dir, "Makefile")
 
   def topsrcdir_path(path):
@@ -419,27 +417,33 @@ def GenerateOutput(target_list, target_d
   build_files = set()
   for build_file in params['build_files']:
     build_file = os.path.normpath(build_file)
     for target in gyp.common.AllTargets(target_list, target_dicts, build_file):
       needed_targets.add(target)
       build_file_, _, _ = gyp.common.ParseQualifiedTarget(target)
       build_files.add(topsrcdir_path(build_file_))
 
-  generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, topsrcdir_header)
+  generator = MakefileGenerator(target_dicts, data, options, depth, topsrcdir, relative_topsrcdir, relative_srcdir, output_dir, flavor)
   generator.ProcessTargets(needed_targets)
 
   # Write the top-level makefile, which simply calls the other makefiles
   topdata = {'DIRS': generator.dirs}
   if generator.parallel_dirs:
     topdata['PARALLEL_DIRS'] = generator.parallel_dirs
+  if flavor == 'win':
+    top = relative_topsrcdir
+    src = srcdir
+  else:
+    top = topsrcdir
+    src = abs_srcdir
   WriteMakefile(makefile_path, topdata, params['build_files'][0],
                 depth,
-                swapslashes(topsrcdir_header),
-                swapslashes(abs_srcdir),
+                swapslashes(top),
+                swapslashes(src),
                 swapslashes(relative_srcdir))
   scriptname = topsrcdir_path(__file__)
   # Reassemble a commandline from parts so that all the paths are correct
   commandline = [topsrcdir_path(sys.argv[0]),
                  "--format=mozmake",
                  "--depth=%s" % topsrcdir_path(options.depth),
                  "--generator-output=%s" % objdir_path(options.generator_output),
                  "--toplevel-dir=$(topsrcdir)",