Skip to content
Snippets Groups Projects
Commit 995925ba authored by ajwong@chromium.org's avatar ajwong@chromium.org
Browse files

FFmpeg in-tree build for mac.

BUG=26509
TEST=none

Review URL: http://codereview.chromium.org/340072

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31050 0039d316-1c4b-4281-b951-d872f2087c98
parent 92f181bd
No related merge requests found
Showing
with 5716 additions and 96 deletions
......@@ -130,6 +130,13 @@ deps_os = {
"src/third_party/WebKit/WebKitLibraries":
Var("webkit_trunk") + "/WebKitLibraries@" + Var("webkit_revision"),
# TODO(ajwong): Move this into the OS-independent block.
"src/third_party/yasm/source/patched-yasm":
"/trunk/deps/third_party/yasm/patched-yasm@29937",
"src/third_party/ffmpeg/source/patched-ffmpeg-mt":
"/trunk/deps/third_party/ffmpeg/patched-ffmpeg-mt@" +
Var("ffmpeg_revision"),
"src/third_party/ffmpeg/binaries/chromium/mac/ia32":
"/trunk/deps/third_party/ffmpeg/binaries/mac@" + Var("ffmpeg_revision"),
"src/third_party/ffmpeg/binaries/chromium/mac/ia32_dbg":
......@@ -141,9 +148,9 @@ deps_os = {
"src/third_party/xdg-utils":
"/trunk/deps/third_party/xdg-utils@29103",
# TODO(ajwong): Move this into the OS-independent block.
"src/third_party/yasm/source/patched-yasm":
"/trunk/deps/third_party/yasm/patched-yasm@29937",
"src/third_party/ffmpeg/source/patched-ffmpeg-mt":
"/trunk/deps/third_party/ffmpeg/patched-ffmpeg-mt@" +
Var("ffmpeg_revision"),
......
......@@ -54,6 +54,11 @@
'../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*',
],
}],
['OS=="mac" or OS=="linux" or OS=="freebsd"', {
'dependencies': [
'../third_party/yasm/yasm.gyp:*',
],
}],
['OS=="mac"', {
'dependencies': [
'../third_party/ocmock/ocmock.gyp:*',
......@@ -64,7 +69,6 @@
'../breakpad/breakpad.gyp:*',
'../courgette/courgette.gyp:*',
'../sandbox/sandbox.gyp:*',
'../third_party/yasm/yasm.gyp:*',
'../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*',
'../tools/xdisplaycheck/xdisplaycheck.gyp:*',
],
......
......@@ -5877,6 +5877,15 @@
}],
],
},
{
'destination':
'<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
'files': [
# TODO(ajwong): Find a way to share this path with
# ffmpeg.gyp so they don't diverge. (BUG=23602)
'<(PRODUCT_DIR)/libffmpegsumo.dylib',
],
},
],
'conditions': [
['mac_breakpad==1', {
......@@ -5919,32 +5928,6 @@
},
],
}], # mac_keystone
['branding=="Chrome"', {
'copies': [
{
'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
# TODO(ajwong): This, and the parallel chromium stanza
# below really should find a way to share file paths with
# ffmpeg.gyp so they don't diverge. (BUG=23602)
'files': [
'../third_party/ffmpeg/binaries/chrome/mac/ia32/libavcodec.52.dylib',
'../third_party/ffmpeg/binaries/chrome/mac/ia32/libavformat.52.dylib',
'../third_party/ffmpeg/binaries/chrome/mac/ia32/libavutil.50.dylib',
],
},
],
}, { # else: 'branding!="Chrome"
'copies': [
{
'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries',
'files': [
'../third_party/ffmpeg/binaries/chromium/mac/ia32/libavcodec.52.dylib',
'../third_party/ffmpeg/binaries/chromium/mac/ia32/libavformat.52.dylib',
'../third_party/ffmpeg/binaries/chromium/mac/ia32/libavutil.50.dylib',
],
},
],
}], # branding
], # conditions
}], # OS=="mac"
], # conditions
......
......@@ -130,6 +130,8 @@ Detailed Directions:
make libavcodec/libavcodec.so libavformat/libavformat.so \
> ffmpeg_build_log 2> ffmpeg_build_err
For Mac, replace the ".so" in the files above with ".dylib".
5) Check ffmpeg_build_err to see if there are any significant
anomalies. FFmpeg source generates a lot of compiler warnings; it
is safe to ignore those.
......
......@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TODO(ajwong): Determine if we want to statically link libz.
{
'target_defaults': {
'conditions': [
......@@ -38,7 +40,7 @@
#
# 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") or use_system_ffmpeg!=0', {
['(OS!="linux" and OS!="freebsd" and OS!="mac") or use_system_ffmpeg!=0', {
'variables': {
'target_for_binaries': 'ffmpeg_binaries',
'ffmpeg_include_root': 'include',
......@@ -51,6 +53,7 @@
'targets': [
{
'target_name': 'ffmpegsumo',
'product_name': 'libffmpegsumo',
'type': 'shared_library',
'dependencies': [
'make_ffmpeg_asm_lib',
......@@ -149,42 +152,14 @@
'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',
'defines': [
'HAVE_AV_CONFIG_H',
'_POSIX_C_SOURCE=200112',
],
'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',
'cflags': [
'-fomit-frame-pointer',
],
'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
......@@ -212,7 +187,87 @@
'source/patched-ffmpeg-mt/libavformat/mov.c',
'source/patched-ffmpeg-mt/libavformat/mp3.c',
],
}],
}], # ffmpeg_branding
['target_arch=="x64"', {
# 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.
'defines': [
'PIC',
],
'cflags': [
'-fPIC',
],
}], # target_arch
['OS=="linux" or OS=="freebsd"', {
'defines': [
'_ISOC99_SOURCE',
'_LARGEFILE_SOURCE',
],
'cflags': [
'-std=c99',
'-pthread',
'-fno-math-errno',
],
'cflags!': [
# Ensure the symbols are exported.
#
# TODO(ajwong): Fix common.gypi to only add this flag for
# _type != shared_library.
'-fvisibility=hidden',
],
'link_settings': {
'ldflags': [
'-Wl,-Bsymbolic',
'-L<(shared_generated_dir)',
],
'libraries': [
# TODO(ajwong): When scons is dead, collapse this with the
# absolute path entry inside the OS="mac" conditional, and
# move it out of the conditionals block altogether.
'-l<(asm_library)',
'-lz',
],
},
}], # OS=="linux" or OS=="freebsd"
['OS=="mac"', {
'libraries': [
# TODO(ajwong): Move into link_settings when this is fixed:
#
# http://code.google.com/p/gyp/issues/detail?id=108
'<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STATIC_LIB_SUFFIX)',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/usr/lib/libz.dylib',
],
},
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # No -fvisibility=hidden
'GCC_DYNAMIC_NO_PIC': 'YES', # -mdynamic-no-pic
# (equiv -fno-PIC)
'DYLIB_INSTALL_NAME_BASE': '@loader_path',
'LIBRARY_SEARCH_PATHS': [
'<(shared_generated_dir)'
],
'OTHER_LDFLAGS': [
# This is needed because FFmpeg cannot be built as PIC, and
# thus we need to instruct the linker to allow relocations
# for read-only segments for this target to be able to
# generated the shared library on Mac.
#
# This makes Mark sad, but he's okay with it since it is
# isolated to this module. When Mark finds this in the
# future, and has forgotten this conversation, this comment
# should remind him that the world is still nice and
# butterflies still exist...as do rainbows, sunshine,
# tulips, etc., etc...but not kittens. Those went away
# with this flag.
'-Wl,-read_only_relocs,suppress'
],
},
}], # OS=="mac"
],
'actions': [
{
......@@ -248,23 +303,54 @@
'rules': [
{
'conditions': [
['target_arch=="ia32"', {
['OS=="linux" or OS=="freebsd"', {
'variables': {
'yasm_flags': [
'-DARCH_X86_32',
'-m', 'x86',
],
'obj_format': 'elf',
},
},],
['target_arch=="x64"', {
'conditions': [
['target_arch=="ia32"', {
'variables': {
'yasm_flags': [
'-DARCH_X86_32',
'-m', 'x86',
],
},
}],
['target_arch=="x64"', {
'variables': {
'yasm_flags': [
'-DARCH_X86_64',
'-m', 'amd64',
'-DPIC',
],
},
}],
],
}], ['OS=="mac"', {
'variables': {
'yasm_flags': [
'-DARCH_X86_64',
'-m', 'amd64',
'-DPIC',
],
'obj_format': 'macho',
'yasm_flags': [ '-DPREFIX', ],
},
},],
'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',
......@@ -274,7 +360,7 @@
],
'action': [
'<(PRODUCT_DIR)/yasm',
'-f', 'elf',
'-f', '<(obj_format)',
'<@(yasm_flags)',
'-I', 'source/patched-ffmpeg-mt/libavcodec/x86/',
'-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o',
......@@ -303,7 +389,7 @@
'<(shared_generated_dir)/dsputil_yasm.o',
'<(shared_generated_dir)/fft_mmx.o',
],
'library_path': '<(shared_generated_dir)/lib<(asm_library)<(STATIC_LIB_SUFFIX)',
'library_path': '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STATIC_LIB_SUFFIX)',
},
'inputs': [ '<@(asm_objects)', ],
'outputs': [ '<(library_path)', ],
......@@ -549,9 +635,6 @@
# Need to consolidate the copies in one place. (BUG=23602)
'variables': {
'source_files': [
'binaries/<(ffmpeg_bin_dir)/libavcodec.52.dylib',
'binaries/<(ffmpeg_bin_dir)/libavformat.52.dylib',
'binaries/<(ffmpeg_bin_dir)/libavutil.50.dylib',
],
},
}],
......
This diff is collapsed.
#define FFMPEG_VERSION "SVN-r28636"
This diff is collapsed.
#define FFMPEG_VERSION "SVN-r28636"
See also the yasm.gyp file for a description of the yasm build process.
Instructions for recreating the yasm.gyp file.
1) Get a clean version of the yasm source tree and copy it somewhere. The
clean tree can be found at:
1) Get a clean version of the yasm source tree. The clean tree can be found
at:
src/third_party/yasm/source/yasm
2) Run ./autogen.sh in your copy of the pristine source. Unlike ./configure,
autogen.sh will dirty the tree regardless of where it is called from.
2) Run configure on the pristine source from a different directory (eg.,
/tmp/yasm_build). Running configure from another directory will keep
the source tree clean.
3) Next, capture all the output from a build of yasm. We will use the build
log as a reference for making the yasm.gyp file.
......
This diff is collapsed.
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Command name to run C preprocessor */
#define CPP_PROG "gcc -E"
/* */
/* #undef ENABLE_NLS */
/* Define to 1 if you have the `abort' function. */
#define HAVE_ABORT 1
/* */
/* #undef HAVE_CATGETS */
/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#define HAVE_CFLOCALECOPYCURRENT 1
/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
#define HAVE_CFPREFERENCESCOPYAPPVALUE 1
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
/* #undef HAVE_DCGETTEXT */
/* Define to 1 if you have the <direct.h> header file. */
/* #undef HAVE_DIRECT_H */
/* Define to 1 if you have the `ftruncate' function. */
#define HAVE_FTRUNCATE 1
/* Define to 1 if you have the `getcwd' function. */
#define HAVE_GETCWD 1
/* */
/* #undef HAVE_GETTEXT */
/* Define to 1 if you have the GNU C Library */
/* #undef HAVE_GNU_C_LIBRARY */
/* Define if you have the iconv() function. */
#define HAVE_ICONV 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* */
/* #undef HAVE_LC_MESSAGES */
/* Define to 1 if you have the <libgen.h> header file. */
#define HAVE_LIBGEN_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `mergesort' function. */
#define HAVE_MERGESORT 1
/* Define to 1 if you have the `popen' function. */
#define HAVE_POPEN 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* */
/* #undef HAVE_STPCPY */
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strcmpi' function. */
/* #undef HAVE_STRCMPI */
/* Define to 1 if you have the `stricmp' function. */
/* #undef HAVE_STRICMP */
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `strsep' function. */
#define HAVE_STRSEP 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the `toascii' function. */
#define HAVE_TOASCII 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the `vsnprintf' function. */
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `_stricmp' function. */
/* #undef HAVE__STRICMP */
/* Name of package */
#define PACKAGE "yasm"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-yasm@tortall.net"
/* Define to build version of this package. */
#define PACKAGE_BUILD "2194"
/* Define to internal version of this package. */
#define PACKAGE_INTVER "0.8.0"
/* Define to the full name of this package. */
#define PACKAGE_NAME "yasm"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "yasm 0.8.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "yasm"
/* Define to the version of this package. */
#define PACKAGE_VERSION "0.8.0"
/* Define to 1 if the C compiler supports function prototypes. */
#define PROTOTYPES 1
/* The size of `char', as computed by sizeof. */
/* #undef SIZEOF_CHAR */
/* The size of `int', as computed by sizeof. */
/* #undef SIZEOF_INT */
/* The size of `long', as computed by sizeof. */
/* #undef SIZEOF_LONG */
/* The size of `short', as computed by sizeof. */
/* #undef SIZEOF_SHORT */
/* The size of `void*', as computed by sizeof. */
/* #undef SIZEOF_VOIDP */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "0.8.0"
/* Define if using the dmalloc debugging malloc package */
/* #undef WITH_DMALLOC */
/* Define like PROTOTYPES; this can be used by system headers. */
#define __PROTOTYPES 1
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
#ifndef _YASM_LIBYASM_STDINT_H
#define _YASM_LIBYASM_STDINT_H 1
#ifndef _GENERATED_STDINT_H
#define _GENERATED_STDINT_H "yasm 0.8.0"
/* generated using gcc -std=gnu99 */
#define _STDINT_HAVE_STDINT_H 1
#include <stdint.h>
#endif
#endif
......@@ -32,7 +32,7 @@
{
'variables': {
'yasm_include_dirs': [
'source/config/linux',
'source/config/<(OS)',
'source/patched-yasm',
],
......@@ -41,8 +41,8 @@
# 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_c_flags': [
'-DHAVE_CONFIG_H',
'yasm_defines': ['HAVE_CONFIG_H'],
'yasm_cflags': [
'-std=gnu99',
'-ansi',
'-pedantic',
......@@ -61,6 +61,7 @@
'target_name': 'yasm',
'type': 'executable',
'dependencies': [
'config_sources',
'genmacro',
'genmodule',
'genperf',
......@@ -153,9 +154,8 @@
'<(shared_generated_dir)',
'<(generated_dir)',
],
'cflags': [
'<@(yasm_c_flags)',
],
'defines': [ '<@(yasm_defines)' ],
'cflags': [ '<@(yasm_cflags)', ],
'rules': [
{
'rule_name': 'generate_gperf',
......@@ -313,7 +313,7 @@
{
'action_name': 'generate_module',
'variables': {
'makefile': 'source/config/linux/Makefile',
'makefile': 'source/config/<(OS)/Makefile',
'module_in': 'source/patched-yasm/libyasm/module.in',
'outfile': '<(generated_dir)/module.c',
},
......@@ -416,8 +416,9 @@
'include_dirs': [
'<@(yasm_include_dirs)',
],
'defines': [ '<@(yasm_defines)' ],
'cflags': [
'<(yasm_c_flags)',
'<@(yasm_cflags)',
],
},
{
......
......@@ -335,9 +335,7 @@
{
'destination': '<(PRODUCT_DIR)/TestShell.app/Contents/MacOS/',
'files': [
'../../../third_party/ffmpeg/binaries/chromium/mac/ia32/libavcodec.52.dylib',
'../../../third_party/ffmpeg/binaries/chromium/mac/ia32/libavformat.52.dylib',
'../../../third_party/ffmpeg/binaries/chromium/mac/ia32/libavutil.50.dylib',
'<(PRODUCT_DIR)/libffmpegsumo.dylib',
],
},
],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment