moz.build (2816B)
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/. 6 7 with Files("**"): 8 BUG_COMPONENT = ("Core", "Graphics: ImageLib") 9 10 EXPORTS += [ 11 'png.h', 12 'pngconf.h', 13 'pnglibconf.h' 14 ] 15 16 # libpng errors out if pngpriv.h is included more than once in order to prevent 17 # application that integrate libpng from including that file, unfortunately 18 # that also errors out when using unified sources so we have to disable it 19 # here. Similarly for all of the arch-specific sources below. 20 SOURCES += [ 21 'png.c', 22 'pngerror.c', 23 'pngget.c', 24 'pngmem.c', 25 'pngread.c', 26 'pngrio.c', 27 'pngrtran.c', 28 'pngset.c', 29 'pngtrans.c', 30 'pngwio.c', 31 'pngwrite.c', 32 ] 33 34 # These source files all define duplicate interlacing symbols (starting at 35 # png_pass_start) so they can't be compiled together. When the libpng is 36 # refactored to avoid this we can merge these back into UNIFIED_SOURCES. 37 SOURCES += [ 38 'pngpread.c', 39 'pngrutil.c', 40 'pngwutil.c' 41 ] 42 43 if CONFIG['TARGET_CPU'] == 'arm' or CONFIG['TARGET_CPU'] == 'aarch64': 44 DEFINES['MOZ_PNG_USE_ARM_NEON'] = True 45 SOURCES += [ 46 'arm/arm_init.c', 47 'arm/filter_neon_intrinsics.c', 48 'arm/palette_neon_intrinsics.c' 49 ] 50 51 if CONFIG['TARGET_CPU'] == 'arm': 52 SOURCES += [ 53 'arm/filter_neon.S' 54 ] 55 56 if CONFIG['INTEL_ARCHITECTURE']: 57 DEFINES['MOZ_PNG_USE_INTEL_SSE'] = True 58 SOURCES += [ 59 'intel/filter_sse2_intrinsics.c', 60 'intel/intel_init.c' 61 ] 62 63 if CONFIG['TARGET_CPU'] in ('mips32', 'mips64'): 64 DEFINES['MOZ_PNG_USE_MIPS_MSA'] = True 65 SOURCES += [ 66 'mips/filter_mmi_inline_assembly.c', 67 'mips/filter_msa_intrinsics.c', 68 'mips/mips_init.c' 69 ] 70 71 if CONFIG['HAVE_ALTIVEC']: 72 DEFINES['MOZ_PNG_USE_POWERPC'] = True 73 SOURCES += [ 74 'powerpc/filter_vsx_intrinsics.c', 75 'powerpc/powerpc_init.c' 76 ] 77 78 if CONFIG['TARGET_CPU'] == 'loongarch64': 79 DEFINES['MOZ_PNG_USE_LOONGARCH_LSX'] = True 80 CFLAGS += ['-mlsx'] 81 SOURCES += [ 82 'loongarch/filter_lsx_intrinsics.c', 83 'loongarch/loongarch_lsx_init.c', 84 ] 85 86 if CONFIG['TARGET_CPU'] == 'riscv64': 87 DEFINES['MOZ_PNG_USE_RISCV_RVV'] = True 88 SOURCES += [ 89 'riscv/filter_rvv_intrinsics.c', 90 'riscv/riscv_init.c', 91 ] 92 93 if CONFIG['MOZ_TREE_FREETYPE']: 94 DEFINES['FT_CONFIG_OPTION_USE_PNG'] = True 95 96 Library('mozpng') 97 98 FINAL_LIBRARY = 'xul' 99 100 # We allow warnings for third-party code that can be updated from upstream. 101 AllowCompilerWarnings() 102 103 if CONFIG['CC_TYPE'] in ('clang', 'gcc'): 104 CFLAGS += ['-std=gnu89']