diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 11:23:08 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-30 11:23:08 +0000 |
commit | 795cde3d24bbe37039e415c45e947be6d95b0a28 (patch) | |
tree | 2b3a401352c71730fd3e90d7ac4db774077b7283 /third_party/ffmpeg/ffmpeg.gyp | |
parent | c567b48d1af4239266f99c7c79611f07723b2704 (diff) | |
download | chromium_src-795cde3d24bbe37039e415c45e947be6d95b0a28.zip chromium_src-795cde3d24bbe37039e415c45e947be6d95b0a28.tar.gz chromium_src-795cde3d24bbe37039e415c45e947be6d95b0a28.tar.bz2 |
Add yasm and ffmpeg into the build tree for linux.
BUG=22307
TEST=builds correctly, and an html5 video runs.
Review URL: http://codereview.chromium.org/300013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/ffmpeg/ffmpeg.gyp')
-rwxr-xr-x | third_party/ffmpeg/ffmpeg.gyp | 417 |
1 files changed, 378 insertions, 39 deletions
diff --git a/third_party/ffmpeg/ffmpeg.gyp b/third_party/ffmpeg/ffmpeg.gyp index 0ddba93..947aa34 100755 --- a/third_party/ffmpeg/ffmpeg.gyp +++ b/third_party/ffmpeg/ffmpeg.gyp @@ -9,15 +9,359 @@ ['OS!="mac"', {'sources/': [['exclude', '/mac/']]}], ['OS!="win"', {'sources/': [['exclude', '/win/']]}], ], + 'variables': { + # Since we are not often debugging FFmpeg, and performance is + # unacceptable without optimization, freeze the optimizations to -O2. + # If someone really wants -O1 , they can change these in their checkout. + # If you want -O0, see the Gotchas in README.Chromium for why that + # won't work. + 'debug_optimize': '2', + 'mac_debug_optimization': '2', + }, }, 'variables': { - # Allow overridding the selection of which ffmpeg binaries to copy via an + # Allow overridding the selection of which FFmpeg binaries to copy via an # environment variable. Affects the ffmpeg_binaries target. 'ffmpeg_branding%': '<(branding)', 'ffmpeg_variant%': '<(target_arch)', - 'use_system_ffmpeg%': 0, + # Locations for generated artifacts. + 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/ffmpeg', + 'asm_library': 'ffmpegasm', }, + 'conditions': [ + # This condition is for migrating from pre-built binaries to an in-tree + # source build. Most of these should be removed once FFmpeg is built on + # mac and linux. Windows will take more work. + # + # TODO(ajwong): Per the comment above, reduce this conditional's size and + # determine if in-tree build in Windows is tractable. + ['OS!="linux" and OS!="freebsd"', { + 'variables': { + 'target_for_binaries': 'ffmpeg_binaries', + 'ffmpeg_include_root': 'include', + }, + },{ # else OS=="linux" + 'variables': { + 'target_for_binaries': 'ffmpegsumo_nolink', + 'ffmpeg_include_root': 'source/patched-ffmpeg-mt', + }, + 'targets': [ + { + 'target_name': 'ffmpegsumo', + 'type': 'shared_library', + 'dependencies': [ + 'make_ffmpeg_asm_lib', + ], + 'sources': [ + 'source/patched-ffmpeg-mt/libavcodec/aac.c', + 'source/patched-ffmpeg-mt/libavcodec/aac_ac3_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/aac_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/aactab.c', + 'source/patched-ffmpeg-mt/libavcodec/allcodecs.c', + 'source/patched-ffmpeg-mt/libavcodec/audioconvert.c', + 'source/patched-ffmpeg-mt/libavcodec/avpacket.c', + 'source/patched-ffmpeg-mt/libavcodec/bitstream.c', + 'source/patched-ffmpeg-mt/libavcodec/bitstream_filter.c', + 'source/patched-ffmpeg-mt/libavcodec/cabac.c', + 'source/patched-ffmpeg-mt/libavcodec/dsputil.c', + 'source/patched-ffmpeg-mt/libavcodec/error_resilience.c', + 'source/patched-ffmpeg-mt/libavcodec/eval.c', + 'source/patched-ffmpeg-mt/libavcodec/faanidct.c', + 'source/patched-ffmpeg-mt/libavcodec/fft.c', + 'source/patched-ffmpeg-mt/libavcodec/golomb.c', + 'source/patched-ffmpeg-mt/libavcodec/h264.c', + 'source/patched-ffmpeg-mt/libavcodec/h264_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/h264idct.c', + 'source/patched-ffmpeg-mt/libavcodec/h264pred.c', + 'source/patched-ffmpeg-mt/libavcodec/imgconvert.c', + 'source/patched-ffmpeg-mt/libavcodec/jrevdct.c', + 'source/patched-ffmpeg-mt/libavcodec/mdct.c', + 'source/patched-ffmpeg-mt/libavcodec/mpeg4audio.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudio.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudio_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodata.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodec.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodecheader.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegvideo.c', + 'source/patched-ffmpeg-mt/libavcodec/opt.c', + 'source/patched-ffmpeg-mt/libavcodec/options.c', + 'source/patched-ffmpeg-mt/libavcodec/parser.c', + 'source/patched-ffmpeg-mt/libavcodec/pthread.c', + 'source/patched-ffmpeg-mt/libavcodec/raw.c', + 'source/patched-ffmpeg-mt/libavcodec/resample.c', + 'source/patched-ffmpeg-mt/libavcodec/resample2.c', + 'source/patched-ffmpeg-mt/libavcodec/simple_idct.c', + 'source/patched-ffmpeg-mt/libavcodec/utils.c', + 'source/patched-ffmpeg-mt/libavcodec/vorbis.c', + 'source/patched-ffmpeg-mt/libavcodec/vorbis_data.c', + 'source/patched-ffmpeg-mt/libavcodec/vorbis_dec.c', + 'source/patched-ffmpeg-mt/libavcodec/vp3.c', + 'source/patched-ffmpeg-mt/libavcodec/vp3dsp.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/cpuid.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/dnxhd_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/dsputil_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/fdct_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/fft_3dn.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/fft_3dn2.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/fft_sse.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/idct_mmx_xvid.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/idct_sse2_xvid.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/motion_est_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/mpegvideo_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/simple_idct_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/vp3dsp_mmx.c', + 'source/patched-ffmpeg-mt/libavcodec/x86/vp3dsp_sse2.c', + 'source/patched-ffmpeg-mt/libavcodec/xiph.c', + 'source/patched-ffmpeg-mt/libavformat/allformats.c', + 'source/patched-ffmpeg-mt/libavformat/avio.c', + 'source/patched-ffmpeg-mt/libavformat/aviobuf.c', + 'source/patched-ffmpeg-mt/libavformat/cutils.c', + 'source/patched-ffmpeg-mt/libavformat/id3v2.c', + 'source/patched-ffmpeg-mt/libavformat/isom.c', + 'source/patched-ffmpeg-mt/libavformat/metadata.c', + 'source/patched-ffmpeg-mt/libavformat/metadata_compat.c', + 'source/patched-ffmpeg-mt/libavformat/mov.c', + 'source/patched-ffmpeg-mt/libavformat/mp3.c', + 'source/patched-ffmpeg-mt/libavformat/oggdec.c', + 'source/patched-ffmpeg-mt/libavformat/oggparseogm.c', + 'source/patched-ffmpeg-mt/libavformat/oggparsetheora.c', + 'source/patched-ffmpeg-mt/libavformat/oggparsevorbis.c', + 'source/patched-ffmpeg-mt/libavformat/options.c', + 'source/patched-ffmpeg-mt/libavformat/os_support.c', + 'source/patched-ffmpeg-mt/libavformat/riff.c', + 'source/patched-ffmpeg-mt/libavformat/sdp.c', + 'source/patched-ffmpeg-mt/libavformat/utils.c', + 'source/patched-ffmpeg-mt/libavutil/adler32.c', + 'source/patched-ffmpeg-mt/libavutil/aes.c', + 'source/patched-ffmpeg-mt/libavutil/avstring.c', + 'source/patched-ffmpeg-mt/libavutil/base64.c', + 'source/patched-ffmpeg-mt/libavutil/crc.c', + 'source/patched-ffmpeg-mt/libavutil/des.c', + 'source/patched-ffmpeg-mt/libavutil/fifo.c', + 'source/patched-ffmpeg-mt/libavutil/intfloat_readwrite.c', + 'source/patched-ffmpeg-mt/libavutil/lfg.c', + 'source/patched-ffmpeg-mt/libavutil/lls.c', + 'source/patched-ffmpeg-mt/libavutil/log.c', + 'source/patched-ffmpeg-mt/libavutil/lzo.c', + 'source/patched-ffmpeg-mt/libavutil/mathematics.c', + 'source/patched-ffmpeg-mt/libavutil/md5.c', + 'source/patched-ffmpeg-mt/libavutil/mem.c', + 'source/patched-ffmpeg-mt/libavutil/random_seed.c', + 'source/patched-ffmpeg-mt/libavutil/rational.c', + 'source/patched-ffmpeg-mt/libavutil/rc4.c', + 'source/patched-ffmpeg-mt/libavutil/sha1.c', + 'source/patched-ffmpeg-mt/libavutil/tree.c', + 'source/patched-ffmpeg-mt/libavutil/utils.c', + + # Config file for the OS and architecture. + 'source/config/<(ffmpeg_branding)/<(OS)/<(target_arch)/config.h', + ], + 'include_dirs': [ + 'source/config/<(ffmpeg_branding)/<(OS)/<(target_arch)', + 'source/patched-ffmpeg-mt', + ], + 'cflags': [ + '-DHAVE_AV_CONFIG_H', + '-D_ISOC99_SOURCE', + '-D_POSIX_C_SOURCE=200112', + '-std=c99', + '-D_LARGEFILE_SOURCE', + '-pthread', + '-fno-math-errno', + '-fomit-frame-pointer' + ], + 'cflags!': [ + # Ensure the symbols are exported. + '-fvisibility=hidden', + ], + 'ldflags': [ + '-Wl,-Bsymbolic', + '-L<(shared_generated_dir)', + ], + 'libraries': [ + '-l<(asm_library)', + '-lm', + + # TODO(ajwong): Statically link these once we resolve the + # PIC/non-PIC issues on x64. + '-lz', + '-lbz2', + ], + 'conditions': [ + ['target_arch=="x64"', { + 'cflags': [ + # x64 requires PIC for shared libraries. This is opposite + # of ia32 where due to a slew of inline assembly using ebx, + # FFmpeg CANNOT be built with PIC. + '-fPIC', + '-DPIC', + ], + }], + ['ffmpeg_branding!="Chrome"', { + 'sources!': [ + # Exclude files that should only be used if doing a branded + # Google Chrome build. + 'source/patched-ffmpeg-mt/libavcodec/aac.c', + 'source/patched-ffmpeg-mt/libavcodec/aac_ac3_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/aac_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/aactab.c', + 'source/patched-ffmpeg-mt/libavcodec/cabac.c', + 'source/patched-ffmpeg-mt/libavcodec/error_resilience.c', + 'source/patched-ffmpeg-mt/libavcodec/golomb.c', + 'source/patched-ffmpeg-mt/libavcodec/h264.c', + 'source/patched-ffmpeg-mt/libavcodec/h264_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/h264idct.c', + 'source/patched-ffmpeg-mt/libavcodec/h264pred.c', + 'source/patched-ffmpeg-mt/libavcodec/mpeg4audio.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudio.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudio_parser.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodata.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodec.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodecheader.c', + 'source/patched-ffmpeg-mt/libavcodec/mpegvideo.c', + 'source/patched-ffmpeg-mt/libavformat/id3v2.c', + 'source/patched-ffmpeg-mt/libavformat/isom.c', + 'source/patched-ffmpeg-mt/libavformat/mov.c', + 'source/patched-ffmpeg-mt/libavformat/mp3.c', + ], + }], + ], + 'actions': [ + { + # Needed to serialize the output of make_ffmpeg_asm_lib with + # this target being built. + 'action_name': 'ffmpegasm_barrier', + 'inputs': [ + '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STATIC_LIB_SUFFIX)', + ], + 'outputs': [ + '<(INTERMEDIATE_DIR)/third_party/ffmpeg/<(asm_library)' + ], + 'action': [ + 'touch', + '<(INTERMEDIATE_DIR)/third_party/ffmpeg/<(asm_library)' + ], + 'process_outputs_as_sources': 0, + 'message': 'Serializing build of <(asm_library).', + }, + ], + }, + { + 'target_name': 'assemble_ffmpeg_asm', + 'type': 'none', + 'dependencies': [ + '../yasm/yasm.gyp:yasm', + ], + 'sources': [ + # The FFmpeg yasm files. + 'source/patched-ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm', + 'source/patched-ffmpeg-mt/libavcodec/x86/fft_mmx.asm', + ], + 'rules': [ + { + 'conditions': [ + ['target_arch=="ia32"', { + 'variables': { + 'yasm_flags': [ + '-DARCH_X86_32', + '-m', 'x86', + ], + }, + },], + ['target_arch=="x64"', { + 'variables': { + 'yasm_flags': [ + '-DARCH_X86_64', + '-m', 'amd64', + '-DPIC', + ], + }, + },], + ], + 'rule_name': 'assemble', + 'extension': 'asm', + 'inputs': [ '<(PRODUCT_DIR)/yasm', ], + 'outputs': [ + '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o', + ], + 'action': [ + '<(PRODUCT_DIR)/yasm', + '-f', 'elf', + '<@(yasm_flags)', + '-I', 'source/patched-ffmpeg-mt/libavcodec/x86/', + '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o', + '<(RULE_INPUT_PATH)', + ], + 'process_outputs_as_sources': 0, + 'message': 'Build ffmpeg yasm build <(RULE_INPUT_PATH).', + }, + ], + }, + { + 'target_name': 'make_ffmpeg_asm_lib', + 'type': 'none', + 'dependencies': [ + 'assemble_ffmpeg_asm', + ], + 'sources': [ + ], + 'actions': [ + { + 'action_name': 'make_library', + 'variables': { + # Make sure this stays in sync with the corresponding sources + # in assemble_ffmpeg_asm. + 'asm_objects': [ + '<(shared_generated_dir)/dsputil_yasm.o', + '<(shared_generated_dir)/fft_mmx.o', + ], + 'library_path': '<(shared_generated_dir)/lib<(asm_library)<(STATIC_LIB_SUFFIX)', + }, + 'inputs': [ '<@(asm_objects)', ], + 'outputs': [ '<(library_path)', ], + 'action': [ 'ar', 'rcs', '<(library_path)', '<@(asm_objects)', ], + 'process_outputs_as_sources': 0, + 'message': 'Packate ffmpeg assembly into <(library_path).', + }, + ], + }, + { + # A target shim that allows putting a dependency on ffmpegsumo + # without pulling it into the link line. + # + # We use an "executable" taget without any sources to break the + # link line relationship to ffmpegsumo. + # + # Most people will want to depend on this target instead of on + # ffmpegsumo directly since ffmpegsumo is meant to be + # used via dlopen() in chrome. + 'target_name': 'ffmpegsumo_nolink', + 'type': 'executable', + 'sources': [ 'dummy_nolink.cc' ], + 'dependencies': [ + 'ffmpegsumo', + ], + 'conditions': [ + ['OS=="linux" or OS=="freebsd"', { + 'copies': [ + { + # On Make and Scons builds, the library does not end up in + # the PRODUCT_DIR. + # + # http://code.google.com/p/gyp/issues/detail?id=57 + # + # TODO(ajwong): Fix gyp, fix the world. + 'destination': '<(PRODUCT_DIR)', + 'files': ['<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)ffmpegsumo<(SHARED_LIB_SUFFIX)'], + }, + ], + }], + ], + }, + ], + }], + ], 'targets': [ { 'variables': { @@ -34,33 +378,38 @@ 'target_name': 'ffmpeg', 'msvs_guid': 'D7A94F58-576A-45D9-A45F-EB87C63ABBB0', 'dependencies': [ + '<(target_for_binaries)', 'ffmpeg_binaries', ], 'sources': [ - 'include/libavcodec/avcodec.h', - 'include/libavcodec/opt.h', - 'include/libavcodec/vdpau.h', - 'include/libavcodec/xvmc.h', - 'include/libavformat/avformat.h', - 'include/libavformat/avio.h', - 'include/libavutil/adler32.h', - 'include/libavutil/avstring.h', - 'include/libavutil/avutil.h', - 'include/libavutil/base64.h', - 'include/libavutil/common.h', - 'include/libavutil/crc.h', - 'include/libavutil/fifo.h', - 'include/libavutil/intfloat_readwrite.h', - 'include/libavutil/log.h', - 'include/libavutil/lzo.h', - 'include/libavutil/mathematics.h', - 'include/libavutil/md5.h', - 'include/libavutil/mem.h', - 'include/libavutil/pixfmt.h', - 'include/libavutil/rational.h', - 'include/libavutil/sha1.h', + '<(ffmpeg_include_root)/libavcodec/avcodec.h', + '<(ffmpeg_include_root)/libavcodec/opt.h', + '<(ffmpeg_include_root)/libavcodec/vdpau.h', + '<(ffmpeg_include_root)/libavcodec/xvmc.h', + '<(ffmpeg_include_root)/libavformat/avformat.h', + '<(ffmpeg_include_root)/libavformat/avio.h', + '<(ffmpeg_include_root)/libavutil/adler32.h', + '<(ffmpeg_include_root)/libavutil/avstring.h', + '<(ffmpeg_include_root)/libavutil/avutil.h', + '<(ffmpeg_include_root)/libavutil/base64.h', + '<(ffmpeg_include_root)/libavutil/common.h', + '<(ffmpeg_include_root)/libavutil/crc.h', + '<(ffmpeg_include_root)/libavutil/fifo.h', + '<(ffmpeg_include_root)/libavutil/intfloat_readwrite.h', + '<(ffmpeg_include_root)/libavutil/log.h', + '<(ffmpeg_include_root)/libavutil/lzo.h', + '<(ffmpeg_include_root)/libavutil/mathematics.h', + '<(ffmpeg_include_root)/libavutil/md5.h', + '<(ffmpeg_include_root)/libavutil/mem.h', + '<(ffmpeg_include_root)/libavutil/pixfmt.h', + '<(ffmpeg_include_root)/libavutil/rational.h', + '<(ffmpeg_include_root)/libavutil/sha1.h', + + # Hacks to introduce C99 types into Visual Studio. 'include/win/inttypes.h', 'include/win/stdint.h', + + # Files needed for stub generation rules. '<@(sig_files)', '<(extra_header)' ], @@ -168,8 +517,8 @@ '-p', '<(project_path)', '<@(_inputs)', ], - 'message': 'Generating FFmpeg stubs for dynamic loading.', 'process_outputs_as_sources': 1, + 'message': 'Generating FFmpeg stubs for dynamic loading.', }, ], }, @@ -208,22 +557,12 @@ }, 'dependencies': ['../../build/win/system.gyp:cygwin'], }], ['OS=="linux" or OS=="freebsd"', { - 'conditions': [ - ['use_system_ffmpeg==0', { - 'variables': { - 'source_files': [ - 'binaries/<(ffmpeg_bin_dir)/libavcodec.so.52', - 'binaries/<(ffmpeg_bin_dir)/libavformat.so.52', - 'binaries/<(ffmpeg_bin_dir)/libavutil.so.50', - ], - }, - }, { 'variables': { - 'source_files': [] + # TODO(ajwong): Clean this up after we've finished + # migrating to in-tree build. + 'source_files': [], }, - }], - ]}, - ], ['OS=="mac"', { + }], ['OS=="mac"', { # TODO(ajwong): These files are also copied in: # webkit/tools/test_shell/test_shell.gyp and # chrome/chrome.gyp |