moz.build (11224B)
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 4 -*- 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/. 6 7 # ASM enabled 8 9 ASFLAGS += [ 10 '-I%s/third_party/dav1d/src/' % TOPSRCDIR, 11 '-DHAVE_AVX512ICL=1', 12 ] 13 14 LOCAL_INCLUDES += [ 15 '/third_party/dav1d/', 16 '/third_party/dav1d/include/', 17 '/third_party/dav1d/src/', 18 ] 19 20 # Don't export DAV1D_API symbols from libxul 21 # see: third_party/dav1d/include/dav1d/common.h 22 DEFINES['DAV1D_API'] = '' 23 24 CFLAGS += [ 25 # find the config.h file. 26 '-I%s/dist/include/dav1d/' % TOPOBJDIR, 27 ] 28 29 # Store the stack alignment that will be used. 30 stack_alignment = 0 31 32 # Attaching config.asm file 33 if CONFIG['TARGET_CPU'] == 'x86': 34 # Default stack alignment can be 4 bytes. 35 if CONFIG['OS_TARGET'] == 'WINNT': 36 stack_alignment = 4 37 ASFLAGS += ['-I%s/media/libdav1d/asm/x86_32/win/' % TOPSRCDIR] 38 else: 39 ASFLAGS += ['-I%s/media/libdav1d/asm/x86_32/' % TOPSRCDIR] 40 stack_alignment = 16 41 # Change stack alignment to 16 bytes. 42 if CONFIG['CC_TYPE'] == 'clang': 43 CFLAGS += ['-mstack-alignment=16'] 44 elif CONFIG['CC_TYPE'] == 'gcc': 45 CFLAGS += ['-mpreferred-stack-boundary=4'] 46 elif CONFIG['TARGET_CPU'] == 'x86_64': 47 # Default stack aligment is 16 bytes. 48 stack_alignment = 16 49 if CONFIG['OS_TARGET'] == 'Darwin': 50 ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/osx/' % TOPSRCDIR] 51 elif CONFIG['OS_TARGET'] == 'WINNT': 52 ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/win/' % TOPSRCDIR] 53 else: 54 # The rest of the platforms are all Linux-like: plain Linux 55 # Android, OpenBSD, NetBSD, FreeBSD, DragonFly, SunOS 56 ASFLAGS += ['-I%s/media/libdav1d/asm/x86_64/linux/' % TOPSRCDIR] 57 elif CONFIG['TARGET_CPU'] == 'arm': 58 stack_alignment = 4 59 ASFLAGS += ['-I%s/dist/include/dav1d/' % TOPOBJDIR] 60 elif CONFIG['TARGET_CPU'] == 'aarch64': 61 stack_alignment = 16 62 ASFLAGS += ['-I%s/dist/include/dav1d/' % TOPOBJDIR] 63 else: 64 error('Cpu arch %s is not expected' % CONFIG['TARGET_CPU']) 65 66 # Set the macro here instead of config.h 67 if stack_alignment == 0: 68 error('Stack alignment cannot be zero.') 69 DEFINES['STACK_ALIGNMENT'] = stack_alignment 70 71 if CONFIG['TARGET_CPU'] in ('x86', 'x86_64'): 72 ASFLAGS += ['-Dprivate_prefix=dav1d'] 73 74 SOURCES += [ 75 '../../../third_party/dav1d/src/x86/cpu.c', 76 ] 77 78 EXPORTS.dav1d += [ 79 '../../../third_party/dav1d/src/x86/cpu.h', 80 '../../../third_party/dav1d/src/x86/msac.h', 81 ] 82 83 # ASM source files 84 if CONFIG['TARGET_CPU'] == 'x86_64': 85 # Empty file on all other archs. Nasm produces 86 # an error when it compiles empty files. 87 SOURCES += [ 88 '../../../third_party/dav1d/src/x86/cdef16_avx2.asm', # moved from autovendored 89 '../../../third_party/dav1d/src/x86/cdef16_avx512.asm', 90 '../../../third_party/dav1d/src/x86/cdef_avx2.asm', 91 '../../../third_party/dav1d/src/x86/cdef_avx512.asm', 92 '../../../third_party/dav1d/src/x86/filmgrain16_avx2.asm', 93 '../../../third_party/dav1d/src/x86/filmgrain16_avx512.asm', 94 '../../../third_party/dav1d/src/x86/filmgrain_avx2.asm', 95 '../../../third_party/dav1d/src/x86/filmgrain_avx512.asm', 96 # '../../../third_party/dav1d/src/x86/filmgrain_common.asm', 97 # ^ filmgrain_common.asm must *not* be in SOURCES because it's only 98 # used as an %include for other .asm files. Trying to assemble it 99 # will result in a nasm error: parser: instruction expected 100 '../../../third_party/dav1d/src/x86/ipred16_avx512.asm', 101 '../../../third_party/dav1d/src/x86/ipred_avx2.asm', 102 '../../../third_party/dav1d/src/x86/ipred_avx512.asm', 103 '../../../third_party/dav1d/src/x86/itx16_avx2.asm', 104 '../../../third_party/dav1d/src/x86/itx16_avx512.asm', 105 '../../../third_party/dav1d/src/x86/itx_avx2.asm', 106 '../../../third_party/dav1d/src/x86/itx_avx512.asm', 107 '../../../third_party/dav1d/src/x86/loopfilter16_avx2.asm', 108 '../../../third_party/dav1d/src/x86/loopfilter16_avx512.asm', 109 '../../../third_party/dav1d/src/x86/loopfilter_avx2.asm', 110 '../../../third_party/dav1d/src/x86/loopfilter_avx512.asm', 111 '../../../third_party/dav1d/src/x86/looprestoration16_avx2.asm', 112 '../../../third_party/dav1d/src/x86/looprestoration16_avx512.asm', 113 '../../../third_party/dav1d/src/x86/looprestoration_avx2.asm', 114 '../../../third_party/dav1d/src/x86/looprestoration_avx512.asm', 115 '../../../third_party/dav1d/src/x86/mc16_avx2.asm', 116 '../../../third_party/dav1d/src/x86/mc16_avx512.asm', 117 '../../../third_party/dav1d/src/x86/mc_avx2.asm', 118 '../../../third_party/dav1d/src/x86/mc_avx512.asm', 119 ] 120 121 SOURCES += [ 122 '../../../third_party/dav1d/src/x86/cdef16_sse.asm', 123 '../../../third_party/dav1d/src/x86/cdef_sse.asm', 124 '../../../third_party/dav1d/src/x86/cpuid.asm', 125 '../../../third_party/dav1d/src/x86/filmgrain16_sse.asm', 126 '../../../third_party/dav1d/src/x86/filmgrain_sse.asm', 127 '../../../third_party/dav1d/src/x86/ipred16_avx2.asm', 128 '../../../third_party/dav1d/src/x86/ipred16_sse.asm', 129 '../../../third_party/dav1d/src/x86/ipred_sse.asm', 130 '../../../third_party/dav1d/src/x86/itx16_sse.asm', 131 '../../../third_party/dav1d/src/x86/itx_sse.asm', 132 '../../../third_party/dav1d/src/x86/loopfilter16_sse.asm', 133 '../../../third_party/dav1d/src/x86/loopfilter_sse.asm', 134 '../../../third_party/dav1d/src/x86/looprestoration16_sse.asm', # moved from autovendored 135 '../../../third_party/dav1d/src/x86/looprestoration_sse.asm', 136 '../../../third_party/dav1d/src/x86/mc16_sse.asm', 137 '../../../third_party/dav1d/src/x86/mc_sse.asm', 138 '../../../third_party/dav1d/src/x86/msac.asm', 139 '../../../third_party/dav1d/src/x86/pal.asm', 140 '../../../third_party/dav1d/src/x86/refmvs.asm', 141 ] 142 143 # BITDEPTH 144 # All the files here should be *_tmpl.c, and the should not appear in SOURCES, 145 # since they require BITDEPTH to be defined 146 relative_path = '../../../third_party/dav1d/src/x86/' 147 bitdepth_basenames = [ 148 ] 149 150 151 for f in bitdepth_basenames: 152 SOURCES += [ 153 '!16bd_%s' % f 154 ] 155 GeneratedFile('16bd_%s' % f, script='../generate_source.py', 156 entry_point='add_define', inputs=[relative_path + f], 157 flags=['BITDEPTH', '16']) 158 SOURCES += [ 159 '!8bd_%s' % f 160 ] 161 GeneratedFile('8bd_%s' % f, script='../generate_source.py', 162 entry_point='add_define', inputs=[relative_path + f], 163 flags=['BITDEPTH', '8']) 164 165 elif CONFIG['TARGET_CPU'] == 'arm' or CONFIG['TARGET_CPU'] == 'aarch64': 166 SOURCES += [ 167 '../../../third_party/dav1d/src/arm/cpu.c', 168 ] 169 EXPORTS += [ 170 '../../../third_party/dav1d/src/arm/asm-offsets.h', 171 '../../../third_party/dav1d/src/arm/cpu.h', 172 '../../../third_party/dav1d/src/arm/msac.h', 173 ] 174 175 # BITDEPTH c file 176 # All the files here should be *_tmpl.c, and the should not appear in SOURCES, 177 # since they require BITDEPTH to be defined 178 relative_path = '../../../third_party/dav1d/src/arm/' 179 bitdepth_basenames = [ 180 ] 181 182 for f in bitdepth_basenames: 183 SOURCES += [ 184 '!16bd_%s' % f 185 ] 186 GeneratedFile('16bd_%s' % f, script='../generate_source.py', 187 entry_point='add_define', inputs=[relative_path + f], 188 flags=['BITDEPTH', '16']) 189 SOURCES += [ 190 '!8bd_%s' % f 191 ] 192 GeneratedFile('8bd_%s' % f, script='../generate_source.py', 193 entry_point='add_define', inputs=[relative_path + f], 194 flags=['BITDEPTH', '8']) 195 196 # BITDEPTH .S files 197 if CONFIG['TARGET_CPU'] == 'aarch64': 198 SOURCES += [ 199 '../../../third_party/dav1d/src/arm/64/cdef.S', 200 '../../../third_party/dav1d/src/arm/64/cdef16.S', 201 '../../../third_party/dav1d/src/arm/64/cdef_tmpl.S', 202 '../../../third_party/dav1d/src/arm/64/filmgrain.S', 203 '../../../third_party/dav1d/src/arm/64/filmgrain16.S', 204 '../../../third_party/dav1d/src/arm/64/ipred.S', 205 '../../../third_party/dav1d/src/arm/64/ipred16.S', 206 # itx.S is used for both 8 and 16 bpc. 207 '../../../third_party/dav1d/src/arm/64/itx.S', 208 '../../../third_party/dav1d/src/arm/64/itx16.S', 209 '../../../third_party/dav1d/src/arm/64/loopfilter.S', 210 '../../../third_party/dav1d/src/arm/64/loopfilter16.S', 211 '../../../third_party/dav1d/src/arm/64/looprestoration.S', 212 '../../../third_party/dav1d/src/arm/64/looprestoration16.S', 213 '../../../third_party/dav1d/src/arm/64/looprestoration_common.S', 214 '../../../third_party/dav1d/src/arm/64/looprestoration_tmpl.S', 215 '../../../third_party/dav1d/src/arm/64/mc.S', 216 '../../../third_party/dav1d/src/arm/64/mc16.S', 217 '../../../third_party/dav1d/src/arm/64/mc_dotprod.S', 218 '../../../third_party/dav1d/src/arm/64/msac.S', 219 '../../../third_party/dav1d/src/arm/64/refmvs.S', 220 ] 221 elif CONFIG['TARGET_CPU'] == 'arm': 222 SOURCES += [ 223 '../../../third_party/dav1d/src/arm/32/cdef.S', 224 '../../../third_party/dav1d/src/arm/32/cdef16.S', 225 '../../../third_party/dav1d/src/arm/32/cdef_tmpl.S', 226 '../../../third_party/dav1d/src/arm/32/filmgrain.S', 227 '../../../third_party/dav1d/src/arm/32/filmgrain16.S', 228 '../../../third_party/dav1d/src/arm/32/ipred.S', 229 '../../../third_party/dav1d/src/arm/32/ipred16.S', 230 '../../../third_party/dav1d/src/arm/32/itx.S', 231 '../../../third_party/dav1d/src/arm/32/itx16.S', 232 '../../../third_party/dav1d/src/arm/32/loopfilter.S', 233 '../../../third_party/dav1d/src/arm/32/loopfilter16.S', 234 '../../../third_party/dav1d/src/arm/32/looprestoration.S', 235 '../../../third_party/dav1d/src/arm/32/looprestoration16.S', 236 '../../../third_party/dav1d/src/arm/32/looprestoration_common.S', 237 '../../../third_party/dav1d/src/arm/32/looprestoration_tmpl.S', 238 '../../../third_party/dav1d/src/arm/32/mc.S', 239 '../../../third_party/dav1d/src/arm/32/mc16.S', 240 '../../../third_party/dav1d/src/arm/32/msac.S', 241 '../../../third_party/dav1d/src/arm/32/refmvs.S', 242 ] 243 244 if CONFIG['TARGET_CPU'] in ('x86', 'x86_64'): 245 USE_NASM = True 246 elif CONFIG['TARGET_CPU'] == 'aarch64' and CONFIG['OS_TARGET'] == 'WINNT': 247 USE_INTEGRATED_CLANGCL_AS = True 248 249 FINAL_LIBRARY = 'xul' 250 251 # We allow warnings for third-party code that can be updated from upstream. 252 AllowCompilerWarnings()