# -*- 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/.

if CONFIG['OS_TARGET'] in ('Darwin', 'Android'):
    DEFINES['GTEST_USE_OWN_TR1_TUPLE'] = 1

for var in ('MOZILLA_EXTERNAL_LINKAGE', 'USE_FAKE_MEDIA_STREAMS', 'USE_FAKE_PCOBSERVER',
            'NR_SOCKET_IS_VOID_PTR', 'HAVE_STRDUP'):
    DEFINES[var] = True

LOCAL_INCLUDES += [
    '!/dist/include/mozilla/dom', # Binding headers (because binding
                                  # implementations include them).
    '!/dom/bindings', # Binding implementations (urk).
    '/dom/media/',
    '/ipc/chromium/src',
    '/media/mtransport',
    '/media/mtransport/test',
    '/media/mtransport/third_party/nICEr/src/ice',
    '/media/mtransport/third_party/nICEr/src/net',
    '/media/mtransport/third_party/nICEr/src/stun',
    '/media/mtransport/third_party/nrappkit/src/event',
    '/media/mtransport/third_party/nrappkit/src/log',
    '/media/mtransport/third_party/nrappkit/src/plugin',
    '/media/mtransport/third_party/nrappkit/src/port/generic/include',
    '/media/mtransport/third_party/nrappkit/src/registry',
    '/media/mtransport/third_party/nrappkit/src/share',
    '/media/mtransport/third_party/nrappkit/src/stats',
    '/media/mtransport/third_party/nrappkit/src/util/libekr',
    '/media/webrtc',
    '/media/webrtc/signaling/src/common/browser_logging',
    '/media/webrtc/signaling/src/common/time_profiling',
    '/media/webrtc/signaling/src/media',
    '/media/webrtc/signaling/src/media-conduit',
    '/media/webrtc/signaling/src/mediapipeline',
    '/media/webrtc/signaling/src/peerconnection',
    '/media/webrtc/signaling/src/sdp/sipcc',
    '/media/webrtc/trunk',
    '/media/webrtc/trunk/testing/gtest/include',
    '/xpcom/base',
]

if CONFIG['OS_TARGET'] == 'Android':
    LOCAL_INCLUDES += [
        '/media/mtransport/third_party/nrappkit/src/port/android/include',
    ]

if CONFIG['OS_TARGET'] == 'Linux':
    LOCAL_INCLUDES += [
        '/media/mtransport/third_party/nrappkit/src/port/linux/include',
    ]

if CONFIG['OS_TARGET'] == 'Darwin':
    LOCAL_INCLUDES += [
        '/media/mtransport/third_party/nrappkit/src/port/darwin/include',
    ]
    OS_LIBS += [
        '-framework AudioToolbox',
        '-framework AudioUnit',
        '-framework Carbon',
        '-framework CoreAudio',
        '-framework OpenGL',
        '-framework AVFoundation',
        '-framework CoreMedia',
        '-framework QuartzCore',
        '-framework Security',
        '-framework SystemConfiguration',
        '-framework IOKit',
        '-F%s' % CONFIG['MACOS_PRIVATE_FRAMEWORKS_DIR'],
        '-framework CoreUI',
    ]

if CONFIG['OS_TARGET'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
    LOCAL_INCLUDES += [
        '/media/mtransport/third_party/nrappkit/src/port/darwin/include',
    ]

USE_LIBS += [
    '/media/webrtc/trunk/testing/gtest_gtest/gtest',
    'chromium_atomics',
    'gkmedias',
    'nksrtp_s',
    'nss',
    'webrtc',
    'yuv',
    'zlib',
]

if CONFIG['JS_SHARED_LIBRARY']:
    USE_LIBS += [
        'js',
    ]

USE_LIBS += ['mozglue']

OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
OS_LIBS += CONFIG['REALTIME_LIBS']

if CONFIG['MOZ_ALSA']:
    OS_LIBS += CONFIG['MOZ_ALSA_LIBS']

if CONFIG['MOZ_SYSTEM_JPEG']:
    OS_LIBS += CONFIG['MOZ_JPEG_LIBS']

if CONFIG['MOZ_SYSTEM_LIBVPX']:
    OS_LIBS += CONFIG['MOZ_LIBVPX_LIBS']

if not CONFIG['MOZ_TREE_PIXMAN']:
    OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk2':
    OS_LIBS += CONFIG['XLIBS']
    OS_LIBS += CONFIG['MOZ_GTK2_LIBS']
    OS_LIBS += [
        'gmodule-2.0',
        'gthread-2.0',
    ]

if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
    OS_LIBS += CONFIG['XLIBS']
    OS_LIBS += CONFIG['MOZ_GTK3_LIBS']
    USE_LIBS += [
        'freetype',
    ]

if CONFIG['OS_TARGET'] in ('Linux', 'DragonFly', 'FreeBSD', 'NetBSD',
        'OpenBSD'):
    OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']

if CONFIG['OS_TARGET'] == 'Darwin':
    OS_LIBS += CONFIG['TK_LIBS']