diff options
author | msarett <msarett@google.com> | 2015-07-07 08:50:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-07 08:50:01 -0700 |
commit | 1c8a587120fd33854974457cf2a795ead98183a9 (patch) | |
tree | 2897642aa9e325f26a38bdd2cd15a01732abcf39 /gyp | |
parent | 5617900063f69754de62b8b12d32f6e36df14104 (diff) |
Add libjpeg-turbo library (depends on yasm)
Mangle external function names to avoid conflict with libjpeg
Take advantage of direct color conversion (RGBA, BGRA, 565)
Prepare to use jpeg_skip_scanlines (when it is upstreamed)
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/b60c3f8291529303299262dba19b1a896060bd2d
Committed: https://skia.googlesource.com/skia/+/f8bf9181d7b0463c8e371755cfbb9ece90b34fc5
Committed: https://skia.googlesource.com/skia/+/e9e3ee33f30c14c31afd5fc3fe4dda7f15783c75
Committed: https://skia.googlesource.com/skia/+/40141b57f061fbfcc2fa38da942d9efe25aca4d0
Review URL: https://codereview.chromium.org/1180983002
Diffstat (limited to 'gyp')
-rw-r--r-- | gyp/codec.gyp | 18 | ||||
-rw-r--r-- | gyp/libjpeg-turbo.gyp | 344 | ||||
-rw-r--r-- | gyp/yasm.gyp | 647 |
3 files changed, 1008 insertions, 1 deletions
diff --git a/gyp/codec.gyp b/gyp/codec.gyp index 0d54184582..c008590dad 100644 --- a/gyp/codec.gyp +++ b/gyp/codec.gyp @@ -18,9 +18,12 @@ 'dependencies': [ 'core.gyp:*', 'giflib.gyp:giflib', - 'libjpeg.gyp:libjpeg', + 'libjpeg-turbo.gyp:libjpeg-turbo', 'libwebp.gyp:libwebp', ], + 'export_dependent_settings': [ + 'libjpeg-turbo.gyp:libjpeg-turbo', + ], 'cflags':[ # FIXME: This gets around a longjmp warning. See # http://build.chromium.org/p/client.skia.compile/builders/Build-Ubuntu-GCC-x86_64-Release-Trybot/builds/113/steps/build%20most/logs/stdio @@ -60,10 +63,23 @@ 'dependencies': [ 'libpng.gyp:libpng', ], + # TODO(msarett): update libjpeg-turbo on Android so we can compile SkJpegCodec + # for the framework. + 'sources!': [ + '../src/codec/SkJpegCodec.cpp', + '../src/codec/SkJpegDecoderMgr.cpp', + '../src/codec/SkJpegUtility_codec.cpp', + ], + 'dependencies!': [ + 'libjpeg-turbo.gyp:libjpeg-turbo', + ], }, { # !skia_android_framework 'dependencies': [ 'libpng.gyp:libpng_static', ], + 'cflags': [ + '-DTURBO_HAS_SKIP', + ], } ] ] diff --git a/gyp/libjpeg-turbo.gyp b/gyp/libjpeg-turbo.gyp new file mode 100644 index 0000000000..25a919fb99 --- /dev/null +++ b/gyp/libjpeg-turbo.gyp @@ -0,0 +1,344 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'xcode_settings': { + 'SYMROOT': '<(DEPTH)/xcodebuild', + }, + 'variables': { + 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/externals/libjpeg-turbo', + 'conditions': [ + [ 'skia_os == "win"', { + 'object_suffix': 'obj', + }, { + 'object_suffix': 'o', + }], + ], + }, + 'targets': [ + { + 'target_name': 'libjpeg-turbo', + 'type': 'static_library', + 'include_dirs': [ + '../third_party/externals/libjpeg-turbo/', + ], + 'defines': [ + 'WITH_SIMD', + 'MOTION_JPEG_SUPPORTED', + 'NO_GETENV', + ], + 'cflags': [ + '-w', # supresses warnings + ], + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions': [ + '/w', + ], + }, + }, + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-w', + ], + }, + 'sources': [ + '../third_party/externals/libjpeg-turbo/jaricom.c', + '../third_party/externals/libjpeg-turbo/jcapimin.c', + '../third_party/externals/libjpeg-turbo/jcapistd.c', + '../third_party/externals/libjpeg-turbo/jcarith.c', + '../third_party/externals/libjpeg-turbo/jccoefct.c', + '../third_party/externals/libjpeg-turbo/jccolor.c', + '../third_party/externals/libjpeg-turbo/jcdctmgr.c', + '../third_party/externals/libjpeg-turbo/jchuff.c', + '../third_party/externals/libjpeg-turbo/jchuff.h', + '../third_party/externals/libjpeg-turbo/jcinit.c', + '../third_party/externals/libjpeg-turbo/jcmainct.c', + '../third_party/externals/libjpeg-turbo/jcmarker.c', + '../third_party/externals/libjpeg-turbo/jcmaster.c', + '../third_party/externals/libjpeg-turbo/jcomapi.c', + '../third_party/externals/libjpeg-turbo/jconfig.h', + '../third_party/externals/libjpeg-turbo/jconfigint.h', + '../third_party/externals/libjpeg-turbo/jcparam.c', + '../third_party/externals/libjpeg-turbo/jcphuff.c', + '../third_party/externals/libjpeg-turbo/jcprepct.c', + '../third_party/externals/libjpeg-turbo/jcsample.c', + '../third_party/externals/libjpeg-turbo/jdapimin.c', + '../third_party/externals/libjpeg-turbo/jdapistd.c', + '../third_party/externals/libjpeg-turbo/jdarith.c', + '../third_party/externals/libjpeg-turbo/jdcoefct.c', + '../third_party/externals/libjpeg-turbo/jdcolor.c', + '../third_party/externals/libjpeg-turbo/jdct.h', + '../third_party/externals/libjpeg-turbo/jddctmgr.c', + '../third_party/externals/libjpeg-turbo/jdhuff.c', + '../third_party/externals/libjpeg-turbo/jdhuff.h', + '../third_party/externals/libjpeg-turbo/jdinput.c', + '../third_party/externals/libjpeg-turbo/jdmainct.c', + '../third_party/externals/libjpeg-turbo/jdmarker.c', + '../third_party/externals/libjpeg-turbo/jdmaster.c', + '../third_party/externals/libjpeg-turbo/jdmerge.c', + '../third_party/externals/libjpeg-turbo/jdphuff.c', + '../third_party/externals/libjpeg-turbo/jdpostct.c', + '../third_party/externals/libjpeg-turbo/jdsample.c', + '../third_party/externals/libjpeg-turbo/jerror.c', + '../third_party/externals/libjpeg-turbo/jerror.h', + '../third_party/externals/libjpeg-turbo/jfdctflt.c', + '../third_party/externals/libjpeg-turbo/jfdctfst.c', + '../third_party/externals/libjpeg-turbo/jfdctint.c', + '../third_party/externals/libjpeg-turbo/jidctflt.c', + '../third_party/externals/libjpeg-turbo/jidctfst.c', + '../third_party/externals/libjpeg-turbo/jidctint.c', + '../third_party/externals/libjpeg-turbo/jidctred.c', + '../third_party/externals/libjpeg-turbo/jinclude.h', + '../third_party/externals/libjpeg-turbo/jmemmgr.c', + '../third_party/externals/libjpeg-turbo/jmemnobs.c', + '../third_party/externals/libjpeg-turbo/jmemsys.h', + '../third_party/externals/libjpeg-turbo/jmorecfg.h', + '../third_party/externals/libjpeg-turbo/jpegint.h', + '../third_party/externals/libjpeg-turbo/jpeglib.h', + '../third_party/externals/libjpeg-turbo/jpeglibmangler.h', + '../third_party/externals/libjpeg-turbo/jquant1.c', + '../third_party/externals/libjpeg-turbo/jquant2.c', + '../third_party/externals/libjpeg-turbo/jutils.c', + '../third_party/externals/libjpeg-turbo/jversion.h', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '../third_party/externals/libjpeg-turbo/', + ], + }, + 'msvs_disabled_warnings': [4018, 4101], + # VS2010 does not correctly incrementally link obj files generated + # from asm files. This flag disables UseLibraryDependencyInputs to + # avoid this problem. + 'msvs_2010_disable_uldi_when_referenced': 1, + + # Add target-specific source files. + 'conditions': [ + [ 'skia_arch_type == "x86"', { + 'sources': [ + '../third_party/externals/libjpeg-turbo/simd/jsimd_i386.c', + '../third_party/externals/libjpeg-turbo/simd/jccolor-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jcgray-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jcsample-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jdcolor-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jdmerge-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jdsample-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctflt-3dn.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctfst-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctint-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctflt-3dn.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctfst-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctint-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctred-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jquant-3dn.asm', + '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2.asm', + '../third_party/externals/libjpeg-turbo/simd/jquant-mmx.asm', + '../third_party/externals/libjpeg-turbo/simd/jquant-sse.asm', + '../third_party/externals/libjpeg-turbo/simd/jsimdcpu.asm', + ], + }], + [ 'skia_arch_type == "x86_64"', { + 'sources': [ + '../third_party/externals/libjpeg-turbo/simd/jsimd_x86_64.c', + '../third_party/externals/libjpeg-turbo/simd/jccolor-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jcgray-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jcsample-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jdcolor-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jdmerge-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jdsample-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctflt-sse-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctfst-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jfdctint-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctflt-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctfst-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctint-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jidctred-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jquantf-sse2-64.asm', + '../third_party/externals/libjpeg-turbo/simd/jquanti-sse2-64.asm', + ], + }], + [ 'skia_arch_type == "arm64"', { + 'sources': [ + '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64.c', + '../third_party/externals/libjpeg-turbo/simd/jsimd_arm64_neon.S', + ], + }], + [ 'skia_arch_type == "arm"', { + 'conditions': [ + [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', { + 'sources': [ + '../third_party/externals/libjpeg-turbo/simd/jsimd_arm.c', + '../third_party/externals/libjpeg-turbo/simd/jsimd_arm_neon.S', + ], + }, { + 'sources': [ + '../third_party/externals/libjpeg-turbo/jsimd_none.c', + ], + }], + ], + }], + [ 'skia_arch_type == "mips"', { + 'conditions': [ + [ 'skia_arch_width == 64', { + 'sources': [ + '../third_party/externals/libjpeg-turbo/simd/jsimd_mips.c', + '../third_party/externals/libjpeg-turbo/simd/jsimd_mips_dspr2_asm.h', + '../third_party/externals/libjpeg-turbo/simd/jsimd_mips_dspr2.S', + ], + }, { + 'sources': [ + '../third_party/externals/libjpeg-turbo/jsimd_none.c', + ], + }], + ], + }], + + # Build rules for an asm file. + # On Windows, we use the precompiled yasm binary. + # On Linux, we build our patched yasm and use it except when use_system_yasm is 1. + # On Mac, we always build our patched yasm and use it. + [ 'skia_os == "win"', { + 'variables': { + 'yasm_path': '../third_party/externals/yasm/binaries/win/yasm.exe', + 'conditions': [ + [ 'skia_arch_type == "x86"', { + 'yasm_format': '-fwin32', + 'yasm_flags': [ + '-D__x86__', + '-DWIN32', + '-DMSVC', + '-Iwin/' + ], + }, { + 'yasm_format': '-fwin64', + 'yasm_flags': [ + '-D__x86_64__', + '-DWIN64', + '-DMSVC', + '-Iwin/' + ], + }], + ], + }, + }], + [ 'skia_os == "android" and (skia_arch_type == "x86" or skia_arch_type == "x86_64")', { + 'variables': { + 'yasm_path': '../third_party/yasm/config/android/yasm', + 'conditions': [ + [ 'skia_arch_type == "x86"', { + 'yasm_format': '-felf', + 'yasm_flags': [ + '-D__x86__', + '-DELF', + '-Ilinux/' + ], + }, { + 'yasm_format': '-felf64', + 'yasm_flags': [ + '-D__x86_64__', + '-DELF', + '-Ilinux/' + ], + }], + ], + }, + }], + [ '(skia_os == "mac" or skia_os == "ios") and \ + (skia_arch_type == "x86" or skia_arch_type == "x86_64")', { + 'dependencies': [ + 'yasm.gyp:yasm#host', + ], + 'variables': { + 'yasm_path': '<(PRODUCT_DIR)/yasm', + 'conditions': [ + [ 'skia_arch_type == "x86"', { + 'yasm_format': '-fmacho', + 'yasm_flags': [ + '-D__x86__', + '-DMACHO', + '-Imac/' + ], + }, { + 'yasm_format': '-fmacho64', + 'yasm_flags': [ + '-D__x86_64__', + '-DMACHO', + '-Imac/' + ], + }], + ], + }, + }], + [ '(skia_os == "linux" or skia_os == "freebsd" or skia_os == "openbsd" or \ + skia_os == "solaris" or skia_os == "chromeos")', { + 'dependencies': [ + 'yasm.gyp:yasm#host', + ], + 'variables': { + 'yasm_path': '<(PRODUCT_DIR)/yasm', + 'conditions': [ + [ 'skia_arch_type == "x86"', { + 'yasm_format': '-felf', + 'yasm_flags': [ + '-D__x86__', + '-DELF', + '-Ilinux/' + ], + }, { + 'yasm_format': '-felf64', + 'yasm_flags': [ + '-D__x86_64__', + '-DELF', + '-Ilinux/' + ], + }], + ], + }, + }], + ], + 'rules': [ + { + 'rule_name': 'assemble', + 'extension': 'asm', + 'conditions': [ + [ 'skia_arch_type == "x86" or skia_arch_type == "x86_64"', { + 'inputs': [], + 'outputs': [ + '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)', + ], + 'action': [ + '<(yasm_path)', + '<(yasm_format)', + '<@(yasm_flags)', + '-DRGBX_FILLER_0XFF', + '-DSTRICT_MEMORY_ACCESS', + '-Isimd/', + '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).<(object_suffix)', + '<(RULE_INPUT_PATH)', + ], + 'process_outputs_as_sources': 1, + 'message': 'Building <(RULE_INPUT_ROOT).<(object_suffix)', + }], + ] + }, + ], + }, + ], +} diff --git a/gyp/yasm.gyp b/gyp/yasm.gyp new file mode 100644 index 0000000000..44792f0226 --- /dev/null +++ b/gyp/yasm.gyp @@ -0,0 +1,647 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# The yasm build process creates a slew of small C subprograms that +# dynamically generate files at various point in the build process. This makes +# the build integration moderately complex. +# +# There are three classes of dynamically generated files: +# 1) C source files that should be included in the build (eg., lc3bid.c) +# 2) C source files that are #included by static C sources (eg., license.c) +# 3) Intermediate files that are used as input by other subprograms to +# further generate files in category #1 or #2. (eg., version.mac) +# +# This structure is represented with the following targets: +# 1) yasm -- Sources, flags for the main yasm executable. Also has most of +# of the actions and rules that invoke the subprograms. +# 2) config_sources -- Checked in version of files generated by manually +# running configure that are used by all binaries. +# 3) generate_files -- Actions and rules for files of type #3. +# 4) genperf_libs -- Object files shared between yasm and the genperf +# subprogram. +# 5) genmacro, genmodule, etc. -- One executable target for each subprogram. +# +# You will notice that a lot of the action targets seem very similar -- +# especially for genmacro invocations. This makes it seem like they should +# be a rule. The problem is that the correct invocation cannot be inferred +# purely from the file name, or extension. Nor is it obvious whether the +# output should be processed as a source or not. Thus, we are left with a +# large amount of repetitive code. + +{ + 'xcode_settings': { + 'SYMROOT': '<(DEPTH)/xcodebuild', + }, + 'variables': { + 'yasm_include_dirs': [ + '../third_party/yasm/config/<(skia_os)', + '../third_party/externals/yasm/source/patched-yasm', + ], + + # The cflags used by any target that will be directly linked into yasm. + # These are specifically not used when building the subprograms. While + # it would probably be safe to use these flags there as well, the + # ./configure based build does not use the same flags between the main + # yasm executable, and its subprograms. + 'yasm_defines': ['HAVE_CONFIG_H'], + 'yasm_cflags': [ + '-std=gnu99', + '-ansi', + '-pedantic', + '-w', + ], + + # Locations for various generated artifacts. + 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/yasm', + 'generated_dir': '<(INTERMEDIATE_DIR)/third_party/yasm', + + # Various files referenced by multiple targets. + 'version_file': 'version.mac', # Generated by genversion. + 'genmodule_source': 'genmodule_outfile.c', + }, + 'target_defaults': { + # Silence warnings in libc++ builds (C code doesn't need this flag). + 'ldflags!': [ '-stdlib=libc++', '-fsanitize=address' ], + # https://crbug.com/489901 + 'cflags!': [ '-fsanitize=bounds', '-fsanitize=address' ], + }, + 'targets': [ + { + 'target_name': 'yasm', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ + 'config_sources', + 'genmacro', + 'genmodule', + 'genperf', + 'genperf_libs', + 'generate_files', # Needed to generate gperf and instruction files. + 'genstring', + 're2c', + ], + 'variables': { + 'clang_warning_flags': [ + # yasm passes a `const elf_machine_sym*` through `void*`. + '-Wno-incompatible-pointer-types', + ], + }, + 'conditions': [ + ['skia_os == "win"', { + # As of VS 2013 Update 3, building this project with /analyze hits an + # internal compiler error on elf-x86-amd64.c in release builds with + # the amd64_x86 compiler. This halts the build and prevents subsequent + # analysis. Therefore, /analyze is disabled for this project. See this + # bug for details: + # https://connect.microsoft.com/VisualStudio/feedback/details/1014799/internal-compiler-error-when-using-analyze + 'msvs_settings': { + 'VCCLCompilerTool': { + 'AdditionalOptions!': [ '/analyze' ] + }, + }, + }], + ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/frontends/yasm/yasm-options.c', + '../third_party/externals/yasm/source/patched-yasm/frontends/yasm/yasm.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/assocdat.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-align.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-data.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-incbin.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-org.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bc-reserve.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bitvect.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/bytecode.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/errwarn.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/expr.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/file.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/floatnum.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/hamt.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/insn.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/intnum.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/inttree.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/linemap.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/md5.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/mergesort.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/section.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/strcasecmp.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/strsep.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/symrec.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/valparam.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/value.c', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/lc3b/lc3barch.c', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/lc3b/lc3bbc.c', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86arch.c', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86bc.c', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86expr.c', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86id.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/codeview/cv-dbgfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/codeview/cv-symline.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/codeview/cv-type.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-aranges.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-dbgfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-info.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/dwarf2-line.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/null/null-dbgfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/dbgfmts/stabs/stabs-dbgfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/listfmts/nasm/nasm-listfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/bin/bin-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/coff-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/win64-except.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/dbg/dbg-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf-x86-amd64.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf-x86-x86.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/elf/elf.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/macho/macho-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/rdf/rdf-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/xdf/xdf-objfmt.c', + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-parse.c', + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-parse-intel.c', + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-parser.c', + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-parse.c', + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-parser.c', + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/cpp/cpp-preproc.c', + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasm-eval.c', + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasm-pp.c', + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c', + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/nasmlib.c', + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/raw/raw-preproc.c', + + # Sources needed by re2c. + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/gas/gas-token.re', + '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-token.re', + + # Sources needed by genperf. Make sure the generated gperf files + # (the ones in shared_generated_dir) are synced with the outputs + # for the related generate_*_insn actions in the generate_files + # target below. + '<(shared_generated_dir)/x86insn_nasm.gperf', + '<(shared_generated_dir)/x86insn_gas.gperf', + '<(shared_generated_dir)/x86cpu.c', + '<(shared_generated_dir)/x86regtmod.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + '<(shared_generated_dir)', + '<(generated_dir)', + ], + 'defines': [ '<@(yasm_defines)' ], + 'cflags': [ '<@(yasm_cflags)', ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-w', + ], + }, + 'msvs_disabled_warnings': [ 4267 ], + 'rules': [ + { + 'rule_name': 'generate_gperf', + 'extension': 'gperf', + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genperf<(EXECUTABLE_SUFFIX)' ], + 'outputs': [ + '<(generated_dir)/<(RULE_INPUT_ROOT).c', + ], + 'action': ['<(PRODUCT_DIR)/genperf', + '<(RULE_INPUT_PATH)', + '<(generated_dir)/<(RULE_INPUT_ROOT).c', + ], + # These files are #included, so do not treat them as sources. + 'process_outputs_as_sources': 0, + 'message': 'yasm gperf for <(RULE_INPUT_PATH)', + }, + { + 'rule_name': 'generate_re2c', + 'extension': 're', + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)re2c<(EXECUTABLE_SUFFIX)' ], + 'outputs': [ '<(generated_dir)/<(RULE_INPUT_ROOT).c', ], + 'action': [ + '<(PRODUCT_DIR)/re2c', + '-b', + '-o', + '<(generated_dir)/<(RULE_INPUT_ROOT).c', + '<(RULE_INPUT_PATH)', + ], + 'process_outputs_as_sources': 1, + 'message': 'yasm re2c for <(RULE_INPUT_PATH)', + }, + ], + 'actions': [ + ### + ### genmacro calls. + ### + { + 'action_name': 'generate_nasm_macros', + 'variables': { + 'infile': '../third_party/externals/yasm/source/patched-yasm/modules/parsers/nasm/nasm-std.mac', + 'varname': 'nasm_standard_mac', + 'outfile': '<(generated_dir)/nasm-macros.c', + }, + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)', + '<(infile)', ], + 'outputs': [ '<(outfile)', ], + 'action': ['<(PRODUCT_DIR)/genmacro', + '<(outfile)', '<(varname)', '<(infile)', ], + # Not a direct source because this is #included by + # source/patched-yasm/modules/parsers/nasm/nasm-parser.c + 'process_outputs_as_sources': 1, + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-w', + ], + }, + 'message': 'yasm genmacro for <(infile)', + }, + { + 'action_name': 'generate_nasm_version', + 'variables': { + 'infile': '<(shared_generated_dir)/<(version_file)', + 'varname': 'nasm_version_mac', + 'outfile': '<(generated_dir)/nasm-version.c', + }, + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)', + '<(infile)', ], + 'outputs': [ '<(outfile)', ], + 'action': ['<(PRODUCT_DIR)/genmacro', + '<(outfile)', '<(varname)', '<(infile)', + ], + # Not a direct source because this is #included by + # source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c + 'process_outputs_as_sources': 0, + 'message': 'yasm genmacro for <(infile)', + }, + { + 'action_name': 'generate_win64_gas', + 'variables': { + 'infile': '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/win64-gas.mac', + 'varname': 'win64_gas_stdmac', + 'outfile': '<(generated_dir)/win64-gas.c', + }, + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)', + '<(infile)', ], + 'outputs': [ '<(outfile)', ], + 'action': ['<(PRODUCT_DIR)/genmacro', + '<(outfile)', '<(varname)', '<(infile)', + ], + # Not a direct source because this is #included by + # source/patched-yasm/modules/objfmts/coff/coff-objfmt.c + 'process_outputs_as_sources': 0, + 'message': 'yasm genmacro for <(infile)', + }, + { + 'action_name': 'generate_win64_nasm', + 'variables': { + 'infile': '../third_party/externals/yasm/source/patched-yasm/modules/objfmts/coff/win64-nasm.mac', + 'varname': 'win64_nasm_stdmac', + 'outfile': '<(generated_dir)/win64-nasm.c', + }, + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genmacro<(EXECUTABLE_SUFFIX)', + '<(infile)', ], + 'outputs': [ '<(outfile)', ], + 'action': ['<(PRODUCT_DIR)/genmacro', + '<(outfile)', + '<(varname)', + '<(infile)', + ], + # Not a direct source because this is #included by + # source/patched-yasm/modules/objfmts/coff/coff-objfmt.c + 'process_outputs_as_sources': 0, + 'message': 'yasm genmacro for <(infile)', + }, + + ### + ### genstring call. + ### + { + 'action_name': 'generate_license', + 'variables': { + 'infile': '../third_party/externals/yasm/source/patched-yasm/COPYING', + 'varname': 'license_msg', + 'outfile': '<(generated_dir)/license.c', + }, + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genstring<(EXECUTABLE_SUFFIX)', + '<(infile)', ], + 'outputs': [ '<(outfile)', ], + 'action': ['<(PRODUCT_DIR)/genstring', + '<(varname)', + '<(outfile)', + '<(infile)', + ], + # Not a direct source because this is #included by + # source/patched-yasm/frontends/yasm/yasm.c + 'process_outputs_as_sources': 0, + 'message': 'Generating yasm embeddable license', + }, + + ### + ### A re2c call that doesn't fit into the rule below. + ### + { + 'action_name': 'generate_lc3b_token', + 'variables': { + 'infile': '../third_party/externals/yasm/source/patched-yasm/modules/arch/lc3b/lc3bid.re', + # The license file is #included by yasm.c. + 'outfile': '<(generated_dir)/lc3bid.c', + }, + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)re2c<(EXECUTABLE_SUFFIX)', + '<(infile)', ], + 'outputs': [ '<(outfile)', ], + 'action': [ + '<(PRODUCT_DIR)/re2c', + '-s', + '-o', '<(outfile)', + '<(infile)' + ], + 'process_outputs_as_sources': 1, + 'message': 'Generating yasm tokens for lc3b', + }, + + ### + ### genmodule call. + ### + { + 'action_name': 'generate_module', + 'variables': { + 'makefile': '../third_party/yasm/config/<(skia_os)/Makefile', + 'module_in': '../third_party/externals/yasm/source/patched-yasm/libyasm/module.in', + 'outfile': '<(generated_dir)/module.c', + }, + 'inputs': [ + '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)genmodule<(EXECUTABLE_SUFFIX)', + '<(module_in)', + '<(makefile)' + ], + 'outputs': [ '<(generated_dir)/module.c' ], + 'action': [ + '<(PRODUCT_DIR)/genmodule', + '<(module_in)', + '<(makefile)', + '<(outfile)' + ], + 'process_outputs_as_sources': 1, + 'message': 'Generating yasm module information', + }, + ], + }, + { + 'target_name': 'config_sources', + 'type': 'none', + 'toolsets': ['host'], + 'sources': [ + '../third_party/yasm/config/<(skia_os)/Makefile', + '../third_party/yasm/config/<(skia_os)/config.h', + '../third_party/yasm/config/<(skia_os)/libyasm-stdint.h', + ], + }, + { + 'target_name': 'generate_files', + 'type': 'none', + 'toolsets': ['host'], + 'dependencies': [ + 'genperf', + 'genversion', + ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86cpu.gperf', + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/x86regtmod.gperf', + ], + 'rules': [ + { + 'rule_name': 'generate_gperf', + 'extension': 'gperf', + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genperf<(EXECUTABLE_SUFFIX)' ], + 'outputs': [ '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c', ], + 'action': [ + '<(PRODUCT_DIR)/genperf', + '<(RULE_INPUT_PATH)', + '<(shared_generated_dir)/<(RULE_INPUT_ROOT).c', + ], + 'process_outputs_as_sources': 0, + 'message': 'yasm genperf for <(RULE_INPUT_PATH)', + }, + ], + 'actions': [ + { + 'action_name': 'generate_x86_insn', + 'variables': { + 'gen_insn_path': + '../third_party/externals/yasm/source/patched-yasm/modules/arch/x86/gen_x86_insn.py', + }, + 'inputs': [ '<(gen_insn_path)', ], + 'outputs': [ + '<(shared_generated_dir)/x86insns.c', + '<(shared_generated_dir)/x86insn_gas.gperf', + '<(shared_generated_dir)/x86insn_nasm.gperf', + ], + 'action': [ + 'python', + '<(gen_insn_path)', + '<(shared_generated_dir)', + ], + 'message': 'Running <(gen_insn_path)', + 'process_outputs_as_sources': 0, + }, + { + 'action_name': 'generate_version', + 'inputs': [ '<(PRODUCT_DIR)/' + '<(EXECUTABLE_PREFIX)genversion<(EXECUTABLE_SUFFIX)' ], + 'outputs': [ '<(shared_generated_dir)/<(version_file)', ], + 'action': [ + '<(PRODUCT_DIR)/genversion', + '<(shared_generated_dir)/<(version_file)' + ], + 'message': 'Generating yasm version file: ' + '<(shared_generated_dir)/<(version_file)', + 'process_outputs_as_sources': 0, + }, + ], + }, + { + 'target_name': 'genperf_libs', + 'type': 'static_library', + 'toolsets': ['host'], + 'dependencies': [ 'config_sources', ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/libyasm/phash.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/xmalloc.c', + '../third_party/externals/yasm/source/patched-yasm/libyasm/xstrdup.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + ], + 'defines': [ '<@(yasm_defines)' ], + 'cflags': [ + '<@(yasm_cflags)', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + }, + { + 'target_name': 'genstring', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ 'config_sources', ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/genstring.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + ], + 'cflags': [ + '-std=gnu99', + '-w', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + }, + { + 'target_name': 'genperf', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ + 'genperf_libs', + ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/tools/genperf/genperf.c', + '../third_party/externals/yasm/source/patched-yasm/tools/genperf/perfect.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + ], + 'cflags': [ + '-std=gnu99', + '-w', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + }, + { + 'target_name': 'genmacro', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ 'config_sources', ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/tools/genmacro/genmacro.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + ], + 'cflags': [ + '-std=gnu99', + '-w', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + }, + { + 'target_name': 'genversion', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ 'config_sources', ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/modules/preprocs/nasm/genversion.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + ], + 'cflags': [ + '-std=gnu99', + '-w', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + }, + { + 'target_name': 're2c', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ 'config_sources', ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/main.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/code.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/dfa.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/parser.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/actions.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/scanner.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/mbo_getopt.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/substr.c', + '../third_party/externals/yasm/source/patched-yasm/tools/re2c/translate.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + ], + 'cflags': [ + '-std=gnu99', + '-w', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + 'xcode_settings': { + 'WARNING_CFLAGS': [ + '-w', + ], + }, + 'variables': { + # re2c is missing CLOSEVOP from one switch. + 'clang_warning_flags': [ '-Wno-switch' ], + }, + 'msvs_disabled_warnings': [ 4267 ], + }, + { + 'target_name': 'genmodule', + 'type': 'executable', + 'toolsets': ['host'], + 'dependencies': [ + 'config_sources', + ], + 'sources': [ + '../third_party/externals/yasm/source/patched-yasm/libyasm/genmodule.c', + ], + 'include_dirs': [ + '<@(yasm_include_dirs)', + + ], + 'cflags': [ + '-std=gnu99', + ], + 'cflags!': [ + '-mfpu=neon', + '-mthumb', + '-march=armv7-a', + ], + }, + ], +} |