Bug 974900 - Add unified sources support to the mozbuild gyp generator for Skia, and regenerate the Skia build files with unified sources r=snorp
authorGeorge Wright <george@mozilla.com>
Wed, 12 Mar 2014 01:06:29 -0400
changeset 212956 f2b276900cdf5de6029b45eb3cbf3a091c54386f
parent 212955 d2983539a941cca84171ad6c5a2b10758bcf267a
child 212957 015a4d8eb89fc88b4a56876ab2d40ca90d7e4ef6
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs974900
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 974900 - Add unified sources support to the mozbuild gyp generator for Skia, and regenerate the Skia build files with unified sources r=snorp
gfx/skia/generate_mozbuild.py
gfx/skia/moz.build
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -1,18 +1,30 @@
 #!/usr/bin/env python
 
 import os
 
 import locale
 locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
 
 header = """
-# Please note this file is autogenerated from generate_mozbuild.py, so do not modify it directly
-
+#
+#   #####   #######           #     #     #     #     #     #
+# ##     #  #     #          # #    #  #  #    # #     #   #
+# ##        #     #         #   #   #  #  #   #   #     # #
+# ##  ####  #     #        #     #  #  #  #  #     #     #
+# ##     #  #     #        #######  #  #  #  #######     #      ###
+# ##     #  #     #        #     #  #  #  #  #     #     #      ###
+# # #####   #######        #     #   ## ##   #     #     #      ###
+#
+# Seriously. You shouldn't even be looking at this file unless you're
+# debugging generate_mozbuild.py.
+#
+# DO NOT MODIFY THIS FILE IT IS AUTOGENERATED.
+#
 """
 
 footer = """
 
 # left out of UNIFIED_SOURCES for now; that's not C++ anyway, nothing else to unify it with
 if not CONFIG['INTEL_ARCHITECTURE'] and CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
     SOURCES += [
         'trunk/src/opts/memset.arm.S',
@@ -285,17 +297,59 @@ def write_cflags(f, values, subsearch, c
   if len(val_list) == 0:
     return
 
   for val in val_list:
     if val.find(subsearch) > 0:
       write_indent(indent)
       f.write("SOURCES[\'" + val + "\'].flags += [\'" + cflag + "\']\n")
 
+def write_sources(f, values, indent):
 
+  # Unfortunately for now the gpu and pathops directories are
+  # non-unifiable. Keep track of this and fix it.
+  unified_blacklist = [
+    '_SSE',
+    '_SSSE',
+    '_neon',
+    'FontHost',
+    'SkBitmapProcState_matrixProcs.cpp',
+    'SkBlitter_A8.cpp',
+    'SkBlitter_ARGB32.cpp',
+    'SkBlitter_RGB16.cpp',
+    'SkBlitter_Sprite.cpp',
+    'SkScan_Antihair.cpp',
+    'SkCondVar.cpp',
+    'SkParse.cpp',
+    'GrAddPathRenderers_default.cpp',
+    'GrDistanceFieldTextContext.cpp',
+    'SkSHA1.cpp',
+    'SkMD5.cpp',
+  ]
+
+  def isblacklisted(value):
+    for item in unified_blacklist:
+      if value.find(item) >= 0:
+        return True
+
+    return False
+
+  sources = {}
+  sources['nonunified'] = set()
+  sources['unified'] = set()
+
+  for item in values:
+    if isblacklisted(item):
+      sources['nonunified'].add(item)
+    else:
+      sources['unified'].add(item)
+
+  write_list(f, "UNIFIED_SOURCES", sources['unified'], indent)
+  write_list(f, "SOURCES", sources['nonunified'], indent)
+  
 def write_list(f, name, values, indent):
   def write_indent(indent):
     for _ in range(indent):
         f.write(' ')
 
   val_list = uniq(sorted(map(lambda val: val.replace('../', 'trunk/'), values), key=lambda x: x.lower()))
 
   if len(val_list) == 0:
@@ -313,46 +367,45 @@ def write_list(f, name, values, indent):
 def write_mozbuild(includes, sources):
   filename = 'moz.build'
   f = open(filename, 'w')
 
   f.write(header)
 
   write_list(f, 'EXPORTS.skia', includes, 0)
 
-  write_list(f, 'SOURCES', sources['common'], 0)
+  write_sources(f, sources['common'], 0)
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):\n")
-  write_list(f, 'SOURCES', sources['android'], 4)
+  write_sources(f, sources['android'], 4)
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':\n")
-  write_list(f, 'SOURCES', sources['mac'], 4)
+  write_sources(f, sources['mac'], 4)
 
   f.write("if CONFIG['MOZ_WIDGET_GTK']:\n")
-  write_list(f, 'SOURCES', sources['linux'], 4)
+  write_sources(f, sources['linux'], 4)
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':\n")
-  write_list(f, 'SOURCES', sources['linux'], 4)
+  write_sources(f, sources['linux'], 4)
 
   f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n")
-  write_list(f, 'SOURCES', sources['win'], 4)
+  write_sources(f, sources['win'], 4)
 
-  f.write("\n\n")
   f.write("if CONFIG['INTEL_ARCHITECTURE']:\n")
-  write_list(f, 'SOURCES', sources['intel'], 4)
+  write_sources(f, sources['intel'], 4)
 
   f.write("elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:\n")
-  write_list(f, 'SOURCES', sources['arm'], 4)
+  write_sources(f, sources['arm'], 4)
 
   f.write("    if CONFIG['BUILD_ARM_NEON']:\n")
   write_list(f, 'SOURCES', sources['neon'], 8)
   write_cflags(f, sources['neon'], 'neon', '-mfpu=neon', 8)
 
   f.write("else:\n")
-  write_list(f, 'SOURCES', sources['none'], 4)
+  write_sources(f, sources['none'], 4)
 
   f.write(footer)
 
   f.close()
 
   print 'Wrote ' + filename
 
 def main():
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -1,11 +1,23 @@
 
-# Please note this file is autogenerated from generate_mozbuild.py, so do not modify it directly
-
+#
+#   #####   #######           #     #     #     #     #     #
+# ##     #  #     #          # #    #  #  #    # #     #   #
+# ##        #     #         #   #   #  #  #   #   #     # #
+# ##  ####  #     #        #     #  #  #  #  #     #     #
+# ##     #  #     #        #######  #  #  #  #######     #      ###
+# ##     #  #     #        #     #  #  #  #  #     #     #      ###
+# # #####   #######        #     #   ## ##   #     #     #      ###
+#
+# Seriously. You shouldn't even be looking at this file unless you're
+# debugging generate_mozbuild.py.
+#
+# DO NOT MODIFY THIS FILE IT IS AUTOGENERATED.
+#
 EXPORTS.skia += [
     'trunk/include/animator/SkAnimator.h',
     'trunk/include/animator/SkAnimatorView.h',
     'trunk/include/config/SkUserConfig.h',
     'trunk/include/core/SkAdvancedTypefaceMetrics.h',
     'trunk/include/core/SkAnnotation.h',
     'trunk/include/core/SkBitmap.h',
     'trunk/include/core/SkBitmapDevice.h',
@@ -356,17 +368,16 @@ UNIFIED_SOURCES += [
     'trunk/src/core/SkError.cpp',
     'trunk/src/core/SkFilterProc.cpp',
     'trunk/src/core/SkFilterShader.cpp',
     'trunk/src/core/SkFlattenable.cpp',
     'trunk/src/core/SkFlattenableSerialization.cpp',
     'trunk/src/core/SkFloat.cpp',
     'trunk/src/core/SkFloatBits.cpp',
     'trunk/src/core/SkFontDescriptor.cpp',
-    'trunk/src/core/SkFontHost.cpp',
     'trunk/src/core/SkFontStream.cpp',
     'trunk/src/core/SkGeometry.cpp',
     'trunk/src/core/SkGlyphCache.cpp',
     'trunk/src/core/SkGraphics.cpp',
     'trunk/src/core/SkImageFilter.cpp',
     'trunk/src/core/SkImageInfo.cpp',
     'trunk/src/core/SkInstCnt.cpp',
     'trunk/src/core/SkLineClipper.cpp',
@@ -661,124 +672,135 @@ UNIFIED_SOURCES += [
     'trunk/src/utils/SkDeferredCanvas.cpp',
     'trunk/src/utils/SkDumpCanvas.cpp',
     'trunk/src/utils/SkEventTracer.cpp',
     'trunk/src/utils/SkFrontBufferedStream.cpp',
     'trunk/src/utils/SkGatherPixelRefsAndRects.cpp',
     'trunk/src/utils/SkInterpolator.cpp',
     'trunk/src/utils/SkLayer.cpp',
     'trunk/src/utils/SkMatrix44.cpp',
-    'trunk/src/utils/SkMD5.cpp',
     'trunk/src/utils/SkMeshUtils.cpp',
     'trunk/src/utils/SkNinePatch.cpp',
     'trunk/src/utils/SkNullCanvas.cpp',
     'trunk/src/utils/SkNWayCanvas.cpp',
     'trunk/src/utils/SkOSFile.cpp',
     'trunk/src/utils/SkParseColor.cpp',
     'trunk/src/utils/SkParsePath.cpp',
     'trunk/src/utils/SkPathUtils.cpp',
     'trunk/src/utils/SkPictureUtils.cpp',
     'trunk/src/utils/SkProxyCanvas.cpp',
     'trunk/src/utils/SkRTConf.cpp',
-    'trunk/src/utils/SkSHA1.cpp',
     'trunk/src/utils/SkUnitMappers.cpp',
 ]
 SOURCES += [
     'trunk/src/core/SkBitmapProcState_matrixProcs.cpp',
     'trunk/src/core/SkBlitter_A8.cpp',
     'trunk/src/core/SkBlitter_ARGB32.cpp',
     'trunk/src/core/SkBlitter_RGB16.cpp',
     'trunk/src/core/SkBlitter_Sprite.cpp',
+    'trunk/src/core/SkFontHost.cpp',
     'trunk/src/core/SkScan_Antihair.cpp',
     'trunk/src/gpu/GrAddPathRenderers_default.cpp',
     'trunk/src/gpu/GrDistanceFieldTextContext.cpp',
     'trunk/src/utils/SkCondVar.cpp',
+    'trunk/src/utils/SkMD5.cpp',
     'trunk/src/utils/SkParse.cpp',
+    'trunk/src/utils/SkSHA1.cpp',
 ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'trunk/src/images/SkImageRef_ashmem.cpp',
         'trunk/src/ports/SkDebug_android.cpp',
-        'trunk/src/ports/SkFontHost_android_old.cpp',
-        'trunk/src/ports/SkFontHost_cairo.cpp',
-        'trunk/src/ports/SkFontHost_FreeType.cpp',
-        'trunk/src/ports/SkFontHost_FreeType_common.cpp',
         'trunk/src/ports/SkOSFile_posix.cpp',
         'trunk/src/ports/SkPurgeableMemoryBlock_android.cpp',
         'trunk/src/ports/SkTime_Unix.cpp',
         'trunk/src/ports/SkTLS_pthread.cpp',
         'trunk/src/utils/android/ashmem.cpp',
         'trunk/src/utils/SkThreadUtils_pthread.cpp',
     ]
+    SOURCES += [
+        'trunk/src/ports/SkFontHost_android_old.cpp',
+        'trunk/src/ports/SkFontHost_cairo.cpp',
+        'trunk/src/ports/SkFontHost_FreeType.cpp',
+        'trunk/src/ports/SkFontHost_FreeType_common.cpp',
+    ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'trunk/src/ports/SkDebug_stdio.cpp',
-        'trunk/src/ports/SkFontHost_mac.cpp',
         'trunk/src/ports/SkOSFile_posix.cpp',
         'trunk/src/ports/SkPurgeableMemoryBlock_mac.cpp',
         'trunk/src/ports/SkTime_Unix.cpp',
         'trunk/src/ports/SkTLS_pthread.cpp',
         'trunk/src/utils/mac/SkCreateCGImageRef.cpp',
         'trunk/src/utils/mac/SkStream_mac.cpp',
         'trunk/src/utils/SkThreadUtils_pthread.cpp',
     ]
+    SOURCES += [
+        'trunk/src/ports/SkFontHost_mac.cpp',
+    ]
 if CONFIG['MOZ_WIDGET_GTK']:
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'trunk/src/ports/SkDebug_stdio.cpp',
-        'trunk/src/ports/SkFontHost_cairo.cpp',
-        'trunk/src/ports/SkFontHost_FreeType.cpp',
-        'trunk/src/ports/SkFontHost_FreeType_common.cpp',
         'trunk/src/ports/SkOSFile_posix.cpp',
         'trunk/src/ports/SkTime_Unix.cpp',
         'trunk/src/ports/SkTLS_pthread.cpp',
         'trunk/src/utils/SkThreadUtils_pthread.cpp',
     ]
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
     SOURCES += [
-        'trunk/src/ports/SkDebug_stdio.cpp',
         'trunk/src/ports/SkFontHost_cairo.cpp',
         'trunk/src/ports/SkFontHost_FreeType.cpp',
         'trunk/src/ports/SkFontHost_FreeType_common.cpp',
+    ]
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
+    UNIFIED_SOURCES += [
+        'trunk/src/ports/SkDebug_stdio.cpp',
         'trunk/src/ports/SkOSFile_posix.cpp',
         'trunk/src/ports/SkTime_Unix.cpp',
         'trunk/src/ports/SkTLS_pthread.cpp',
         'trunk/src/utils/SkThreadUtils_pthread.cpp',
     ]
+    SOURCES += [
+        'trunk/src/ports/SkFontHost_cairo.cpp',
+        'trunk/src/ports/SkFontHost_FreeType.cpp',
+        'trunk/src/ports/SkFontHost_FreeType_common.cpp',
+    ]
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'trunk/src/ports/SkDebug_win.cpp',
-        'trunk/src/ports/SkFontHost_win.cpp',
         'trunk/src/ports/SkFontMgr_default_gdi.cpp',
         'trunk/src/ports/SkOSFile_win.cpp',
         'trunk/src/ports/SkTime_win.cpp',
         'trunk/src/ports/SkTLS_win.cpp',
         'trunk/src/utils/SkThreadUtils_win.cpp',
         'trunk/src/utils/win/SkAutoCoInitialize.cpp',
         'trunk/src/utils/win/SkDWriteFontFileStream.cpp',
         'trunk/src/utils/win/SkDWriteGeometrySink.cpp',
         'trunk/src/utils/win/SkHRESULT.cpp',
         'trunk/src/utils/win/SkIStream.cpp',
     ]
-
-
+    SOURCES += [
+        'trunk/src/ports/SkFontHost_win.cpp',
+    ]
 if CONFIG['INTEL_ARCHITECTURE']:
+    UNIFIED_SOURCES += [
+        'trunk/src/opts/SkXfermode_opts_none.cpp',
+    ]
     SOURCES += [
         'trunk/src/opts/opts_check_SSE2.cpp',
         'trunk/src/opts/SkBitmapFilter_opts_SSE2.cpp',
         'trunk/src/opts/SkBitmapProcState_opts_SSE2.cpp',
         'trunk/src/opts/SkBitmapProcState_opts_SSSE3.cpp',
         'trunk/src/opts/SkBlitRect_opts_SSE2.cpp',
         'trunk/src/opts/SkBlitRow_opts_SSE2.cpp',
         'trunk/src/opts/SkBlurImage_opts_SSE2.cpp',
         'trunk/src/opts/SkMorphology_opts_SSE2.cpp',
         'trunk/src/opts/SkUtils_opts_SSE2.cpp',
-        'trunk/src/opts/SkXfermode_opts_none.cpp',
     ]
 elif CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_CC']:
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'trunk/src/core/SkUtilsArm.cpp',
         'trunk/src/opts/SkBitmapProcState_opts_arm.cpp',
         'trunk/src/opts/SkBlitMask_opts_arm.cpp',
         'trunk/src/opts/SkBlitRow_opts_arm.cpp',
         'trunk/src/opts/SkBlurImage_opts_arm.cpp',
         'trunk/src/opts/SkMorphology_opts_arm.cpp',
         'trunk/src/opts/SkUtils_opts_arm.cpp',
         'trunk/src/opts/SkXfermode_opts_arm.cpp',
@@ -796,17 +818,17 @@ elif CONFIG['CPU_ARCH'] == 'arm' and CON
         SOURCES['trunk/src/opts/SkBitmapProcState_arm_neon.cpp'].flags += ['-mfpu=neon']
         SOURCES['trunk/src/opts/SkBitmapProcState_matrixProcs_neon.cpp'].flags += ['-mfpu=neon']
         SOURCES['trunk/src/opts/SkBlitMask_opts_arm_neon.cpp'].flags += ['-mfpu=neon']
         SOURCES['trunk/src/opts/SkBlitRow_opts_arm_neon.cpp'].flags += ['-mfpu=neon']
         SOURCES['trunk/src/opts/SkBlurImage_opts_neon.cpp'].flags += ['-mfpu=neon']
         SOURCES['trunk/src/opts/SkMorphology_opts_neon.cpp'].flags += ['-mfpu=neon']
         SOURCES['trunk/src/opts/SkXfermode_opts_arm_neon.cpp'].flags += ['-mfpu=neon']
 else:
-    SOURCES += [
+    UNIFIED_SOURCES += [
         'trunk/src/opts/SkBitmapProcState_opts_none.cpp',
         'trunk/src/opts/SkBlitMask_opts_none.cpp',
         'trunk/src/opts/SkBlitRow_opts_none.cpp',
         'trunk/src/opts/SkBlurImage_opts_none.cpp',
         'trunk/src/opts/SkMorphology_opts_none.cpp',
         'trunk/src/opts/SkUtils_opts_none.cpp',
         'trunk/src/opts/SkXfermode_opts_none.cpp',
         'trunk/src/ports/SkDiscardableMemory_none.cpp',