1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 '/third_party/dav1d/include',
12 '/third_party/dav1d/include/dav1d',
13 '/third_party/dav1d/src',
21 # entrypoint source files
22 entrypoint_source_files = [
23 '../../third_party/dav1d/src/lib.c',
24 '../../third_party/dav1d/src/thread_task.c',
26 SOURCES += [f for f in entrypoint_source_files]
28 # Don't export DAV1D_API symbols from libxul
29 # see: third_party/dav1d/include/dav1d/common.h
30 DEFINES['DAV1D_API'] = ''
32 if CONFIG['MOZ_DAV1D_ASM']:
35 # Store the stack alignment that will be used.
38 # Default stack alignment can be 4 bytes on x86.
39 if CONFIG['CPU_ARCH'] == 'x86':
40 if CONFIG['OS_TARGET'] == 'WINNT':
41 # Allow the default to avoid crashes
44 # Update stack alignment to 16 bytes.
46 if CONFIG['CC_TYPE'] == 'clang':
47 CFLAGS += ['-mstack-alignment=16']
48 for ep in entrypoint_source_files:
49 SOURCES[ep].flags += ['-mstackrealign']
50 elif CONFIG['CC_TYPE'] == 'gcc':
51 CFLAGS += ['-mpreferred-stack-boundary=4']
52 for ep in entrypoint_source_files:
53 SOURCES[ep].flags += ['-mincoming-stack-boundary=2']
54 elif CONFIG['CPU_ARCH'] in ('x86_64', 'aarch64'):
55 # The default stack alignment is 16 bytes.
58 error('Cpu arch %s is not expected' % CONFIG['CPU_ARCH'])
60 # Set the macro here instead of config.h
61 if stack_alignment == 0:
62 error('Stack alignment cannot be zero.')
63 DEFINES['STACK_ALIGNMENT'] = stack_alignment
65 if CONFIG['OS_TARGET'] == 'Linux':
66 # For fuzzing, We only support building on Linux currently.
67 include('/tools/fuzzing/libfuzzer-config.mozbuild')
68 if CONFIG['FUZZING_INTERFACES']:
75 '../../third_party/dav1d/src/cdf.c',
76 '../../third_party/dav1d/src/cpu.c',
77 '../../third_party/dav1d/src/data.c',
78 '../../third_party/dav1d/src/decode.c',
79 '../../third_party/dav1d/src/dequant_tables.c',
80 '../../third_party/dav1d/src/getbits.c',
81 '../../third_party/dav1d/src/intra_edge.c',
82 '../../third_party/dav1d/src/itx_1d.c',
83 '../../third_party/dav1d/src/lf_mask.c',
84 '../../third_party/dav1d/src/log.c',
85 '../../third_party/dav1d/src/mem.c',
86 '../../third_party/dav1d/src/msac.c',
87 '../../third_party/dav1d/src/obu.c',
88 '../../third_party/dav1d/src/pal.c',
89 '../../third_party/dav1d/src/picture.c',
90 '../../third_party/dav1d/src/qm.c',
91 '../../third_party/dav1d/src/ref.c',
92 '../../third_party/dav1d/src/refmvs.c',
93 '../../third_party/dav1d/src/scan.c',
94 '../../third_party/dav1d/src/tables.c',
95 '../../third_party/dav1d/src/warpmv.c',
96 '../../third_party/dav1d/src/wedge.c',
100 EXPORTS.dav1d.src += [
101 '../../third_party/dav1d/src/cdf.h',
102 '../../third_party/dav1d/src/cpu.h',
103 '../../third_party/dav1d/src/ctx.h',
104 '../../third_party/dav1d/src/data.h',
105 '../../third_party/dav1d/src/decode.h',
106 '../../third_party/dav1d/src/dequant_tables.h',
107 '../../third_party/dav1d/src/filmgrain.h',
108 '../../third_party/dav1d/src/getbits.h',
109 '../../third_party/dav1d/src/intra_edge.h',
110 '../../third_party/dav1d/src/lf_mask.h',
111 '../../third_party/dav1d/src/log.h',
112 '../../third_party/dav1d/src/mem.h',
113 '../../third_party/dav1d/src/msac.h',
114 '../../third_party/dav1d/src/obu.h',
115 '../../third_party/dav1d/src/picture.h',
116 '../../third_party/dav1d/src/qm.h',
117 '../../third_party/dav1d/src/ref.h',
118 '../../third_party/dav1d/src/refmvs.h',
119 '../../third_party/dav1d/src/scan.h',
120 '../../third_party/dav1d/src/tables.h',
121 '../../third_party/dav1d/src/thread.h',
122 '../../third_party/dav1d/src/warpmv.h',
123 '../../third_party/dav1d/src/wedge.h',
126 # common BITDEPTH 8, 16
127 # All the files here should be *_tmpl.c, and the should not appear in SOURCES,
128 # since they require BITDEPTH to be defined
129 relative_path = '../../third_party/dav1d/src/'
130 bitdepth_basenames = [
135 'ipred_prepare_tmpl.c',
140 'looprestoration_tmpl.c',
148 for f in bitdepth_basenames:
149 file_bd16 = '16bd_%s' % f
150 file_bd8 = '8bd_%s' % f
152 GeneratedFile(file_bd16,
153 script='generate_source.py',
154 entry_point='add_define',
155 inputs=[relative_path + f],
156 flags=['BITDEPTH', '16'])
157 GeneratedFile(file_bd8,
158 script='generate_source.py',
159 entry_point='add_define',
160 inputs=[relative_path + f],
161 flags=['BITDEPTH', '8'])
163 generated_files += [file_bd16, file_bd8]
165 for p in generated_files:
167 SOURCES += ['!%s' % p]
169 EXPORTS.dav1d.src += [
170 '../../third_party/dav1d/src/cdef.h',
171 '../../third_party/dav1d/src/cdef_apply.h',
172 '../../third_party/dav1d/src/fg_apply.h',
173 '../../third_party/dav1d/src/ipred.h',
174 '../../third_party/dav1d/src/ipred_prepare.h',
175 '../../third_party/dav1d/src/itx.h',
176 '../../third_party/dav1d/src/itx_1d.h',
177 '../../third_party/dav1d/src/lf_apply.h',
178 '../../third_party/dav1d/src/loopfilter.h',
179 '../../third_party/dav1d/src/looprestoration.h',
180 '../../third_party/dav1d/src/lr_apply.h',
181 '../../third_party/dav1d/src/mc.h',
182 '../../third_party/dav1d/src/recon.h',
187 '../../third_party/dav1d/include/common/attributes.h',
188 '../../third_party/dav1d/include/common/bitdepth.h',
189 '../../third_party/dav1d/include/common/dump.h',
190 '../../third_party/dav1d/include/common/frame.h',
191 '../../third_party/dav1d/include/common/intops.h',
192 '../../third_party/dav1d/include/common/validate.h',
197 '../../third_party/dav1d/include/dav1d/common.h',
198 '../../third_party/dav1d/include/dav1d/data.h',
199 '../../third_party/dav1d/include/dav1d/dav1d.h',
200 '../../third_party/dav1d/include/dav1d/headers.h',
201 '../../third_party/dav1d/include/dav1d/picture.h',
204 if CONFIG['OS_TARGET'] == 'WINNT':
206 '../../third_party/dav1d/src/win32/thread.c'
209 if CONFIG['CC_TYPE'] == 'gcc':
210 LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/gcc/']
211 EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/gcc/stdatomic.h']
213 FINAL_LIBRARY = 'gkmedias'
215 # We allow warnings for third-party code that can be updated from upstream.
216 AllowCompilerWarnings()