summaryrefslogtreecommitdiff
path: root/media/libjpeg/moz.build
blob: 0da04dabc352f744b59d7edce6807e720e9cd844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

EXPORTS += [
    'jconfig.h',
    'jerror.h',
    'jinclude.h',
    'jmorecfg.h',
    'jpegint.h',
    'jpeglib.h',
]

SOURCES += [
    'jcomapi.c',
    'jdapimin.c',
    'jdapistd.c',
    'jdatadst.c',
    'jdatasrc.c',
    'jdcoefct.c',
    'jdcolor.c',
    'jddctmgr.c',
    'jdhuff.c',
    'jdicc.c',
    'jdinput.c',
    'jdmainct.c',
    'jdmarker.c',
    'jdmaster.c',
    'jdmerge.c',
    'jdphuff.c',
    'jdpostct.c',
    'jdsample.c',
    'jdtrans.c',
    'jerror.c',
    'jfdctflt.c',
    'jfdctfst.c',
    'jfdctint.c',
    'jidctflt.c',
    'jidctfst.c',
    'jidctint.c',
    'jidctred.c',
    'jmemmgr.c',
    'jmemnobs.c',
    'jquant1.c',
    'jquant2.c',
    'jutils.c',
]

# These files enable support for writing JPEGs
SOURCES += [
    'jcapimin.c',
    'jcapistd.c',
    'jccoefct.c',
    'jccolor.c',
    'jcdctmgr.c',
    'jchuff.c',
    'jcicc.c',
    'jcinit.c',
    'jcmainct.c',
    'jcmarker.c',
    'jcmaster.c',
    'jcparam.c',
    'jcphuff.c',
    'jcprepct.c',
    'jcsample.c',
    'jctrans.c',
]

if CONFIG['LIBJPEG_TURBO_USE_YASM']:
    USE_YASM = True

if CONFIG['LIBJPEG_TURBO_ASFLAGS']:
    if CONFIG['CPU_ARCH'] == 'arm':
        LOCAL_INCLUDES += [
            '/media/libjpeg/simd/arm',
            '/media/libjpeg/simd/arm/aarch32',
        ]
        SOURCES += [
            'simd/arm/aarch32/jchuff-neon.c',
            'simd/arm/aarch32/jsimd.c',
            'simd/arm/aarch32/jsimd_neon.S',
            'simd/arm/jcgray-neon.c',
            'simd/arm/jcphuff-neon.c',
            'simd/arm/jcsample-neon.c',
            'simd/arm/jdcolor-neon.c',
            'simd/arm/jdmerge-neon.c',
            'simd/arm/jdsample-neon.c',
            'simd/arm/jfdctfst-neon.c',
            'simd/arm/jfdctint-neon.c',
            'simd/arm/jidctred-neon.c',
            'simd/arm/jquanti-neon.c',
        ]
    elif CONFIG['CPU_ARCH'] == 'aarch64':
        LOCAL_INCLUDES += [
            '/media/libjpeg/simd/arm',
            '/media/libjpeg/simd/arm/aarch64',
        ]
        SOURCES += [
            'simd/arm/aarch64/jsimd.c',
            'simd/arm/aarch64/jsimd_neon.S',
            'simd/arm/jcgray-neon.c',
            'simd/arm/jcphuff-neon.c',
            'simd/arm/jcsample-neon.c',
            'simd/arm/jdmerge-neon.c',
            'simd/arm/jdsample-neon.c',
            'simd/arm/jfdctfst-neon.c',
            'simd/arm/jidctfst-neon.c',
            'simd/arm/jidctred-neon.c',
            'simd/arm/jquanti-neon.c',
        ]
    elif CONFIG['CPU_ARCH'] == 'mips32':
        SOURCES += [
            'simd/mips/jsimd.c',
            'simd/mips/jsimd_dspr2.S',
        ]
        if CONFIG['CC_TYPE'] == 'clang':
            SOURCES['simd/mips/jsimd_dspr2.S'].flags += [
                '-fno-integrated-as',
            ]
    elif CONFIG['CPU_ARCH'] == 'mips64':
        LOCAL_INCLUDES += ['/media/libjpeg/simd/mips64']
        SOURCES += [
            'simd/mips64/jccolor-mmi.c',
            'simd/mips64/jcgray-mmi.c',
            'simd/mips64/jcsample-mmi.c',
            'simd/mips64/jdcolor-mmi.c',
            'simd/mips64/jdmerge-mmi.c',
            'simd/mips64/jdsample-mmi.c',
            'simd/mips64/jfdctfst-mmi.c',
            'simd/mips64/jfdctint-mmi.c',
            'simd/mips64/jidctfst-mmi.c',
            'simd/mips64/jidctint-mmi.c',
            'simd/mips64/jquanti-mmi.c',
            'simd/mips64/jsimd.c',
        ]
    elif CONFIG['CPU_ARCH'] == 'x86_64':
        SOURCES += [
            'simd/x86_64/jccolor-avx2.asm',
            'simd/x86_64/jccolor-sse2.asm',
            'simd/x86_64/jcgray-avx2.asm',
            'simd/x86_64/jcgray-sse2.asm',
            'simd/x86_64/jchuff-sse2.asm',
            'simd/x86_64/jcphuff-sse2.asm',
            'simd/x86_64/jcsample-avx2.asm',
            'simd/x86_64/jcsample-sse2.asm',
            'simd/x86_64/jdcolor-avx2.asm',
            'simd/x86_64/jdcolor-sse2.asm',
            'simd/x86_64/jdmerge-avx2.asm',
            'simd/x86_64/jdmerge-sse2.asm',
            'simd/x86_64/jdsample-avx2.asm',
            'simd/x86_64/jdsample-sse2.asm',
            'simd/x86_64/jfdctflt-sse.asm',
            'simd/x86_64/jfdctfst-sse2.asm',
            'simd/x86_64/jfdctint-avx2.asm',
            'simd/x86_64/jfdctint-sse2.asm',
            'simd/x86_64/jidctflt-sse2.asm',
            'simd/x86_64/jidctfst-sse2.asm',
            'simd/x86_64/jidctint-avx2.asm',
            'simd/x86_64/jidctint-sse2.asm',
            'simd/x86_64/jidctred-sse2.asm',
            'simd/x86_64/jquantf-sse2.asm',
            'simd/x86_64/jquanti-avx2.asm',
            'simd/x86_64/jquanti-sse2.asm',
            'simd/x86_64/jsimd.c',
            'simd/x86_64/jsimdcpu.asm',
        ]
    elif CONFIG['CPU_ARCH'] == 'x86':
        SOURCES += [
            'simd/i386/jccolor-avx2.asm',
            'simd/i386/jccolor-mmx.asm',
            'simd/i386/jccolor-sse2.asm',
            'simd/i386/jcgray-avx2.asm',
            'simd/i386/jcgray-mmx.asm',
            'simd/i386/jcgray-sse2.asm',
            'simd/i386/jchuff-sse2.asm',
            'simd/i386/jcphuff-sse2.asm',
            'simd/i386/jcsample-avx2.asm',
            'simd/i386/jcsample-mmx.asm',
            'simd/i386/jcsample-sse2.asm',
            'simd/i386/jdcolor-avx2.asm',
            'simd/i386/jdcolor-mmx.asm',
            'simd/i386/jdcolor-sse2.asm',
            'simd/i386/jdmerge-avx2.asm',
            'simd/i386/jdmerge-mmx.asm',
            'simd/i386/jdmerge-sse2.asm',
            'simd/i386/jdsample-avx2.asm',
            'simd/i386/jdsample-mmx.asm',
            'simd/i386/jdsample-sse2.asm',
            'simd/i386/jfdctflt-3dn.asm',
            'simd/i386/jfdctflt-sse.asm',
            'simd/i386/jfdctfst-mmx.asm',
            'simd/i386/jfdctfst-sse2.asm',
            'simd/i386/jfdctint-avx2.asm',
            'simd/i386/jfdctint-mmx.asm',
            'simd/i386/jfdctint-sse2.asm',
            'simd/i386/jidctflt-3dn.asm',
            'simd/i386/jidctflt-sse.asm',
            'simd/i386/jidctflt-sse2.asm',
            'simd/i386/jidctfst-mmx.asm',
            'simd/i386/jidctfst-sse2.asm',
            'simd/i386/jidctint-avx2.asm',
            'simd/i386/jidctint-mmx.asm',
            'simd/i386/jidctint-sse2.asm',
            'simd/i386/jidctred-mmx.asm',
            'simd/i386/jidctred-sse2.asm',
            'simd/i386/jquant-3dn.asm',
            'simd/i386/jquant-mmx.asm',
            'simd/i386/jquant-sse.asm',
            'simd/i386/jquantf-sse2.asm',
            'simd/i386/jquanti-avx2.asm',
            'simd/i386/jquanti-sse2.asm',
            'simd/i386/jsimd.c',
            'simd/i386/jsimdcpu.asm',
        ]
elif CONFIG['CPU_ARCH'].startswith('ppc'):
    # PowerPC has no assembly files, but still needs its own headers.
    LOCAL_INCLUDES += ['/media/libjpeg/simd/powerpc']

    # For libjpeg's internal runtime detection to work, jsimd.c must NOT
    # be compiled with -maltivec (otherwise it gets statically set),
    # but everything else should be. If -maltivec was already
    # specified in .mozconfig, though, then this won't harm anything.
    ppc_vmx_sources = [
        'simd/powerpc/jccolor-altivec.c',
        'simd/powerpc/jcgray-altivec.c',
        'simd/powerpc/jcsample-altivec.c',
        'simd/powerpc/jdcolor-altivec.c',
        'simd/powerpc/jdmerge-altivec.c',
        'simd/powerpc/jdsample-altivec.c',
        'simd/powerpc/jfdctfst-altivec.c',
        'simd/powerpc/jfdctint-altivec.c',
        'simd/powerpc/jidctfst-altivec.c',
        'simd/powerpc/jidctint-altivec.c',
        'simd/powerpc/jquanti-altivec.c',
    ]
    SOURCES += ppc_vmx_sources
    SOURCES += [
        'simd/powerpc/jsimd.c',
    ]
    for srcfile in ppc_vmx_sources:
        SOURCES[srcfile].flags += CONFIG['PPC_VMX_FLAGS']
else: # No SIMD support?
    SOURCES += [
        'jsimd_none.c',
    ]

ASFLAGS += CONFIG['LIBJPEG_TURBO_ASFLAGS']

# Make sure the x86 & x86-64 ASM files can see the necessary includes.
if CONFIG['CPU_ARCH'] == 'x86':
    ASFLAGS += ['-I%s/media/libjpeg/simd/nasm/' % TOPSRCDIR]
    ASFLAGS += ['-I%s/media/libjpeg/simd/i386/' % TOPSRCDIR]
if CONFIG['CPU_ARCH'] == 'x86_64':
    ASFLAGS += ['-I%s/media/libjpeg/simd/nasm/' % TOPSRCDIR]
    ASFLAGS += ['-I%s/media/libjpeg/simd/x86_64/' % TOPSRCDIR]

# We allow warnings for third-party code that can be updated from upstream.
ALLOW_COMPILER_WARNINGS = True

FINAL_LIBRARY = 'gkmedias'