Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / libvpx / libvpx.gyp
index 2bd88ab..4f8cb2b 100644 (file)
@@ -5,6 +5,9 @@
   'variables': {
     'libvpx_build_vp9%': 1,
     'libvpx_source%': 'source/libvpx',
+    # Disable LTO for neon targets
+    # crbug.com/408997
+    'use_lto%': 0,
     'conditions': [
       ['os_posix==1', {
         'asm_obj_extension': 'o',
         'asm_obj_extension': 'obj',
       }],
 
-      ['(target_arch=="arm" or target_arch=="armv7") and arm_neon==1', {
-        'target_arch_full': 'arm-neon',
+      ['msan==1', {
+        'target_arch_full': 'generic',
       }, {
         'conditions': [
-          ['OS=="android" and ((target_arch=="arm" or target_arch=="armv7") and arm_neon==0)', {
-            'target_arch_full': 'arm-neon-cpu-detect',
+          ['(target_arch=="arm" or target_arch=="armv7") and arm_neon==1', {
+            'target_arch_full': 'arm-neon',
           }, {
-           'target_arch_full': '<(target_arch)',
+            'conditions': [
+              ['OS=="android" and ((target_arch=="arm" or target_arch=="armv7") and arm_neon==0)', {
+                'target_arch_full': 'arm-neon-cpu-detect',
+              }, {
+               'target_arch_full': '<(target_arch)',
+              }],
+            ],
+          }],
+          ['target_arch=="arm64"', {
+            'target_arch_full': 'arm64',
           }],
         ],
       }],
         'sources/': [ ['exclude', '(^|/)vp9/'], ],
       }],
     ],
+    'variables': {
+      'conditions': [
+        ['OS=="win" and buildtype=="Official"', {
+          # Do not set to 'size', as it results in an error on win64.
+          'optimize' :'speed',
+        }],
+      ],
+    },
   },
   'conditions': [
     ['target_arch=="ia32"', {
       'includes': ['libvpx_srcs_x86_intrinsics.gypi', ],
     }],
-    ['target_arch=="x64"', {
+    ['target_arch=="x64" and msan==0', {
       'includes': ['libvpx_srcs_x86_64_intrinsics.gypi', ],
     }],
     [ '(target_arch=="arm" or target_arch=="armv7") and arm_neon==0 and OS=="android"', {
@@ -54,7 +74,8 @@
       # support for neon and hide it behind Android cpu-features.
       'includes': ['libvpx_srcs_arm_neon_cpu_detect_intrinsics.gypi', ],
     }],
-    [ '(target_arch != "arm" and target_arch != "armv7") and target_arch != "mipsel"', {
+    [ '(target_arch != "arm" and target_arch != "armv7") and \
+       (target_arch != "mipsel" and target_arch != "mips64el")', {
       'targets': [
         {
           # This libvpx target contains both encoder and decoder.
               '-I', '<(libvpx_source)',
               '-I', '<(shared_generated_dir)', # Generated assembly offsets
             ],
+            # yasm only gets the flags we define. It doesn't inherit any of the
+            # really useful defines that come with a gcc invocation. In this
+            # case, we rely on __ANDROID__ to set 'rand' to 'lrand48'.
+            # Previously we used the builtin _rand but that's gone away.
+            'conditions': [
+              ['OS=="android"', {
+                'yasm_flags': [
+                  '-D', '__ANDROID__',
+                ],
+              }],
+            ],
+            'clang_warning_flags': [
+              # libvpx heavily relies on implicit enum casting.
+              '-Wno-conversion',
+              # libvpx does `if ((a == b))` in some places.
+              '-Wno-parentheses-equality',
+            ],
           },
           'dependencies': [
             'gen_asm_offsets_vp8',
                 # Currently no sse3 intrinsic functions
                 #'libvpx_intrinsics_sse3',
                 'libvpx_intrinsics_ssse3',
-                # Currently no sse4_1 intrinsic functions
-                #'libvpx_intrinsics_sse4_1',
-                # Currently no avx intrinsic functions
-                #'libvpx_intrinsics_avx',
-                # Add avx2 support when VS2013 lands: crbug.com/328981
-                #'libvpx_intrinsics_avx2',
-              ],
-            }],
-            ['target_arch=="x64"', {
-              'includes': [
-                'libvpx_srcs_x86_64.gypi',
-              ],
-              'dependencies': [
-                'libvpx_intrinsics_mmx',
-                'libvpx_intrinsics_sse2',
-                # Currently no sse3 intrinsic functions
-                #'libvpx_intrinsics_sse3',
-                'libvpx_intrinsics_ssse3',
-                # Currently no sse4_1 intrinsic functions
-                #'libvpx_intrinsics_sse4_1',
+                'libvpx_intrinsics_sse4_1',
                 # Currently no avx intrinsic functions
                 #'libvpx_intrinsics_avx',
-                # Add avx2 support when VS2013 lands: crbug.com/328981
                 #'libvpx_intrinsics_avx2',
               ],
             }],
-            ['clang == 1', {
-              'xcode_settings': {
-                'WARNING_CFLAGS': [
-                  # libvpx heavily relies on implicit enum casting.
-                  '-Wno-conversion',
-                  # libvpx does `if ((a == b))` in some places.
-                  '-Wno-parentheses-equality',
-                ],
-              },
-              'cflags': [
-                '-Wno-conversion',
-                '-Wno-parentheses-equality',
-              ],
+            ['target_arch=="arm64"', {
+              'includes': [ 'libvpx_srcs_arm64.gypi', ],
             }],
-            ['chromeos == 1', {
-              # ChromeOS needs these files for animated WebM avatars.
-              'sources': [
-                '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
-                '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
-                '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
+            ['target_arch=="x64"', {
+              'conditions': [
+                ['msan==1', {
+                  'includes': [ 'libvpx_srcs_generic.gypi', ],
+                }, {
+                  'includes': [
+                    'libvpx_srcs_x86_64.gypi',
+                  ],
+                  'dependencies': [
+                    'libvpx_intrinsics_mmx',
+                    'libvpx_intrinsics_sse2',
+                    # Currently no sse3 intrinsic functions
+                    #'libvpx_intrinsics_sse3',
+                    'libvpx_intrinsics_ssse3',
+                    'libvpx_intrinsics_sse4_1',
+                    # Currently no avx intrinsic functions
+                    #'libvpx_intrinsics_avx',
+                    #'libvpx_intrinsics_avx2',
+                  ],
+                }],
               ],
             }],
           ],
       ],
     },
     ],
-    # 'libvpx' target for mips builds.
-    [ 'target_arch=="mipsel" ', {
+    # 'libvpx' target for mipsel and mips64el builds.
+    [ 'target_arch=="mipsel" or target_arch=="mips64el"', {
       'targets': [
         {
           # This libvpx target contains both encoder and decoder.
           'includes': [
             'libvpx_srcs_mips.gypi',
           ],
-          'cflags': [
-            '-EL -static -mips32',
-          ],
           'include_dirs': [
             'source/config/<(OS_CATEGORY)/<(target_arch_full)',
             'source/config',
             'ads2gas_script_path': '<(libvpx_source)/build/make/<(ads2gas_script)',
             'ads2gas_script_include': '<(libvpx_source)/build/make/thumb.pm',
           },
-          # We need to explicitly tell the assembler to look for
-          # .include directive files from the place where they're
-          # generated to.
-          'cflags': [
-             '-Wa,-I,<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
-             '-Wa,-I,<!(pwd)/source/config',
-             '-Wa,-I,<(shared_generated_dir)',
-          ],
           'xcode_settings': {
             'OTHER_CFLAGS': [
               '-I<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
               '<(libvpx_source)',
             ],
           },
+          # We need to explicitly tell the assembler to look for
+          # .include directive files from the place where they're
+          # generated to.
+          'cflags': [
+             '-Wa,-I,<(shared_generated_dir)',
+          ],
           'conditions': [
+            # For Android WebView, the following pathc are not required and not
+            # allowed, because they generate the absolute path.
+            ['android_webview_build!=1', {
+              'cflags': [
+                '-Wa,-I,<!(pwd)/source/config/<(OS_CATEGORY)/<(target_arch_full)',
+                '-Wa,-I,<!(pwd)/source/config',
+              ],
+            }],
             # Libvpx optimizations for ARMv6 or ARMv7 without NEON.
             ['arm_neon==0', {
               'conditions': [
                 '../../build/android/cpufeatures.gypi',
               ],
             }],
-            ['chromeos == 1', {
-              # ChromeOS needs these files for animated WebM avatars.
-              'sources': [
-                '<(libvpx_source)/third_party/libmkv/EbmlIDs.h',
-                '<(libvpx_source)/third_party/libmkv/EbmlWriter.c',
-                '<(libvpx_source)/third_party/libmkv/EbmlWriter.h',
-              ],
+            ['OS == "ios"', {
+              'xcode_settings': {
+                'OTHER_CFLAGS!': [
+                  # Breaks at least boolhuff_armv5te:token_high_bit_not_set_ev.
+                  '-fstack-protector-all',  # Implies -fstack-protector
+                ],
+              },
             }],
           ],
         },
       ],
       'sources': [
         '<(libvpx_source)/build/make/obj_int_extract.c',
-      ]
+      ],
+      'conditions': [
+        ['android_webview_build==1', {
+          'defines': [ 'FORCE_PARSE_ELF' ],
+          'include_dirs': [ 'include' ],
+        }],
+      ],
     },
     {
       # A library that contains assembly offsets needed.
           'xcode_settings': { 'OTHER_CFLAGS!': [ '-fsanitize=address' ] },
           'ldflags!': [ '-fsanitize=address' ],
         }],
+        ['OS=="win"', {
+          'msvs_settings': {
+            'VCCLCompilerTool': {
+              # Clang uses -fdata-sections when function level linking is
+              # enabled, but libvpx_obj_int_extract expects all data to
+              # reside in the same section on Windows.
+              'EnableFunctionLevelLinking': 'false',
+            },
+          },
+        }],
       ],
       'sources': [
         '<(libvpx_source)/vp8/encoder/vp8_asm_enc_offsets.c',
         'output_dir': '<(shared_generated_dir)',
         'conditions' : [
           ['android_webview_build==1', {
-            'lib_intermediate_name' : '<(android_src)/$(call intermediates-dir-for, STATIC_LIBRARIES, libvpx_asm_offsets_vp8)/libvpx_asm_offsets_vp8.a',
+            # pass the empty string for 3rd and 4th arguments of
+            # intermediates-dir-for macro.
+            'lib_intermediate_name' : '$(abspath $(call intermediates-dir-for,STATIC_LIBRARIES,libvpx_asm_offsets_vp8,,,$(gyp_var_prefix)))/libvpx_asm_offsets_vp8.a',
           }],
           ['(target_arch=="arm" or target_arch=="armv7")', {
             'output_format': 'gas',
                 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
                 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vp8/encoder/libvpx_asm_offsets_vp8.vp8_asm_enc_offsets.obj',
               ],
-              'process_output_as_sources': 1,
+              'process_outputs_as_sources': 1,
             },
           ],
           'sources': [
             'unpack_lib_search_path_list': [
               '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vp8.a',
               '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vp8.a',
+              '-a', '<(LIB_DIR)/chromium/src/third_party/libvpx/libvpx_asm_offsets_vp8.a',
               '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vp8.a',
               '-a', '<(lib_intermediate_name)',
             ],
         'output_dir': '<(shared_generated_dir)',
         'conditions' : [
           ['android_webview_build==1', {
-            'lib_intermediate_name' : '<(android_src)/$(call intermediates-dir-for, STATIC_LIBRARIES, libvpx_asm_offsets_vpx_scale)/libvpx_asm_offsets_vpx_scale.a',
+            # pass the empty string for 3rd and 4th arguments of
+            # intermediates-dir-for macro.
+            'lib_intermediate_name' : '$(abspath $(call intermediates-dir-for,STATIC_LIBRARIES,libvpx_asm_offsets_vpx_scale,,,$(gyp_var_prefix)))/libvpx_asm_offsets_vpx_scale.a',
           }],
           ['(target_arch=="arm" or target_arch=="armv7")', {
             'output_format': 'gas',
                 '-s', '<(ninja_obj_dir)/encoder/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
                 '-s', '<(PRODUCT_DIR)/obj/Source/WebKit/chromium/third_party/libvpx/<(libvpx_source)/vpx_scale/libvpx_asm_offsets_vpx_scale.vpx_scale_asm_offsets.obj',
               ],
-              'process_output_as_sources': 1,
+              'process_outputs_as_sources': 1,
             },
           ],
           'sources': [
             'unpack_lib_search_path_list': [
               '-a', '<(PRODUCT_DIR)/libvpx_asm_offsets_vpx_scale.a',
               '-a', '<(LIB_DIR)/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
+              '-a', '<(LIB_DIR)/chromium/src/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
               '-a', '<(LIB_DIR)/Source/WebKit/chromium/third_party/libvpx/libvpx_asm_offsets_vpx_scale.a',
               '-a', '<(lib_intermediate_name)',
             ],