summaryrefslogtreecommitdiffstats
path: root/media/libtheora/moz.build
blob: caaa5991a1608ce095f531dea1a77476ffe157fc (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
# -*- 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/.

with Files('*'):
    BUG_COMPONENT = ('Core', 'Audio/Video')

EXPORTS.theora += [
    'include/theora/codec.h',
    'include/theora/theoradec.h',
]

# We allow warnings for third-party code that can be updated from upstream.
AllowCompilerWarnings()

FINAL_LIBRARY = 'gkcodecs'
NoVisibilityFlags()

# The encoder is currently not included.
DEFINES['THEORA_DISABLE_ENCODE'] = True

# Suppress warnings in third-party code.
CFLAGS += ['-Wno-type-limits']
if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
    CFLAGS += [
        '-Wno-shift-negative-value',
        '-Wno-tautological-compare',
    ]
if CONFIG['CC_TYPE'] == 'clang-cl':
    CFLAGS += [
        '-Wno-parentheses',
        '-Wno-pointer-sign',
    ]

UNIFIED_SOURCES += [
    'lib/bitpack.c',
    'lib/decinfo.c',
    'lib/decode.c',
    'lib/dequant.c',
    'lib/fragment.c',
    'lib/huffdec.c',
    'lib/idct.c',
    'lib/info.c',
    'lib/internal.c',
    'lib/quant.c',
    'lib/state.c',
]

LOCAL_INCLUDES += ['include']

if CONFIG['INTEL_ARCHITECTURE']:
    if CONFIG['OS_ARCH'] != 'SunOS':
        if CONFIG['CC_TYPE'] == 'clang-cl':
            # clang-cl can't handle libtheora's inline asm.
            pass
        elif CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['TARGET_CPU'] != 'x86_64':
            DEFINES['OC_X86_ASM'] = True
            if CONFIG['TARGET_CPU'] == 'x86_64':
                DEFINES['OC_X86_64_ASM'] = True
    if CONFIG['CC_TYPE'] == 'clang-cl':
        # clang-cl can't handle libtheora's inline asm.
        pass
        #SOURCES += [
        #    'lib/x86_vc/mmxfrag.c',
        #    'lib/x86_vc/mmxidct.c',
        #    'lib/x86_vc/mmxstate.c',
        #    'lib/x86_vc/x86cpu.c',
        #    'lib/x86_vc/x86state.c',
        #]
    else:
        SOURCES += [
            'lib/x86/mmxfrag.c',
            'lib/x86/mmxidct.c',
            'lib/x86/mmxstate.c',
            'lib/x86/sse2idct.c',
            'lib/x86/x86cpu.c',
            'lib/x86/x86state.c',
        ]

if CONFIG['GNU_AS']:
    if CONFIG['TARGET_CPU'] == 'arm':
        SOURCES += [
            'lib/arm/armcpu.c',
            'lib/arm/armstate.c',
        ]
        for var in ('OC_ARM_ASM',
                    'OC_ARM_ASM_EDSP',
                    'OC_ARM_ASM_MEDIA',
                    'OC_ARM_ASM_NEON'):
            DEFINES[var] = True

        SOURCES += [ '!%s.s' % f for f in [
            'armbits-gnu',
            'armfrag-gnu',
            'armidct-gnu',
            'armloop-gnu',
        ]]

        # These flags are a lie; they're just used to enable the requisite
        # opcodes; actual arch detection is done at runtime.
        ASFLAGS += [
            '-march=armv7-a',
        ]
        ASFLAGS += CONFIG['NEON_FLAGS']