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/picture.c',
89 '../../third_party/dav1d/src/qm.c',
90 '../../third_party/dav1d/src/ref.c',
91 '../../third_party/dav1d/src/refmvs.c',
92 '../../third_party/dav1d/src/scan.c',
93 '../../third_party/dav1d/src/tables.c',
94 '../../third_party/dav1d/src/warpmv.c',
95 '../../third_party/dav1d/src/wedge.c',
99 EXPORTS.dav1d.src += [
100 '../../third_party/dav1d/src/cdf.h',
101 '../../third_party/dav1d/src/cpu.h',
102 '../../third_party/dav1d/src/ctx.h',
103 '../../third_party/dav1d/src/data.h',
104 '../../third_party/dav1d/src/decode.h',
105 '../../third_party/dav1d/src/dequant_tables.h',
106 '../../third_party/dav1d/src/film_grain.h',
107 '../../third_party/dav1d/src/getbits.h',
108 '../../third_party/dav1d/src/intra_edge.h',
109 '../../third_party/dav1d/src/lf_mask.h',
110 '../../third_party/dav1d/src/log.h',
111 '../../third_party/dav1d/src/mem.h',
112 '../../third_party/dav1d/src/msac.h',
113 '../../third_party/dav1d/src/obu.h',
114 '../../third_party/dav1d/src/picture.h',
115 '../../third_party/dav1d/src/qm.h',
116 '../../third_party/dav1d/src/ref.h',
117 '../../third_party/dav1d/src/refmvs.h',
118 '../../third_party/dav1d/src/scan.h',
119 '../../third_party/dav1d/src/tables.h',
120 '../../third_party/dav1d/src/thread.h',
121 '../../third_party/dav1d/src/warpmv.h',
122 '../../third_party/dav1d/src/wedge.h',
125 # common BITDEPTH 8, 16
126 relative_path = '../../third_party/dav1d/src/'
127 bitdepth_basenames = [
132 'ipred_prepare_tmpl.c',
137 'looprestoration_tmpl.c',
145 for f in bitdepth_basenames:
146 file_bd16 = '16bd_%s' % f
147 file_bd8 = '8bd_%s' % f
149 GeneratedFile(file_bd16,
150 script='generate_source.py',
151 entry_point='add_define',
152 inputs=[relative_path + f],
153 flags=['BITDEPTH', '16'])
154 GeneratedFile(file_bd8,
155 script='generate_source.py',
156 entry_point='add_define',
157 inputs=[relative_path + f],
158 flags=['BITDEPTH', '8'])
160 generated_files += [file_bd16, file_bd8]
162 for p in generated_files:
164 SOURCES += ['!%s' % p]
166 EXPORTS.dav1d.src += [
167 '../../third_party/dav1d/src/cdef.h',
168 '../../third_party/dav1d/src/cdef_apply.h',
169 '../../third_party/dav1d/src/fg_apply.h',
170 '../../third_party/dav1d/src/ipred.h',
171 '../../third_party/dav1d/src/ipred_prepare.h',
172 '../../third_party/dav1d/src/itx.h',
173 '../../third_party/dav1d/src/itx_1d.h',
174 '../../third_party/dav1d/src/lf_apply.h',
175 '../../third_party/dav1d/src/loopfilter.h',
176 '../../third_party/dav1d/src/looprestoration.h',
177 '../../third_party/dav1d/src/lr_apply.h',
178 '../../third_party/dav1d/src/mc.h',
179 '../../third_party/dav1d/src/recon.h',
184 '../../third_party/dav1d/include/common/attributes.h',
185 '../../third_party/dav1d/include/common/bitdepth.h',
186 '../../third_party/dav1d/include/common/dump.h',
187 '../../third_party/dav1d/include/common/frame.h',
188 '../../third_party/dav1d/include/common/intops.h',
189 '../../third_party/dav1d/include/common/validate.h',
194 '../../third_party/dav1d/include/dav1d/common.h',
195 '../../third_party/dav1d/include/dav1d/data.h',
196 '../../third_party/dav1d/include/dav1d/dav1d.h',
197 '../../third_party/dav1d/include/dav1d/headers.h',
198 '../../third_party/dav1d/include/dav1d/picture.h',
201 if CONFIG['OS_TARGET'] == 'WINNT':
203 '../../third_party/dav1d/src/win32/thread.c'
206 if CONFIG['CC_TYPE'] == 'gcc':
207 LOCAL_INCLUDES += ['../../third_party/dav1d/include/compat/gcc/']
208 EXPORTS.dav1d += ['../../third_party/dav1d/include/compat/gcc/stdatomic.h']
210 FINAL_LIBRARY = 'gkmedias'
212 # We allow warnings for third-party code that can be updated from upstream.
213 AllowCompilerWarnings()