Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/ffmpeg/ffmpeg.gyp

Issue 340072: FFmpeg in-tree build for mac. (Closed)
Patch Set: work around link-settings bug. Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # TODO(ajwong): Determine if we want to statically link libz.
6
5 { 7 {
6 'target_defaults': { 8 'target_defaults': {
7 'conditions': [ 9 'conditions': [
8 ['OS!="linux" and OS!="freebsd"', {'sources/': [['exclude', '/linux/']]}], 10 ['OS!="linux" and OS!="freebsd"', {'sources/': [['exclude', '/linux/']]}],
9 ['OS!="mac"', {'sources/': [['exclude', '/mac/']]}], 11 ['OS!="mac"', {'sources/': [['exclude', '/mac/']]}],
10 ['OS!="win"', {'sources/': [['exclude', '/win/']]}], 12 ['OS!="win"', {'sources/': [['exclude', '/win/']]}],
11 ], 13 ],
12 'variables': { 14 'variables': {
13 # Since we are not often debugging FFmpeg, and performance is 15 # Since we are not often debugging FFmpeg, and performance is
14 # unacceptable without optimization, freeze the optimizations to -O2. 16 # unacceptable without optimization, freeze the optimizations to -O2.
(...skipping 16 matching lines...) Expand all
31 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/ffmpeg', 33 'shared_generated_dir': '<(SHARED_INTERMEDIATE_DIR)/third_party/ffmpeg',
32 'asm_library': 'ffmpegasm', 34 'asm_library': 'ffmpegasm',
33 }, 35 },
34 'conditions': [ 36 'conditions': [
35 # This condition is for migrating from pre-built binaries to an in-tree 37 # This condition is for migrating from pre-built binaries to an in-tree
36 # source build. Most of these should be removed once FFmpeg is built on 38 # source build. Most of these should be removed once FFmpeg is built on
37 # mac and linux. Windows will take more work. 39 # mac and linux. Windows will take more work.
38 # 40 #
39 # TODO(ajwong): Per the comment above, reduce this conditional's size and 41 # TODO(ajwong): Per the comment above, reduce this conditional's size and
40 # determine if in-tree build in Windows is tractable. 42 # determine if in-tree build in Windows is tractable.
41 ['(OS!="linux" and OS!="freebsd") or use_system_ffmpeg!=0', { 43 ['(OS!="linux" and OS!="freebsd" and OS!="mac") or use_system_ffmpeg!=0', {
42 'variables': { 44 'variables': {
43 'target_for_binaries': 'ffmpeg_binaries', 45 'target_for_binaries': 'ffmpeg_binaries',
44 'ffmpeg_include_root': 'include', 46 'ffmpeg_include_root': 'include',
45 }, 47 },
46 },{ # else OS=="linux" 48 },{ # else OS=="linux"
47 'variables': { 49 'variables': {
48 'target_for_binaries': 'ffmpegsumo_nolink', 50 'target_for_binaries': 'ffmpegsumo_nolink',
49 'ffmpeg_include_root': 'source/patched-ffmpeg-mt', 51 'ffmpeg_include_root': 'source/patched-ffmpeg-mt',
50 }, 52 },
51 'targets': [ 53 'targets': [
52 { 54 {
53 'target_name': 'ffmpegsumo', 55 'target_name': 'ffmpegsumo',
56 'product_name': 'libffmpegsumo',
54 'type': 'shared_library', 57 'type': 'shared_library',
55 'dependencies': [ 58 'dependencies': [
56 'make_ffmpeg_asm_lib', 59 'make_ffmpeg_asm_lib',
57 ], 60 ],
58 'sources': [ 61 'sources': [
59 'source/patched-ffmpeg-mt/libavcodec/aac.c', 62 'source/patched-ffmpeg-mt/libavcodec/aac.c',
60 'source/patched-ffmpeg-mt/libavcodec/aac_ac3_parser.c', 63 'source/patched-ffmpeg-mt/libavcodec/aac_ac3_parser.c',
61 'source/patched-ffmpeg-mt/libavcodec/aac_parser.c', 64 'source/patched-ffmpeg-mt/libavcodec/aac_parser.c',
62 'source/patched-ffmpeg-mt/libavcodec/aactab.c', 65 'source/patched-ffmpeg-mt/libavcodec/aactab.c',
63 'source/patched-ffmpeg-mt/libavcodec/allcodecs.c', 66 'source/patched-ffmpeg-mt/libavcodec/allcodecs.c',
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 'source/patched-ffmpeg-mt/libavutil/mem.c', 145 'source/patched-ffmpeg-mt/libavutil/mem.c',
143 'source/patched-ffmpeg-mt/libavutil/rational.c', 146 'source/patched-ffmpeg-mt/libavutil/rational.c',
144 147
145 # Config file for the OS and architecture. 148 # Config file for the OS and architecture.
146 'source/config/<(ffmpeg_branding)/<(OS)/<(target_arch)/config.h', 149 'source/config/<(ffmpeg_branding)/<(OS)/<(target_arch)/config.h',
147 ], 150 ],
148 'include_dirs': [ 151 'include_dirs': [
149 'source/config/<(ffmpeg_branding)/<(OS)/<(target_arch)', 152 'source/config/<(ffmpeg_branding)/<(OS)/<(target_arch)',
150 'source/patched-ffmpeg-mt', 153 'source/patched-ffmpeg-mt',
151 ], 154 ],
155 'defines': [
156 'HAVE_AV_CONFIG_H',
157 '_POSIX_C_SOURCE=200112',
158 ],
152 'cflags': [ 159 'cflags': [
153 '-DHAVE_AV_CONFIG_H', 160 '-fomit-frame-pointer',
154 '-D_ISOC99_SOURCE',
155 '-D_POSIX_C_SOURCE=200112',
156 '-std=c99',
157 '-D_LARGEFILE_SOURCE',
158 '-pthread',
159 '-fno-math-errno',
160 '-fomit-frame-pointer'
161 ],
162 'cflags!': [
163 # Ensure the symbols are exported.
164 '-fvisibility=hidden',
165 ],
166 'ldflags': [
167 '-Wl,-Bsymbolic',
168 '-L<(shared_generated_dir)',
169 ],
170 'libraries': [
171 '-l<(asm_library)',
172 '-lm',
173
174 # TODO(ajwong): Statically link these once we resolve the
175 # PIC/non-PIC issues on x64.
176 '-lz',
177 ], 161 ],
178 'conditions': [ 162 'conditions': [
179 ['target_arch=="x64"', {
180 'cflags': [
181 # x64 requires PIC for shared libraries. This is opposite
182 # of ia32 where due to a slew of inline assembly using ebx,
183 # FFmpeg CANNOT be built with PIC.
184 '-fPIC',
185 '-DPIC',
186 ],
187 }],
188 ['ffmpeg_branding!="Chrome"', { 163 ['ffmpeg_branding!="Chrome"', {
189 'sources!': [ 164 'sources!': [
190 # Exclude files that should only be used if doing a branded 165 # Exclude files that should only be used if doing a branded
191 # Google Chrome build. 166 # Google Chrome build.
192 'source/patched-ffmpeg-mt/libavcodec/aac.c', 167 'source/patched-ffmpeg-mt/libavcodec/aac.c',
193 'source/patched-ffmpeg-mt/libavcodec/aac_ac3_parser.c', 168 'source/patched-ffmpeg-mt/libavcodec/aac_ac3_parser.c',
194 'source/patched-ffmpeg-mt/libavcodec/aac_parser.c', 169 'source/patched-ffmpeg-mt/libavcodec/aac_parser.c',
195 'source/patched-ffmpeg-mt/libavcodec/aactab.c', 170 'source/patched-ffmpeg-mt/libavcodec/aactab.c',
196 'source/patched-ffmpeg-mt/libavcodec/cabac.c', 171 'source/patched-ffmpeg-mt/libavcodec/cabac.c',
197 'source/patched-ffmpeg-mt/libavcodec/error_resilience.c', 172 'source/patched-ffmpeg-mt/libavcodec/error_resilience.c',
198 'source/patched-ffmpeg-mt/libavcodec/golomb.c', 173 'source/patched-ffmpeg-mt/libavcodec/golomb.c',
199 'source/patched-ffmpeg-mt/libavcodec/h264.c', 174 'source/patched-ffmpeg-mt/libavcodec/h264.c',
200 'source/patched-ffmpeg-mt/libavcodec/h264_parser.c', 175 'source/patched-ffmpeg-mt/libavcodec/h264_parser.c',
201 'source/patched-ffmpeg-mt/libavcodec/h264idct.c', 176 'source/patched-ffmpeg-mt/libavcodec/h264idct.c',
202 'source/patched-ffmpeg-mt/libavcodec/h264pred.c', 177 'source/patched-ffmpeg-mt/libavcodec/h264pred.c',
203 'source/patched-ffmpeg-mt/libavcodec/mpeg4audio.c', 178 'source/patched-ffmpeg-mt/libavcodec/mpeg4audio.c',
204 'source/patched-ffmpeg-mt/libavcodec/mpegaudio.c', 179 'source/patched-ffmpeg-mt/libavcodec/mpegaudio.c',
205 'source/patched-ffmpeg-mt/libavcodec/mpegaudio_parser.c', 180 'source/patched-ffmpeg-mt/libavcodec/mpegaudio_parser.c',
206 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodata.c', 181 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodata.c',
207 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodec.c', 182 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodec.c',
208 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodecheader.c', 183 'source/patched-ffmpeg-mt/libavcodec/mpegaudiodecheader.c',
209 'source/patched-ffmpeg-mt/libavcodec/mpegvideo.c', 184 'source/patched-ffmpeg-mt/libavcodec/mpegvideo.c',
210 'source/patched-ffmpeg-mt/libavformat/id3v2.c', 185 'source/patched-ffmpeg-mt/libavformat/id3v2.c',
211 'source/patched-ffmpeg-mt/libavformat/isom.c', 186 'source/patched-ffmpeg-mt/libavformat/isom.c',
212 'source/patched-ffmpeg-mt/libavformat/mov.c', 187 'source/patched-ffmpeg-mt/libavformat/mov.c',
213 'source/patched-ffmpeg-mt/libavformat/mp3.c', 188 'source/patched-ffmpeg-mt/libavformat/mp3.c',
214 ], 189 ],
215 }], 190 }], # ffmpeg_branding
191 ['target_arch=="x64"', {
192 # x64 requires PIC for shared libraries. This is opposite
193 # of ia32 where due to a slew of inline assembly using ebx,
194 # FFmpeg CANNOT be built with PIC.
195 'defines': [
196 'PIC',
197 ],
198 'cflags': [
199 '-fPIC',
200 ],
201 }], # target_arch
202 ['OS=="linux" or OS=="freebsd"', {
203 'defines': [
204 '_ISOC99_SOURCE',
205 '_LARGEFILE_SOURCE',
206 ],
207 'cflags': [
208 '-std=c99',
209 '-pthread',
210 '-fno-math-errno',
211 ],
212 'cflags!': [
213 # Ensure the symbols are exported.
214 #
215 # TODO(ajwong): Fix common.gypi to only add this flag for
216 # _type != shared_library.
217 '-fvisibility=hidden',
218 ],
219 'link_settings': {
220 'ldflags': [
221 '-Wl,-Bsymbolic',
222 '-L<(shared_generated_dir)',
223 ],
224 'libraries': [
225 # TODO(ajwong): When scons is dead, collapse this with the
226 # absolute path entry inside the OS="mac" conditional, and
227 # move it out of the conditionals block altogether.
228 '-l<(asm_library)',
229
230 '-lz',
231 ],
232 },
233 }], # OS=="linux" or OS=="freebsd"
234 ['OS=="mac"', {
235 'libraries': [
236 # TODO(ajwong): Move into link_settings when this is fixed:
237 #
238 # http://code.google.com/p/gyp/issues/detail?id=108
239 '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STA TIC_LIB_SUFFIX)',
240 ],
241 'link_settings': {
242 'libraries': [
243 '$(SDKROOT)/usr/lib/libz.dylib',
244 ],
245 },
246 'xcode_settings': {
247 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # No -fvisibility=hidden
248 'GCC_DYNAMIC_NO_PIC': 'YES', # -mdynamic-no-pic
249 # (equiv -fno-PIC)
250 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
251 'LIBRARY_SEARCH_PATHS': [
252 '<(shared_generated_dir)'
253 ],
254 'OTHER_LDFLAGS': [
255 # This is needed because FFmpeg cannot be built as PIC, and
256 # thus we need to instruct the linker to allow relocations
257 # for read-only segments for this target to be able to
258 # generated the shared library on Mac.
259 #
260 # This makes Mark sad, but he's okay with it since it is
261 # isolated to this module. When Mark finds this in the
262 # future, and has forgotten this conversation, this comment
263 # should remind him that the world is still nice and
264 # butterflies still exist...as do rainbows, sunshine,
265 # tulips, etc., etc...but not kittens. Those went away
266 # with this flag.
267 '-Wl,-read_only_relocs,suppress'
268 ],
269 },
270 }], # OS=="mac"
216 ], 271 ],
217 'actions': [ 272 'actions': [
218 { 273 {
219 # Needed to serialize the output of make_ffmpeg_asm_lib with 274 # Needed to serialize the output of make_ffmpeg_asm_lib with
220 # this target being built. 275 # this target being built.
221 'action_name': 'ffmpegasm_barrier', 276 'action_name': 'ffmpegasm_barrier',
222 'inputs': [ 277 'inputs': [
223 '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STA TIC_LIB_SUFFIX)', 278 '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(asm_library)<(STA TIC_LIB_SUFFIX)',
224 ], 279 ],
225 'outputs': [ 280 'outputs': [
(...skipping 15 matching lines...) Expand all
241 '../yasm/yasm.gyp:yasm', 296 '../yasm/yasm.gyp:yasm',
242 ], 297 ],
243 'sources': [ 298 'sources': [
244 # The FFmpeg yasm files. 299 # The FFmpeg yasm files.
245 'source/patched-ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm', 300 'source/patched-ffmpeg-mt/libavcodec/x86/dsputil_yasm.asm',
246 'source/patched-ffmpeg-mt/libavcodec/x86/fft_mmx.asm', 301 'source/patched-ffmpeg-mt/libavcodec/x86/fft_mmx.asm',
247 ], 302 ],
248 'rules': [ 303 'rules': [
249 { 304 {
250 'conditions': [ 305 'conditions': [
251 ['target_arch=="ia32"', { 306 ['OS=="linux" or OS=="freebsd"', {
252 'variables': { 307 'variables': {
253 'yasm_flags': [ 308 'obj_format': 'elf',
254 '-DARCH_X86_32',
255 '-m', 'x86',
256 ],
257 }, 309 },
258 },], 310 'conditions': [
259 ['target_arch=="x64"', { 311 ['target_arch=="ia32"', {
312 'variables': {
313 'yasm_flags': [
314 '-DARCH_X86_32',
315 '-m', 'x86',
316 ],
317 },
318 }],
319 ['target_arch=="x64"', {
320 'variables': {
321 'yasm_flags': [
322 '-DARCH_X86_64',
323 '-m', 'amd64',
324 '-DPIC',
325 ],
326 },
327 }],
328 ],
329 }], ['OS=="mac"', {
260 'variables': { 330 'variables': {
261 'yasm_flags': [ 331 'obj_format': 'macho',
262 '-DARCH_X86_64', 332 'yasm_flags': [ '-DPREFIX', ],
263 '-m', 'amd64',
264 '-DPIC',
265 ],
266 }, 333 },
267 },], 334 'conditions': [
335 ['target_arch=="ia32"', {
336 'variables': {
337 'yasm_flags': [
338 '-DARCH_X86_32',
339 '-m', 'x86',
340 ],
341 },
342 }],
343 ['target_arch=="x64"', {
344 'variables': {
345 'yasm_flags': [
346 '-DARCH_X86_64',
347 '-m', 'amd64',
348 '-DPIC',
349 ],
350 },
351 }],
352 ],
353 }],
268 ], 354 ],
269 'rule_name': 'assemble', 355 'rule_name': 'assemble',
270 'extension': 'asm', 356 'extension': 'asm',
271 'inputs': [ '<(PRODUCT_DIR)/yasm', ], 357 'inputs': [ '<(PRODUCT_DIR)/yasm', ],
272 'outputs': [ 358 'outputs': [
273 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o', 359 '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o',
274 ], 360 ],
275 'action': [ 361 'action': [
276 '<(PRODUCT_DIR)/yasm', 362 '<(PRODUCT_DIR)/yasm',
277 '-f', 'elf', 363 '-f', '<(obj_format)',
278 '<@(yasm_flags)', 364 '<@(yasm_flags)',
279 '-I', 'source/patched-ffmpeg-mt/libavcodec/x86/', 365 '-I', 'source/patched-ffmpeg-mt/libavcodec/x86/',
280 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o', 366 '-o', '<(shared_generated_dir)/<(RULE_INPUT_ROOT).o',
281 '<(RULE_INPUT_PATH)', 367 '<(RULE_INPUT_PATH)',
282 ], 368 ],
283 'process_outputs_as_sources': 0, 369 'process_outputs_as_sources': 0,
284 'message': 'Build ffmpeg yasm build <(RULE_INPUT_PATH).', 370 'message': 'Build ffmpeg yasm build <(RULE_INPUT_PATH).',
285 }, 371 },
286 ], 372 ],
287 }, 373 },
288 { 374 {
289 'target_name': 'make_ffmpeg_asm_lib', 375 'target_name': 'make_ffmpeg_asm_lib',
290 'type': 'none', 376 'type': 'none',
291 'dependencies': [ 377 'dependencies': [
292 'assemble_ffmpeg_asm', 378 'assemble_ffmpeg_asm',
293 ], 379 ],
294 'sources': [ 380 'sources': [
295 ], 381 ],
296 'actions': [ 382 'actions': [
297 { 383 {
298 'action_name': 'make_library', 384 'action_name': 'make_library',
299 'variables': { 385 'variables': {
300 # Make sure this stays in sync with the corresponding sources 386 # Make sure this stays in sync with the corresponding sources
301 # in assemble_ffmpeg_asm. 387 # in assemble_ffmpeg_asm.
302 'asm_objects': [ 388 'asm_objects': [
303 '<(shared_generated_dir)/dsputil_yasm.o', 389 '<(shared_generated_dir)/dsputil_yasm.o',
304 '<(shared_generated_dir)/fft_mmx.o', 390 '<(shared_generated_dir)/fft_mmx.o',
305 ], 391 ],
306 'library_path': '<(shared_generated_dir)/lib<(asm_library)<(STAT IC_LIB_SUFFIX)', 392 'library_path': '<(shared_generated_dir)/<(STATIC_LIB_PREFIX)<(a sm_library)<(STATIC_LIB_SUFFIX)',
307 }, 393 },
308 'inputs': [ '<@(asm_objects)', ], 394 'inputs': [ '<@(asm_objects)', ],
309 'outputs': [ '<(library_path)', ], 395 'outputs': [ '<(library_path)', ],
310 'action': [ 'ar', 'rcs', '<(library_path)', '<@(asm_objects)', ], 396 'action': [ 'ar', 'rcs', '<(library_path)', '<@(asm_objects)', ],
311 'process_outputs_as_sources': 0, 397 'process_outputs_as_sources': 0,
312 'message': 'Packate ffmpeg assembly into <(library_path).', 398 'message': 'Packate ffmpeg assembly into <(library_path).',
313 }, 399 },
314 ], 400 ],
315 }, 401 },
316 { 402 {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 'source_files': [ 628 'source_files': [
543 ], 629 ],
544 }, 630 },
545 }], ['OS=="mac"', { 631 }], ['OS=="mac"', {
546 # TODO(ajwong): These files are also copied in: 632 # TODO(ajwong): These files are also copied in:
547 # webkit/tools/test_shell/test_shell.gyp and 633 # webkit/tools/test_shell/test_shell.gyp and
548 # chrome/chrome.gyp 634 # chrome/chrome.gyp
549 # Need to consolidate the copies in one place. (BUG=23602) 635 # Need to consolidate the copies in one place. (BUG=23602)
550 'variables': { 636 'variables': {
551 'source_files': [ 637 'source_files': [
552 'binaries/<(ffmpeg_bin_dir)/libavcodec.52.dylib',
553 'binaries/<(ffmpeg_bin_dir)/libavformat.52.dylib',
554 'binaries/<(ffmpeg_bin_dir)/libavutil.50.dylib',
555 ], 638 ],
556 }, 639 },
557 }], 640 }],
558 ], 641 ],
559 'copies': [ 642 'copies': [
560 { 643 {
561 'destination': '<(PRODUCT_DIR)/', 644 'destination': '<(PRODUCT_DIR)/',
562 'files': [ 645 'files': [
563 '<@(source_files)', 646 '<@(source_files)',
564 ] 647 ]
565 }, 648 },
566 ], 649 ],
567 }, 650 },
568 ], 651 ],
569 } 652 }
570 653
571 # Local Variables: 654 # Local Variables:
572 # tab-width:2 655 # tab-width:2
573 # indent-tabs-mode:nil 656 # indent-tabs-mode:nil
574 # End: 657 # End:
575 # vim: set expandtab tabstop=2 shiftwidth=2: 658 # vim: set expandtab tabstop=2 shiftwidth=2:
OLDNEW
« no previous file with comments | « third_party/ffmpeg/README.chromium ('k') | third_party/ffmpeg/source/config/Chrome/mac/ia32/config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698