| # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 
 | # | 
 | # Use of this source code is governed by a BSD-style license | 
 | # that can be found in the LICENSE file in the root of the source | 
 | # tree. An additional intellectual property rights grant can be found | 
 | # in the file PATENTS.  All contributing project authors may | 
 | # be found in the AUTHORS file in the root of the source tree. | 
 |  | 
 | # TODO(kjellander): Rebase this to base.gyp changes after r6438. | 
 |  | 
 | import("//build/config/crypto.gni") | 
 | import("//build/config/ui.gni") | 
 | import("../build/webrtc.gni") | 
 |  | 
 | config("webrtc_base_config") { | 
 |   include_dirs = [ | 
 |     "//third_party/jsoncpp/overrides/include", | 
 |     "//third_party/jsoncpp/source/include", | 
 |   ] | 
 |  | 
 |   defines = [ | 
 |     "FEATURE_ENABLE_SSL", | 
 |     "GTEST_RELATIVE_PATH", | 
 |   ] | 
 |  | 
 |   # TODO(henrike): issue 3307, make webrtc_base build without disabling | 
 |   # these flags. | 
 |   cflags_cc = [ "-Wno-non-virtual-dtor" ] | 
 | } | 
 |  | 
 | config("webrtc_base_chromium_config") { | 
 |   defines = [ | 
 |     "NO_MAIN_THREAD_WRAPPING", | 
 |     "SSL_USE_NSS", | 
 |   ] | 
 | } | 
 |  | 
 | config("openssl_config") { | 
 |   defines = [ | 
 |     "SSL_USE_OPENSSL", | 
 |     "HAVE_OPENSSL_SSL_H", | 
 |   ] | 
 | } | 
 |  | 
 | config("no_openssl_config") { | 
 |   defines = [ | 
 |     "SSL_USE_NSS", | 
 |     "HAVE_NSS_SSL_H", | 
 |     "SSL_USE_NSS_RNG", | 
 |   ] | 
 | } | 
 |  | 
 | config("android_config") { | 
 |   defines = [ "HAVE_OPENSSL_SSL_H" ] | 
 | } | 
 |  | 
 | config("no_android_config") { | 
 |   defines = [ | 
 |     "HAVE_NSS_SSL_H", | 
 |     "SSL_USE_NSS_RNG", | 
 |   ] | 
 | } | 
 |  | 
 | config("ios_config") { | 
 |   ldflags = [ | 
 |     #"Foundation.framework",  # Already included in //build/config:default_libs. | 
 |     "Security.framework", | 
 |     "SystemConfiguration.framework", | 
 |     #"UIKit.framework",  # Already included in //build/config:default_libs. | 
 |   ] | 
 | } | 
 |  | 
 | config("mac_config") { | 
 |   ldflags = [ | 
 |     "Cocoa.framework", | 
 |     #"Foundation.framework",  # Already included in //build/config:default_libs. | 
 |     #"IOKit.framework",  # Already included in //build/config:default_libs. | 
 |     #"Security.framework",  # Already included in //build/config:default_libs. | 
 |     "SystemConfiguration.framework", | 
 |   ] | 
 | } | 
 |  | 
 | config("mac_x86_config") { | 
 |   libs = [ | 
 |     #"Carbon.framework",  # Already included in //build/config:default_libs. | 
 |   ] | 
 | } | 
 |  | 
 | if (is_linux && !build_with_chromium) { | 
 |   # Provides the same functionality as the //crypto:platform target, which | 
 |   # WebRTC cannot use as we don't sync src/crypto from Chromium. | 
 |   group("linux_system_ssl") { | 
 |     if (use_openssl) { | 
 |       deps = [ "//third_party/boringssl" ] | 
 |     } else { | 
 |       deps = [ "//net/third_party/nss/ssl:libssl" ] | 
 |  | 
 |       direct_dependent_configs = [ | 
 |         "//net/third_party/nss/ssl:ssl_config", | 
 |         "//third_party/nss:system_nss_no_ssl_config", | 
 |       ] | 
 |     } | 
 |   } | 
 | } | 
 |  | 
 |  | 
 | static_library("webrtc_base") { | 
 |   cflags = [] | 
 |   cflags_cc = [] | 
 |   deps= [] | 
 |  | 
 |   configs += [ | 
 |     "..:common_config", | 
 |     ":webrtc_base_config", | 
 |   ] | 
 |  | 
 |   direct_dependent_configs = [ | 
 |     "..:common_inherited_config", | 
 |     ":webrtc_base_config", | 
 |   ] | 
 |  | 
 |   defines = [ | 
 |     "LOGGING=1", | 
 |     "USE_WEBRTC_DEV_BRANCH", | 
 |   ] | 
 |  | 
 |   sources = [ | 
 |     "asyncfile.cc", | 
 |     "asyncfile.h", | 
 |     "asynchttprequest.cc", | 
 |     "asynchttprequest.h", | 
 |     "asyncpacketsocket.h", | 
 |     "asyncsocket.cc", | 
 |     "asyncsocket.h", | 
 |     "asynctcpsocket.cc", | 
 |     "asynctcpsocket.h", | 
 |     "asyncudpsocket.cc", | 
 |     "asyncudpsocket.h", | 
 |     "autodetectproxy.cc", | 
 |     "autodetectproxy.h", | 
 |     "base64.cc", | 
 |     "base64.h", | 
 |     "basicdefs.h", | 
 |     "bytebuffer.cc", | 
 |     "bytebuffer.h", | 
 |     "byteorder.h", | 
 |     "checks.cc", | 
 |     "checks.h", | 
 |     "common.cc", | 
 |     "common.h", | 
 |     "cpumonitor.cc", | 
 |     "cpumonitor.h", | 
 |     "crc32.cc", | 
 |     "crc32.h", | 
 |     "criticalsection.h", | 
 |     "cryptstring.h", | 
 |     "diskcache.cc", | 
 |     "diskcache.h", | 
 |     "event.cc", | 
 |     "event.h", | 
 |     "fileutils.cc", | 
 |     "fileutils.h", | 
 |     "firewallsocketserver.cc", | 
 |     "firewallsocketserver.h", | 
 |     "flags.cc", | 
 |     "flags.h", | 
 |     "gunit_prod.h", | 
 |     "helpers.cc", | 
 |     "helpers.h", | 
 |     "httpbase.cc", | 
 |     "httpbase.h", | 
 |     "httpclient.cc", | 
 |     "httpclient.h", | 
 |     "httpcommon-inl.h", | 
 |     "httpcommon.cc", | 
 |     "httpcommon.h", | 
 |     "httprequest.cc", | 
 |     "httprequest.h", | 
 |     "iosfilesystem.mm", | 
 |     "ipaddress.cc", | 
 |     "ipaddress.h", | 
 |     "linked_ptr.h", | 
 |     "mathutils.h", | 
 |     "md5.cc", | 
 |     "md5.h", | 
 |     "md5digest.h", | 
 |     "messagedigest.cc", | 
 |     "messagedigest.h", | 
 |     "messagehandler.cc", | 
 |     "messagehandler.h", | 
 |     "messagequeue.cc", | 
 |     "messagequeue.h", | 
 |     "nethelpers.cc", | 
 |     "nethelpers.h", | 
 |     "network.cc", | 
 |     "network.h", | 
 |     "nssidentity.cc", | 
 |     "nssidentity.h", | 
 |     "nssstreamadapter.cc", | 
 |     "nssstreamadapter.h", | 
 |     "nullsocketserver.h", | 
 |     "pathutils.cc", | 
 |     "pathutils.h", | 
 |     "physicalsocketserver.cc", | 
 |     "physicalsocketserver.h", | 
 |     "proxydetect.cc", | 
 |     "proxydetect.h", | 
 |     "proxyinfo.cc", | 
 |     "proxyinfo.h", | 
 |     "ratelimiter.cc", | 
 |     "ratelimiter.h", | 
 |     "ratetracker.cc", | 
 |     "ratetracker.h", | 
 |     "safe_conversions.h", | 
 |     "safe_conversions_impl.h", | 
 |     "scoped_autorelease_pool.h", | 
 |     "scoped_autorelease_pool.mm", | 
 |     "scoped_ptr.h", | 
 |     "sha1.cc", | 
 |     "sha1.h", | 
 |     "sha1digest.h", | 
 |     "signalthread.cc", | 
 |     "signalthread.h", | 
 |     "sigslot.h", | 
 |     "sigslotrepeater.h", | 
 |     "socket.h", | 
 |     "socketadapters.cc", | 
 |     "socketadapters.h", | 
 |     "socketaddress.cc", | 
 |     "socketaddress.h", | 
 |     "socketaddresspair.cc", | 
 |     "socketaddresspair.h", | 
 |     "socketfactory.h", | 
 |     "socketpool.cc", | 
 |     "socketpool.h", | 
 |     "socketserver.h", | 
 |     "socketstream.cc", | 
 |     "socketstream.h", | 
 |     "ssladapter.cc", | 
 |     "ssladapter.h", | 
 |     "sslfingerprint.cc", | 
 |     "sslfingerprint.h", | 
 |     "sslidentity.cc", | 
 |     "sslidentity.h", | 
 |     "sslsocketfactory.cc", | 
 |     "sslsocketfactory.h", | 
 |     "sslstreamadapter.cc", | 
 |     "sslstreamadapter.h", | 
 |     "sslstreamadapterhelper.cc", | 
 |     "sslstreamadapterhelper.h", | 
 |     "stream.cc", | 
 |     "stream.h", | 
 |     "stringencode.cc", | 
 |     "stringencode.h", | 
 |     "stringutils.cc", | 
 |     "stringutils.h", | 
 |     "systeminfo.cc", | 
 |     "systeminfo.h", | 
 |     "task.cc", | 
 |     "task.h", | 
 |     "taskparent.cc", | 
 |     "taskparent.h", | 
 |     "taskrunner.cc", | 
 |     "taskrunner.h", | 
 |     "thread.cc", | 
 |     "thread.h", | 
 |     "timeutils.cc", | 
 |     "timeutils.h", | 
 |     "timing.cc", | 
 |     "timing.h", | 
 |     "urlencode.cc", | 
 |     "urlencode.h", | 
 |     "worker.cc", | 
 |     "worker.h", | 
 |   ] | 
 |  | 
 |   if (is_posix) { | 
 |     sources += [ | 
 |       "unixfilesystem.cc", | 
 |       "unixfilesystem.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (build_with_chromium) { | 
 |     sources += [ | 
 |       "../overrides/webrtc/base/basictypes.h", | 
 |       "../overrides/webrtc/base/constructormagic.h", | 
 |       "../overrides/webrtc/base/logging.cc", | 
 |       "../overrides/webrtc/base/logging.h", | 
 |     ] | 
 |  | 
 |     if (is_win) { | 
 |       sources += [ "../overrides/webrtc/base/win32socketinit.cc" ] | 
 |     } | 
 |  | 
 |     include_dirs = [ | 
 |       "../overrides", | 
 |       "../../boringssl/src/include", | 
 |     ] | 
 |  | 
 |     direct_dependent_configs += [ ":webrtc_base_chromium_config" ] | 
 |   } else { | 
 |     sources += [ | 
 |       "asyncinvoker.cc", | 
 |       "asyncinvoker.h", | 
 |       "asyncinvoker-inl.h", | 
 |       "asyncresolverinterface.h", | 
 |       "atomicops.h", | 
 |       "bandwidthsmoother.cc", | 
 |       "bandwidthsmoother.h", | 
 |       "basictypes.h", | 
 |       "bind.h", | 
 |       "bind.h.pump", | 
 |       "buffer.h", | 
 |       "callback.h", | 
 |       "callback.h.pump", | 
 |       "constructormagic.h", | 
 |       "filelock.cc", | 
 |       "filelock.h", | 
 |       "fileutils_mock.h", | 
 |       "genericslot.h", | 
 |       "genericslot.h.pump", | 
 |       "httpserver.cc", | 
 |       "httpserver.h", | 
 |       "json.cc", | 
 |       "json.h", | 
 |       "logging.cc", | 
 |       "logging.h", | 
 |       "mathutils.h", | 
 |       "multipart.cc", | 
 |       "multipart.h", | 
 |       "natserver.cc", | 
 |       "natserver.h", | 
 |       "natsocketfactory.cc", | 
 |       "natsocketfactory.h", | 
 |       "nattypes.cc", | 
 |       "nattypes.h", | 
 |       "openssl.h", | 
 |       "optionsfile.cc", | 
 |       "optionsfile.h", | 
 |       "profiler.cc", | 
 |       "profiler.h", | 
 |       "proxyserver.cc", | 
 |       "proxyserver.h", | 
 |       "refcount.h", | 
 |       "referencecountedsingletonfactory.h", | 
 |       "rollingaccumulator.h", | 
 |       "scopedptrcollection.h", | 
 |       "scoped_ref_ptr.h", | 
 |       "sec_buffer.h", | 
 |       "sharedexclusivelock.cc", | 
 |       "sharedexclusivelock.h", | 
 |       "sslconfig.h", | 
 |       "sslroots.h", | 
 |       "stringdigest.h", | 
 |       "testclient.cc", | 
 |       "testclient.h", | 
 |       "transformadapter.cc", | 
 |       "transformadapter.h", | 
 |       "versionparsing.cc", | 
 |       "versionparsing.h", | 
 |       "virtualsocketserver.cc", | 
 |       "virtualsocketserver.h", | 
 |       "window.h", | 
 |       "windowpickerfactory.h", | 
 |       "windowpicker.h", | 
 |     ] | 
 |  | 
 |     if (is_posix) { | 
 |       sources += [ | 
 |         "latebindingsymboltable.cc", | 
 |         "latebindingsymboltable.cc.def", | 
 |         "latebindingsymboltable.h", | 
 |         "latebindingsymboltable.h.def", | 
 |         "posix.cc", | 
 |         "posix.h", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (is_linux) { | 
 |       sources += [ | 
 |         "dbus.cc", | 
 |         "dbus.h", | 
 |         "libdbusglibsymboltable.cc", | 
 |         "libdbusglibsymboltable.h", | 
 |         "linuxfdwalk.c", | 
 |         "linuxfdwalk.h", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (use_x11) { | 
 |       sources += [ | 
 |         "x11windowpicker.cc", | 
 |         "x11windowpicker.h", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (is_mac) { | 
 |       sources += [ | 
 |         "macasyncsocket.cc", | 
 |         "macasyncsocket.h", | 
 |         "maccocoasocketserver.h", | 
 |         "maccocoasocketserver.mm", | 
 |         "macsocketserver.cc", | 
 |         "macsocketserver.h", | 
 |         "macwindowpicker.cc", | 
 |         "macwindowpicker.h", | 
 |       ] | 
 |     } | 
 |  | 
 |     if (is_win) { | 
 |       sources += [ | 
 |         "diskcache_win32.cc", | 
 |         "diskcache_win32.h", | 
 |         "win32regkey.cc", | 
 |         "win32regkey.h", | 
 |         "win32socketinit.cc", | 
 |         "win32socketinit.h", | 
 |         "win32socketserver.cc", | 
 |         "win32socketserver.h", | 
 |       ] | 
 |     } | 
 |  | 
 |     deps += [ "//third_party/jsoncpp" ] | 
 |   }  # !build_with_chromium | 
 |  | 
 |   if (is_clang) { | 
 |     # Suppress warnings from Chrome's Clang plugins. | 
 |     # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. | 
 |     configs -= [ "//build/config/clang:find_bad_constructs" ] | 
 |   } | 
 |  | 
 |   # TODO(henrike): issue 3307, make webrtc_base build with the Chromium default | 
 |   # compiler settings. | 
 |   configs -= [ "//build/config/compiler:chromium_code" ] | 
 |   configs += [ "//build/config/compiler:no_chromium_code" ] | 
 |   cflags += [ "-Wno-uninitialized" ] | 
 |   cflags_cc += [ "-Wno-non-virtual-dtor" ] | 
 |  | 
 |   if (use_openssl) { | 
 |     direct_dependent_configs += [ ":openssl_config" ] | 
 |  | 
 |     deps += [ "//third_party/boringssl" ] | 
 |   } else { | 
 |     direct_dependent_configs += [ ":no_openssl_config" ] | 
 |   } | 
 |  | 
 |   if (is_android) { | 
 |     sources += [ | 
 |       "ifaddrs-android.cc", | 
 |       "ifaddrs-android.h", | 
 |     ] | 
 |  | 
 |     direct_dependent_configs += [ ":android_config" ] | 
 |  | 
 |     libs = [ | 
 |       "log", | 
 |       "GLESv2" | 
 |     ] | 
 |   } else { | 
 |     direct_dependent_configs += [ ":no_android_config" ] | 
 |   } | 
 |  | 
 |   if (is_ios) { | 
 |     all_dependent_configs += [ ":ios_config" ] | 
 |  | 
 |     deps += [ "//net/third_party/nss/ssl:libssl" ] | 
 |   } | 
 |  | 
 |   if (is_linux) { | 
 |     libs = [ | 
 |       "crypto", | 
 |       "dl", | 
 |       "rt", | 
 |       "Xext", | 
 |       "X11", | 
 |       "Xcomposite", | 
 |       "Xrender", | 
 |     ] | 
 |     configs += [ "//third_party/nss:system_nss_no_ssl_config" ] | 
 |   } | 
 |  | 
 |   if (is_mac) { | 
 |     sources += [ | 
 |       "maccocoathreadhelper.h", | 
 |       "maccocoathreadhelper.mm", | 
 |       "macconversion.cc", | 
 |       "macconversion.h", | 
 |       "macutils.cc", | 
 |       "macutils.h", | 
 |     ] | 
 |  | 
 |     all_dependent_configs = [ ":mac_config" ] | 
 |  | 
 |     libs = [ | 
 |       "crypto",  # $(SDKROOT)/usr/lib/libcrypto.dylib | 
 |       "ssl",  # $(SDKROOT)/usr/lib/libssl.dylib | 
 |     ] | 
 |     if (cpu_arch == "x86") { | 
 |       all_dependent_configs += [ ":mac_x86_config" ] | 
 |     } | 
 |   } | 
 |  | 
 |   if (is_win) { | 
 |     sources += [ | 
 |       "schanneladapter.cc", | 
 |       "schanneladapter.h", | 
 |       "win32.cc", | 
 |       "win32.h", | 
 |       "win32filesystem.cc", | 
 |       "win32filesystem.h", | 
 |       "win32securityerrors.cc", | 
 |       "win32window.cc", | 
 |       "win32window.h", | 
 |       "win32windowpicker.cc", | 
 |       "win32windowpicker.h", | 
 |       "winfirewall.cc", | 
 |       "winfirewall.h", | 
 |       "winping.cc", | 
 |       "winping.h", | 
 |     ] | 
 |  | 
 |     libs = [ | 
 |       "crypt32.lib", | 
 |       "iphlpapi.lib", | 
 |       "secur32.lib", | 
 |     ] | 
 |  | 
 |     cflags += [ | 
 |       # Suppress warnings about WIN32_LEAN_AND_MEAN. | 
 |       "/wd4005", | 
 |       "/wd4703", | 
 |     ] | 
 |  | 
 |     defines += [ "_CRT_NONSTDC_NO_DEPRECATE" ] | 
 |   } | 
 |  | 
 |   if (is_posix && is_debug) { | 
 |     # Chromium's build/common.gypi defines this for all posix | 
 |     # _except_ for ios & mac.  We want it there as well, e.g. | 
 |     # because ASSERT and friends trigger off of it. | 
 |     defines += [ "_DEBUG" ] | 
 |   } | 
 |  | 
 |   if (is_ios || (is_mac && cpu_arch != "x86")) { | 
 |     defines += [ "CARBON_DEPRECATED=YES" ] | 
 |   } | 
 |  | 
 |   if (!is_ios && is_posix) { | 
 |     sources += [ | 
 |       "openssl.h", | 
 |       "openssladapter.cc", | 
 |       "openssladapter.h", | 
 |       "openssldigest.cc", | 
 |       "openssldigest.h", | 
 |       "opensslidentity.cc", | 
 |       "opensslidentity.h", | 
 |       "opensslstreamadapter.cc", | 
 |       "opensslstreamadapter.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (is_linux || is_android) { | 
 |     sources += [ | 
 |       "linux.cc", | 
 |       "linux.h", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (is_mac || is_ios || is_win) { | 
 |     deps += [ | 
 |       "//net/third_party/nss/ssl:libssl", | 
 |       "//third_party/nss:nspr", | 
 |       "//third_party/nss:nss", | 
 |     ] | 
 |   } | 
 |  | 
 |   if (is_posix && !is_mac && !is_ios && !is_android) { | 
 |     if (build_with_chromium) { | 
 |       deps += [ "//crypto:platform" ] | 
 |     } else { | 
 |       deps += [ ":linux_system_ssl" ] | 
 |     } | 
 |   } | 
 | } |