2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2013-02-26 00:47:22 +04:00
|
|
|
# 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/.
|
|
|
|
|
2015-03-03 22:36:00 +03:00
|
|
|
with Files('*'):
|
2017-03-23 03:23:12 +03:00
|
|
|
BUG_COMPONENT = ('Core', 'Audio/Video')
|
2015-03-03 22:36:00 +03:00
|
|
|
|
2013-04-16 23:24:43 +04:00
|
|
|
EXPORTS.opus += [
|
|
|
|
'include/opus.h',
|
|
|
|
'include/opus_defines.h',
|
|
|
|
'include/opus_multistream.h',
|
|
|
|
'include/opus_types.h',
|
|
|
|
]
|
|
|
|
|
2015-10-20 04:05:20 +03:00
|
|
|
# We allow warnings for third-party code that can be updated from upstream.
|
2017-10-26 01:12:09 +03:00
|
|
|
AllowCompilerWarnings()
|
2015-08-28 06:44:53 +03:00
|
|
|
|
2013-11-19 06:47:14 +04:00
|
|
|
FINAL_LIBRARY = 'gkmedias'
|
2013-11-27 17:55:07 +04:00
|
|
|
|
|
|
|
DEFINES['OPUS_BUILD'] = True
|
2017-06-27 08:28:00 +03:00
|
|
|
DEFINES['OPUS_VERSION'] = '"v1.2.1-mozilla"'
|
2013-11-27 17:55:07 +04:00
|
|
|
DEFINES['USE_ALLOCA'] = True
|
2014-04-25 00:39:00 +04:00
|
|
|
|
2015-10-20 09:47:30 +03:00
|
|
|
# Don't export symbols
|
|
|
|
DEFINES['OPUS_EXPORT'] = ''
|
2013-11-27 17:55:07 +04:00
|
|
|
|
2014-03-06 04:44:42 +04:00
|
|
|
if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
|
|
|
|
DEFINES['OPUS_ARM_ASM'] = True
|
|
|
|
DEFINES['OPUS_ARM_EXTERNAL_ASM'] = True
|
|
|
|
DEFINES['OPUS_ARM_INLINE_ASM'] = True
|
2014-08-21 02:44:31 +04:00
|
|
|
if int(CONFIG['ARM_ARCH']) >= 6:
|
|
|
|
DEFINES['OPUS_ARM_INLINE_EDSP'] = True
|
|
|
|
DEFINES['OPUS_ARM_MAY_HAVE_EDSP'] = True
|
|
|
|
DEFINES['OPUS_ARM_MAY_HAVE_MEDIA'] = True
|
|
|
|
DEFINES['OPUS_ARM_MAY_HAVE_NEON'] = True
|
2014-03-06 04:44:42 +04:00
|
|
|
|
2014-02-14 12:20:09 +04:00
|
|
|
if CONFIG['MOZ_DEBUG']:
|
|
|
|
DEFINES['ENABLE_ASSERTIONS'] = True
|
|
|
|
|
2013-11-27 17:55:07 +04:00
|
|
|
if CONFIG['OS_ARCH'] in ('Linux', 'Darwin', 'DragonFly', 'FreeBSD',
|
|
|
|
'NetBSD', 'OpenBSD'):
|
|
|
|
DEFINES['HAVE_LRINTF'] = True
|
|
|
|
|
|
|
|
if CONFIG['OS_ARCH'] == 'WINNT':
|
|
|
|
DEFINES['inline'] = '__inline'
|
2017-12-08 00:09:15 +03:00
|
|
|
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
2013-11-27 17:55:07 +04:00
|
|
|
DEFINES['HAVE_LRINTF'] = True
|
|
|
|
|
|
|
|
if CONFIG['OS_ARCH'] == 'AIX':
|
|
|
|
DEFINES['alloca'] = '__alloca'
|
|
|
|
|
|
|
|
if CONFIG['OS_ARCH'] == 'SunOS':
|
|
|
|
DEFINES['HAVE_ALLOCA_H'] = True
|
|
|
|
|
|
|
|
if not CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
|
|
|
|
DEFINES['FIXED_POINT'] = 1
|
|
|
|
DEFINES['DISABLE_FLOAT_API'] = True
|
2014-01-10 00:44:24 +04:00
|
|
|
|
|
|
|
LOCAL_INCLUDES += [
|
|
|
|
'celt',
|
|
|
|
'include',
|
|
|
|
'silk',
|
|
|
|
'src',
|
|
|
|
]
|
|
|
|
|
|
|
|
# sources.mozbuild is generated from gen-sources.py when a new libopus is
|
|
|
|
# imported.
|
|
|
|
include('sources.mozbuild')
|
|
|
|
|
2015-03-23 03:55:20 +03:00
|
|
|
UNIFIED_SOURCES += celt_sources
|
|
|
|
UNIFIED_SOURCES += silk_sources
|
|
|
|
UNIFIED_SOURCES += opus_sources
|
2015-12-30 03:33:31 +03:00
|
|
|
SOURCES += opus_nonunified_sources
|
2014-01-10 00:44:24 +04:00
|
|
|
|
|
|
|
if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
|
|
|
|
LOCAL_INCLUDES += [
|
|
|
|
'silk/float',
|
|
|
|
]
|
2015-03-23 03:55:20 +03:00
|
|
|
UNIFIED_SOURCES += silk_sources_float
|
|
|
|
UNIFIED_SOURCES += opus_sources_float
|
2014-01-10 00:44:24 +04:00
|
|
|
else:
|
|
|
|
LOCAL_INCLUDES += [
|
|
|
|
'silk/fixed',
|
|
|
|
]
|
2015-03-23 03:55:20 +03:00
|
|
|
UNIFIED_SOURCES += silk_sources_fixed
|
2014-03-22 11:03:21 +04:00
|
|
|
|
2017-06-14 02:41:35 +03:00
|
|
|
if CONFIG['CPU_ARCH'] in ('x86', 'x86_64'):
|
|
|
|
DEFINES['OPUS_HAVE_RTCD'] = True
|
|
|
|
DEFINES['OPUS_X86_MAY_HAVE_SSE'] = True
|
|
|
|
DEFINES['OPUS_X86_MAY_HAVE_SSE2'] = True
|
|
|
|
DEFINES['OPUS_X86_MAY_HAVE_SSE4_1'] = True
|
|
|
|
DEFINES['OPUS_X86_MAY_HAVE_AVX'] = True
|
|
|
|
SOURCES += celt_sources_sse
|
|
|
|
SOURCES += celt_sources_sse2
|
|
|
|
SOURCES += celt_sources_sse4_1
|
|
|
|
SOURCES += silk_sources_sse4_1
|
|
|
|
if not CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']:
|
|
|
|
SOURCES += silk_sources_fixed_sse4_1
|
2017-12-08 15:46:13 +03:00
|
|
|
if CONFIG['CC_TYPE'] not in ('msvc', 'clang-cl') or CONFIG['CLANG_CL']:
|
2017-06-14 02:41:35 +03:00
|
|
|
for f in SOURCES:
|
|
|
|
if f in celt_sources_sse:
|
|
|
|
SOURCES[f].flags += CONFIG['SSE_FLAGS']
|
|
|
|
if f in celt_sources_sse2:
|
|
|
|
SOURCES[f].flags += CONFIG['SSE2_FLAGS']
|
|
|
|
if f in celt_sources_sse4_1 or \
|
|
|
|
f in silk_sources_sse4_1 or \
|
|
|
|
f in silk_sources_fixed_sse4_1:
|
|
|
|
SOURCES[f].flags += ['-msse4.1']
|
|
|
|
|
2014-03-06 04:44:42 +04:00
|
|
|
if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
|
|
|
|
SOURCES += celt_sources_arm
|
2015-05-19 11:41:09 +03:00
|
|
|
SOURCES += [
|
2016-03-01 21:47:19 +03:00
|
|
|
'!celt_pitch_xcorr_arm-gnu.s'
|
2015-05-19 11:41:09 +03:00
|
|
|
]
|
2014-03-06 04:44:42 +04:00
|
|
|
# -Os is significantly slower, enable -O3 unless optimization is disabled
|
|
|
|
if CONFIG['MOZ_OPTIMIZE']:
|
2015-05-08 08:13:10 +03:00
|
|
|
CFLAGS += [
|
|
|
|
'-O3',
|
|
|
|
]
|
|
|
|
CXXFLAGS += [
|
|
|
|
'-O3',
|
|
|
|
]
|
|
|
|
# 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',
|
|
|
|
]
|
2016-09-14 12:34:19 +03:00
|
|
|
ASFLAGS += CONFIG['NEON_FLAGS']
|
2014-03-06 04:44:42 +04:00
|
|
|
|
2014-03-22 11:03:21 +04:00
|
|
|
# Suppress warnings in third-party code.
|
2017-12-08 00:09:15 +03:00
|
|
|
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
2014-03-22 11:03:21 +04:00
|
|
|
if CONFIG['CLANG_CXX']:
|
2015-11-20 11:24:25 +03:00
|
|
|
CFLAGS += ['-Wno-#pragma-messages']
|