(Auto)update libjingle 62293974-> 62364298
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5623 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
eec3843596
commit
b8395ebe14
@ -1,90 +0,0 @@
|
||||
# -*- Python -*-
|
||||
import talk
|
||||
|
||||
Import('env')
|
||||
|
||||
# For peerconnection, we need additional flags only for GCC 4.6+.
|
||||
peerconnection_lin_ccflags = []
|
||||
|
||||
if env.Bit('linux'):
|
||||
# Detect the GCC version and update peerconnection flags.
|
||||
(major, minor, rev) = env.GetGccVersion()
|
||||
if major > 4 or (major == 4 and minor >= 6):
|
||||
peerconnection_lin_ccflags = ['-Wno-error=unused-but-set-variable']
|
||||
|
||||
|
||||
if env.Bit('have_webrtc_voice') and env.Bit('have_webrtc_video'):
|
||||
# local sources
|
||||
talk.Library(
|
||||
env,
|
||||
name = 'peerconnection',
|
||||
srcs = [
|
||||
'audiotrack.cc',
|
||||
'jsepicecandidate.cc',
|
||||
'jsepsessiondescription.cc',
|
||||
'mediaconstraintsinterface.cc',
|
||||
'mediastream.cc',
|
||||
'mediastreamhandler.cc',
|
||||
'mediastreamproxy.cc',
|
||||
'mediastreamsignaling.cc',
|
||||
'mediastreamtrackproxy.cc',
|
||||
'peerconnectionfactory.cc',
|
||||
'peerconnection.cc',
|
||||
'portallocatorfactory.cc',
|
||||
'remoteaudiosource.cc',
|
||||
'roapmessages.cc',
|
||||
'roapsession.cc',
|
||||
'roapsignaling.cc',
|
||||
'videorendererimpl.cc',
|
||||
'videotrack.cc',
|
||||
'webrtcsdp.cc',
|
||||
'webrtcsession.cc',
|
||||
'webrtcsessiondescriptionfactory.cc',
|
||||
],
|
||||
lin_ccflags = peerconnection_lin_ccflags
|
||||
)
|
||||
|
||||
talk.Unittest(
|
||||
env,
|
||||
name = 'peerconnection',
|
||||
srcs = [
|
||||
'test/fakeaudiocapturemodule.cc',
|
||||
'test/fakeaudiocapturemodule_unittest.cc',
|
||||
'test/fakevideocapturemodule.cc',
|
||||
'test/fileframesource.cc',
|
||||
'test/i420framesource.cc',
|
||||
'test/staticframesource.cc',
|
||||
'jsepsessiondescription_unittest.cc',
|
||||
'mediastream_unittest.cc',
|
||||
'mediastreamhandler_unittest.cc',
|
||||
'mediastreamsignaling_unittest.cc',
|
||||
'peerconnectioninterface_unittest.cc',
|
||||
'peerconnection_unittest.cc',
|
||||
'peerconnectionfactory_unittest.cc',
|
||||
'roapmessages_unittest.cc',
|
||||
'roapsession_unittest.cc',
|
||||
'roapsignaling_unittest.cc',
|
||||
'webrtcsdp_unittest.cc',
|
||||
'webrtcsession_unittest.cc',
|
||||
],
|
||||
libs = [
|
||||
'base',
|
||||
'expat',
|
||||
'json',
|
||||
'p2p',
|
||||
'phone',
|
||||
'srtp',
|
||||
'xmllite',
|
||||
'xmpp',
|
||||
'yuvscaler',
|
||||
'peerconnection',
|
||||
],
|
||||
win_link_flags = [('', '/nodefaultlib:libcmt')[env.Bit('debug')]],
|
||||
lin_libs = [
|
||||
'sound',
|
||||
],
|
||||
mac_libs = [
|
||||
'crypto',
|
||||
'ssl',
|
||||
],
|
||||
)
|
@ -40,7 +40,7 @@ namespace {
|
||||
|
||||
const int kLongTime = 10000; // 10 seconds
|
||||
const int kNumThreads = 16;
|
||||
const int kOperationsToRun = 10000;
|
||||
const int kOperationsToRun = 1000;
|
||||
|
||||
template <class T>
|
||||
class AtomicOpRunner : public MessageHandler {
|
||||
|
@ -1,64 +0,0 @@
|
||||
# -*- Python -*-
|
||||
import talk
|
||||
|
||||
Import('env')
|
||||
|
||||
if env.Bit('have_webrtc_voice') and env.Bit('have_webrtc_video'):
|
||||
talk.App(
|
||||
env,
|
||||
name = 'peerconnection_client',
|
||||
# TODO: Build peerconnection_client on mac.
|
||||
libs = [
|
||||
'base',
|
||||
'expat',
|
||||
'json',
|
||||
'p2p',
|
||||
'peerconnection',
|
||||
'phone',
|
||||
'srtp',
|
||||
'xmllite',
|
||||
'xmpp',
|
||||
'yuvscaler',
|
||||
],
|
||||
win_srcs = [
|
||||
'client/conductor.cc',
|
||||
'client/defaults.cc',
|
||||
'client/main.cc',
|
||||
'client/main_wnd.cc',
|
||||
'client/peer_connection_client.cc',
|
||||
],
|
||||
posix_libs = [
|
||||
'crypto',
|
||||
'securetunnel',
|
||||
'ssl',
|
||||
],
|
||||
lin_srcs = [
|
||||
'client/conductor.cc',
|
||||
'client/defaults.cc',
|
||||
'client/peer_connection_client.cc',
|
||||
'client/linux/main.cc',
|
||||
'client/linux/main_wnd.cc',
|
||||
],
|
||||
lin_packages = [
|
||||
'glib-2.0',
|
||||
'gobject-2.0',
|
||||
'gtk+-2.0',
|
||||
],
|
||||
lin_libs = [
|
||||
'sound',
|
||||
],
|
||||
win_link_flags = [
|
||||
('', '/nodefaultlib:libcmt')[env.Bit('debug')],
|
||||
],
|
||||
)
|
||||
|
||||
talk.App(
|
||||
env,
|
||||
name = 'peerconnection_server',
|
||||
srcs = [
|
||||
'server/data_socket.cc',
|
||||
'server/main.cc',
|
||||
'server/peer_channel.cc',
|
||||
'server/utils.cc',
|
||||
],
|
||||
)
|
@ -1,793 +0,0 @@
|
||||
import talk
|
||||
Import("env")
|
||||
|
||||
talk.Library(env, name = "expat",
|
||||
cppdefines = [
|
||||
"XML_STATIC",
|
||||
],
|
||||
srcs = [
|
||||
"third_party/expat-2.0.1/lib/xmlparse.c",
|
||||
"third_party/expat-2.0.1/lib/xmlrole.c",
|
||||
"third_party/expat-2.0.1/lib/xmltok.c",
|
||||
],
|
||||
includedirs = [
|
||||
"third_party/expat-2.0.1/lib",
|
||||
],
|
||||
win_cppdefines = [
|
||||
"COMPILED_FROM_DSP",
|
||||
],
|
||||
posix_cppdefines = [
|
||||
"HAVE_EXPAT_CONFIG_H",
|
||||
],
|
||||
)
|
||||
talk.Library(env, name = "gunit",
|
||||
srcs = [
|
||||
"testing/gtest/src/gtest-all.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
)
|
||||
talk.Library(env, name = "srtp",
|
||||
srcs = [
|
||||
"third_party/srtp/crypto/cipher/aes.c",
|
||||
"third_party/srtp/crypto/cipher/aes_cbc.c",
|
||||
"third_party/srtp/crypto/cipher/aes_icm.c",
|
||||
"third_party/srtp/crypto/cipher/cipher.c",
|
||||
"third_party/srtp/crypto/cipher/null_cipher.c",
|
||||
"third_party/srtp/crypto/hash/auth.c",
|
||||
"third_party/srtp/crypto/hash/hmac.c",
|
||||
"third_party/srtp/crypto/hash/null_auth.c",
|
||||
"third_party/srtp/crypto/hash/sha1.c",
|
||||
"third_party/srtp/crypto/replay/rdb.c",
|
||||
"third_party/srtp/crypto/replay/rdbx.c",
|
||||
"third_party/srtp/crypto/replay/ut_sim.c",
|
||||
"third_party/srtp/crypto/math/datatypes.c",
|
||||
"third_party/srtp/crypto/math/stat.c",
|
||||
"third_party/srtp/crypto/kernel/alloc.c",
|
||||
"third_party/srtp/crypto/kernel/crypto_kernel.c",
|
||||
"third_party/srtp/crypto/kernel/err.c",
|
||||
"third_party/srtp/crypto/kernel/key.c",
|
||||
"third_party/srtp/crypto/rng/ctr_prng.c",
|
||||
"third_party/srtp/crypto/rng/rand_source.c",
|
||||
"third_party/srtp/srtp/ekt.c",
|
||||
"third_party/srtp/srtp/srtp.c",
|
||||
],
|
||||
includedirs = [
|
||||
"third_party/srtp/include",
|
||||
"third_party/srtp/crypto/include",
|
||||
],
|
||||
win_ccflags = [
|
||||
"/wd4701",
|
||||
"/wd4702",
|
||||
],
|
||||
)
|
||||
# Set up the SSL/TLS includes
|
||||
if 'NSS_BUILD_PLATFORM' in env['ENV']:
|
||||
SSL_INCLUDES = [
|
||||
"third_party/mozilla/dist/public/nss",
|
||||
"third_party/mozilla/dist/" + env['ENV']['NSS_BUILD_PLATFORM']+ "/include"
|
||||
]
|
||||
SSL_LIBS = [
|
||||
"ssl3",
|
||||
"nss3",
|
||||
"nssutil3",
|
||||
"plc4",
|
||||
"plds4",
|
||||
"nspr4",
|
||||
]
|
||||
else:
|
||||
SSL_INCLUDES = ["third_party/openssl/include"]
|
||||
SSL_LIBS = ["crypto", "ssl"]
|
||||
|
||||
talk.Library(env, name = "jingle",
|
||||
lin_packages = [
|
||||
"x11",
|
||||
"xcomposite",
|
||||
"xrender",
|
||||
],
|
||||
lin_srcs = [
|
||||
"base/latebindingsymboltable.cc",
|
||||
"base/latebindingsymboltable.h.def",
|
||||
"base/latebindingsymboltable.cc.def",
|
||||
"base/linux.cc",
|
||||
"base/linuxfdwalk.c",
|
||||
"base/linuxwindowpicker.cc",
|
||||
"media/devices/libudevsymboltable.cc",
|
||||
"media/devices/linuxdeviceinfo.cc",
|
||||
"media/devices/linuxdevicemanager.cc",
|
||||
"media/devices/v4llookup.cc",
|
||||
"sound/alsasoundsystem.cc",
|
||||
"sound/alsasymboltable.cc",
|
||||
"sound/linuxsoundsystem.cc",
|
||||
"sound/pulseaudiosoundsystem.cc",
|
||||
"sound/pulseaudiosymboltable.cc",
|
||||
],
|
||||
dependent_target_settings = {
|
||||
'lin_libs': [
|
||||
"dl",
|
||||
"pthread",
|
||||
"rt",
|
||||
"gthread-2.0",
|
||||
],
|
||||
'mac_libs': SSL_LIBS,
|
||||
'win_libs': [
|
||||
"winmm.lib",
|
||||
],
|
||||
},
|
||||
mac_srcs = [
|
||||
"base/macasyncsocket.cc",
|
||||
"base/maccocoasocketserver.mm",
|
||||
"base/maccocoathreadhelper.mm",
|
||||
"base/macconversion.cc",
|
||||
"base/macsocketserver.cc",
|
||||
"base/macutils.cc",
|
||||
"base/macwindowpicker.cc",
|
||||
"base/scoped_autorelease_pool.mm",
|
||||
"media/devices/carbonvideorenderer.cc",
|
||||
"media/devices/macdeviceinfo.cc",
|
||||
"media/devices/macdevicemanager.cc",
|
||||
"media/devices/macdevicemanagermm.mm",
|
||||
],
|
||||
posix_srcs = [
|
||||
"base/unixfilesystem.cc",
|
||||
"base/posix.cc",
|
||||
],
|
||||
linphone_srcs = [
|
||||
"media/other/linphonemediaengine.cc",
|
||||
],
|
||||
cppdefines = [
|
||||
"FEATURE_ENABLE_VOICEMAIL",
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
"XML_STATIC",
|
||||
],
|
||||
srcs = [
|
||||
"base/asyncfile.cc",
|
||||
"base/asynchttprequest.cc",
|
||||
"base/asyncinvoker.cc",
|
||||
"base/asyncsocket.cc",
|
||||
"base/asynctcpsocket.cc",
|
||||
"base/asyncudpsocket.cc",
|
||||
"base/autodetectproxy.cc",
|
||||
"base/bandwidthsmoother.cc",
|
||||
"base/base64.cc",
|
||||
"base/basicpacketsocketfactory.cc",
|
||||
"base/bytebuffer.cc",
|
||||
"base/checks.cc",
|
||||
"base/common.cc",
|
||||
"base/cpumonitor.cc",
|
||||
"base/crc32.cc",
|
||||
"base/diskcache.cc",
|
||||
"base/event.cc",
|
||||
"base/filelock.cc",
|
||||
"base/fileutils.cc",
|
||||
"base/firewallsocketserver.cc",
|
||||
"base/flags.cc",
|
||||
"base/helpers.cc",
|
||||
"base/host.cc",
|
||||
"base/httpbase.cc",
|
||||
"base/httpclient.cc",
|
||||
"base/httpcommon.cc",
|
||||
"base/httprequest.cc",
|
||||
"base/httpserver.cc",
|
||||
"base/ipaddress.cc",
|
||||
"base/logging.cc",
|
||||
"base/md5.cc",
|
||||
"base/messagedigest.cc",
|
||||
"base/messagehandler.cc",
|
||||
"base/messagequeue.cc",
|
||||
"base/multipart.cc",
|
||||
"base/natserver.cc",
|
||||
"base/natsocketfactory.cc",
|
||||
"base/nattypes.cc",
|
||||
"base/nethelpers.cc",
|
||||
"base/network.cc",
|
||||
"base/nssidentity.cc",
|
||||
"base/nssstreamadapter.cc",
|
||||
"base/openssladapter.cc",
|
||||
"base/openssldigest.cc",
|
||||
"base/opensslidentity.cc",
|
||||
"base/opensslstreamadapter.cc",
|
||||
"base/optionsfile.cc",
|
||||
"base/pathutils.cc",
|
||||
"base/physicalsocketserver.cc",
|
||||
"base/profiler.cc",
|
||||
"base/proxydetect.cc",
|
||||
"base/proxyinfo.cc",
|
||||
"base/proxyserver.cc",
|
||||
"base/ratelimiter.cc",
|
||||
"base/ratetracker.cc",
|
||||
"base/sha1.cc",
|
||||
"base/sharedexclusivelock.cc",
|
||||
"base/signalthread.cc",
|
||||
"base/socketadapters.cc",
|
||||
"base/socketaddress.cc",
|
||||
"base/socketaddresspair.cc",
|
||||
"base/socketpool.cc",
|
||||
"base/socketstream.cc",
|
||||
"base/ssladapter.cc",
|
||||
"base/sslsocketfactory.cc",
|
||||
"base/sslidentity.cc",
|
||||
"base/sslstreamadapter.cc",
|
||||
"base/sslstreamadapterhelper.cc",
|
||||
"base/stream.cc",
|
||||
"base/stringencode.cc",
|
||||
"base/stringutils.cc",
|
||||
"base/systeminfo.cc",
|
||||
"base/task.cc",
|
||||
"base/taskparent.cc",
|
||||
"base/taskrunner.cc",
|
||||
"base/testclient.cc",
|
||||
"base/thread.cc",
|
||||
"base/timeutils.cc",
|
||||
"base/timing.cc",
|
||||
"base/transformadapter.cc",
|
||||
"base/urlencode.cc",
|
||||
"base/versionparsing.cc",
|
||||
"base/virtualsocketserver.cc",
|
||||
"base/worker.cc",
|
||||
"p2p/base/constants.cc",
|
||||
"p2p/base/dtlstransportchannel.cc",
|
||||
"p2p/base/p2ptransport.cc",
|
||||
"p2p/base/p2ptransportchannel.cc",
|
||||
"p2p/base/parsing.cc",
|
||||
"p2p/base/port.cc",
|
||||
"p2p/base/portallocator.cc",
|
||||
"p2p/base/portallocatorsessionproxy.cc",
|
||||
"p2p/base/portproxy.cc",
|
||||
"p2p/base/pseudotcp.cc",
|
||||
"p2p/base/relayport.cc",
|
||||
"p2p/base/relayserver.cc",
|
||||
"p2p/base/rawtransport.cc",
|
||||
"p2p/base/rawtransportchannel.cc",
|
||||
"p2p/base/session.cc",
|
||||
"p2p/base/sessiondescription.cc",
|
||||
"p2p/base/sessionmanager.cc",
|
||||
"p2p/base/sessionmessages.cc",
|
||||
"p2p/base/stun.cc",
|
||||
"p2p/base/stunport.cc",
|
||||
"p2p/base/stunrequest.cc",
|
||||
"p2p/base/stunserver.cc",
|
||||
"p2p/base/tcpport.cc",
|
||||
"p2p/base/transport.cc",
|
||||
"p2p/base/transportchannel.cc",
|
||||
"p2p/base/transportchannelproxy.cc",
|
||||
"p2p/base/transportdescriptionfactory.cc",
|
||||
"p2p/base/turnport.cc",
|
||||
"p2p/base/turnserver.cc",
|
||||
"p2p/client/basicportallocator.cc",
|
||||
"p2p/client/connectivitychecker.cc",
|
||||
"p2p/client/httpportallocator.cc",
|
||||
"p2p/client/socketmonitor.cc",
|
||||
"session/tunnel/pseudotcpchannel.cc",
|
||||
"session/tunnel/tunnelsessionclient.cc",
|
||||
"session/tunnel/securetunnelsessionclient.cc",
|
||||
"media/base/capturemanager.cc",
|
||||
"media/base/capturerenderadapter.cc",
|
||||
"media/base/codec.cc",
|
||||
"media/base/constants.cc",
|
||||
"media/base/cpuid.cc",
|
||||
"media/base/filemediaengine.cc",
|
||||
"media/base/hybridvideoengine.cc",
|
||||
"media/base/mediaengine.cc",
|
||||
"media/base/rtpdataengine.cc",
|
||||
"media/base/rtpdump.cc",
|
||||
"media/base/rtputils.cc",
|
||||
"media/base/streamparams.cc",
|
||||
"media/base/videoadapter.cc",
|
||||
"media/base/videocapturer.cc",
|
||||
"media/base/mutedvideocapturer.cc",
|
||||
"media/base/videocommon.cc",
|
||||
"media/base/videoframe.cc",
|
||||
"media/devices/devicemanager.cc",
|
||||
"media/devices/filevideocapturer.cc",
|
||||
"session/media/audiomonitor.cc",
|
||||
"session/media/call.cc",
|
||||
"session/media/channel.cc",
|
||||
"session/media/channelmanager.cc",
|
||||
"session/media/currentspeakermonitor.cc",
|
||||
"session/media/mediamessages.cc",
|
||||
"session/media/mediamonitor.cc",
|
||||
"session/media/mediarecorder.cc",
|
||||
"session/media/mediasession.cc",
|
||||
"session/media/mediasessionclient.cc",
|
||||
"session/media/rtcpmuxfilter.cc",
|
||||
"session/media/rtcpmuxfilter.cc",
|
||||
"session/media/soundclip.cc",
|
||||
"session/media/srtpfilter.cc",
|
||||
"session/media/ssrcmuxfilter.cc",
|
||||
"session/media/typingmonitor.cc",
|
||||
"sound/nullsoundsystem.cc",
|
||||
"sound/nullsoundsystemfactory.cc",
|
||||
"sound/platformsoundsystem.cc",
|
||||
"sound/platformsoundsystemfactory.cc",
|
||||
"sound/soundsysteminterface.cc",
|
||||
"sound/soundsystemproxy.cc",
|
||||
"xmllite/qname.cc",
|
||||
"xmllite/xmlbuilder.cc",
|
||||
"xmllite/xmlconstants.cc",
|
||||
"xmllite/xmlelement.cc",
|
||||
"xmllite/xmlnsstack.cc",
|
||||
"xmllite/xmlparser.cc",
|
||||
"xmllite/xmlprinter.cc",
|
||||
"xmpp/chatroommoduleimpl.cc",
|
||||
"xmpp/constants.cc",
|
||||
"xmpp/discoitemsquerytask.cc",
|
||||
"xmpp/hangoutpubsubclient.cc",
|
||||
"xmpp/iqtask.cc",
|
||||
"xmpp/jid.cc",
|
||||
"xmpp/jingleinfotask.cc",
|
||||
"xmpp/moduleimpl.cc",
|
||||
"xmpp/mucroomconfigtask.cc",
|
||||
"xmpp/mucroomdiscoverytask.cc",
|
||||
"xmpp/mucroomlookuptask.cc",
|
||||
"xmpp/mucroomuniquehangoutidtask.cc",
|
||||
"xmpp/pingtask.cc",
|
||||
"xmpp/presenceouttask.cc",
|
||||
"xmpp/presencereceivetask.cc",
|
||||
"xmpp/presencestatus.cc",
|
||||
"xmpp/pubsubclient.cc",
|
||||
"xmpp/pubsub_task.cc",
|
||||
"xmpp/pubsubtasks.cc",
|
||||
"xmpp/receivetask.cc",
|
||||
"xmpp/rostermoduleimpl.cc",
|
||||
"xmpp/saslmechanism.cc",
|
||||
"xmpp/xmppclient.cc",
|
||||
"xmpp/xmppengineimpl.cc",
|
||||
"xmpp/xmppengineimpl_iq.cc",
|
||||
"xmpp/xmpplogintask.cc",
|
||||
"xmpp/xmppstanzaparser.cc",
|
||||
"xmpp/xmpptask.cc",
|
||||
"xmpp/xmppauth.cc",
|
||||
"xmpp/xmpppump.cc",
|
||||
"xmpp/xmppsocket.cc",
|
||||
"xmpp/xmppthread.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"third_party/libudev",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"testing/gtest/include",
|
||||
"third_party/srtp/include",
|
||||
"third_party/srtp/crypto/include",
|
||||
] + SSL_INCLUDES,
|
||||
win_srcs = [
|
||||
"base/diskcache_win32.cc",
|
||||
"base/schanneladapter.cc",
|
||||
"base/win32.cc",
|
||||
"base/win32regkey.cc",
|
||||
"base/win32filesystem.cc",
|
||||
"base/win32securityerrors.cc",
|
||||
"base/win32socketserver.cc",
|
||||
"base/win32socketinit.cc",
|
||||
"base/win32window.cc",
|
||||
"base/win32windowpicker.cc",
|
||||
"base/winfirewall.cc",
|
||||
"base/winping.cc",
|
||||
"media/devices/gdivideorenderer.cc",
|
||||
"media/devices/win32deviceinfo.cc",
|
||||
"media/devices/win32devicemanager.cc",
|
||||
],
|
||||
mac_ccflags = [
|
||||
"-Wno-deprecated-declarations",
|
||||
],
|
||||
extra_srcs = [
|
||||
"media/devices/dummydevicemanager.cc",
|
||||
"base/dbus.cc",
|
||||
"base/libdbusglibsymboltable.cc",
|
||||
"base/json.cc",
|
||||
"base/natserver_main.cc",
|
||||
],
|
||||
)
|
||||
talk.Library(env, name = "videorenderer",
|
||||
lin_srcs = [
|
||||
"media/devices/gtkvideorenderer.cc",
|
||||
],
|
||||
lin_packages = [
|
||||
"gobject-2.0",
|
||||
"gthread-2.0",
|
||||
"gtk+-2.0",
|
||||
],
|
||||
)
|
||||
talk.Library(env, name = "unittest_main",
|
||||
libs = [
|
||||
"gunit",
|
||||
],
|
||||
srcs = [
|
||||
"base/unittest_main.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
)
|
||||
talk.App(env, name = "login",
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
],
|
||||
srcs = [
|
||||
"examples/login/login_main.cc",
|
||||
],
|
||||
posix_libs = SSL_LIBS,
|
||||
lin_libs = [
|
||||
"videorenderer",
|
||||
],
|
||||
)
|
||||
talk.App(env, name = "chat",
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
],
|
||||
srcs = [
|
||||
"examples/chat/chatapp.cc",
|
||||
"examples/chat/chat_main.cc",
|
||||
"examples/chat/consoletask.cc",
|
||||
"examples/chat/textchatreceivetask.cc",
|
||||
"examples/chat/textchatsendtask.cc",
|
||||
],
|
||||
posix_libs = SSL_LIBS,
|
||||
)
|
||||
talk.App(env, name = "call",
|
||||
mac_frameworks = [
|
||||
"AudioToolbox",
|
||||
"AudioUnit",
|
||||
"Cocoa",
|
||||
"CoreAudio",
|
||||
"CoreFoundation",
|
||||
"IOKit",
|
||||
"QTKit",
|
||||
"QuickTime",
|
||||
],
|
||||
win_libs = [
|
||||
"d3d9.lib",
|
||||
"gdi32.lib",
|
||||
"powrprof.lib",
|
||||
"strmiids.lib",
|
||||
"winmm.lib",
|
||||
],
|
||||
posix_libs = SSL_LIBS,
|
||||
lin_libs = [
|
||||
"videorenderer",
|
||||
],
|
||||
srcs = [
|
||||
"examples/call/call_main.cc",
|
||||
"examples/call/callclient.cc",
|
||||
"examples/call/console.cc",
|
||||
"examples/call/friendinvitesendtask.cc",
|
||||
"examples/call/mediaenginefactory.cc",
|
||||
"examples/call/mucinviterecvtask.cc",
|
||||
"examples/call/mucinvitesendtask.cc",
|
||||
"examples/call/presencepushtask.cc",
|
||||
],
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
"srtp",
|
||||
],
|
||||
)
|
||||
talk.App(env, name = "relayserver",
|
||||
libs = [
|
||||
"jingle",
|
||||
],
|
||||
srcs = [
|
||||
"examples/relayserver/relayserver_main.cc",
|
||||
],
|
||||
)
|
||||
talk.App(env, name = "stunserver",
|
||||
libs = [
|
||||
"jingle",
|
||||
],
|
||||
srcs = [
|
||||
"examples/stunserver/stunserver_main.cc",
|
||||
],
|
||||
)
|
||||
talk.App(env, name = "turnserver",
|
||||
lin_libs = [
|
||||
"crypto",
|
||||
"ssl",
|
||||
],
|
||||
srcs = [
|
||||
"examples/turnserver/turnserver_main.cc",
|
||||
],
|
||||
libs = [
|
||||
"jingle",
|
||||
],
|
||||
)
|
||||
talk.Unittest(env, name = "base",
|
||||
lin_srcs = [
|
||||
"base/latebindingsymboltable_unittest.cc",
|
||||
"base/linux_unittest.cc",
|
||||
"base/linuxfdwalk_unittest.cc",
|
||||
],
|
||||
mac_srcs = [
|
||||
"base/macsocketserver_unittest.cc",
|
||||
"base/macutils_unittest.cc",
|
||||
"base/macwindowpicker_unittest.cc",
|
||||
],
|
||||
posix_srcs = [
|
||||
"base/sslidentity_unittest.cc",
|
||||
"base/sslstreamadapter_unittest.cc",
|
||||
],
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
srcs = [
|
||||
"base/asynchttprequest_unittest.cc",
|
||||
"base/atomicops_unittest.cc",
|
||||
"base/autodetectproxy_unittest.cc",
|
||||
"base/bandwidthsmoother_unittest.cc",
|
||||
"base/base64_unittest.cc",
|
||||
"base/basictypes_unittest.cc",
|
||||
"base/bind_unittest.cc",
|
||||
"base/buffer_unittest.cc",
|
||||
"base/bytebuffer_unittest.cc",
|
||||
"base/byteorder_unittest.cc",
|
||||
"base/callback_unittest.cc",
|
||||
"base/cpumonitor_unittest.cc",
|
||||
"base/crc32_unittest.cc",
|
||||
"base/criticalsection_unittest.cc",
|
||||
"base/event_unittest.cc",
|
||||
"base/filelock_unittest.cc",
|
||||
"base/fileutils_unittest.cc",
|
||||
"base/helpers_unittest.cc",
|
||||
"base/host_unittest.cc",
|
||||
"base/httpbase_unittest.cc",
|
||||
"base/httpcommon_unittest.cc",
|
||||
"base/httpserver_unittest.cc",
|
||||
"base/ipaddress_unittest.cc",
|
||||
"base/logging_unittest.cc",
|
||||
"base/md5digest_unittest.cc",
|
||||
"base/messagedigest_unittest.cc",
|
||||
"base/messagequeue_unittest.cc",
|
||||
"base/multipart_unittest.cc",
|
||||
"base/nat_unittest.cc",
|
||||
"base/network_unittest.cc",
|
||||
"base/nullsocketserver_unittest.cc",
|
||||
"base/optionsfile_unittest.cc",
|
||||
"base/pathutils_unittest.cc",
|
||||
"base/physicalsocketserver_unittest.cc",
|
||||
"base/profiler_unittest.cc",
|
||||
"base/proxy_unittest.cc",
|
||||
"base/proxydetect_unittest.cc",
|
||||
"base/ratelimiter_unittest.cc",
|
||||
"base/ratetracker_unittest.cc",
|
||||
"base/referencecountedsingletonfactory_unittest.cc",
|
||||
"base/rollingaccumulator_unittest.cc",
|
||||
"base/scopedptrcollection_unittest.cc",
|
||||
"base/sha1digest_unittest.cc",
|
||||
"base/sharedexclusivelock_unittest.cc",
|
||||
"base/signalthread_unittest.cc",
|
||||
"base/sigslot_unittest.cc",
|
||||
"base/socket_unittest.cc",
|
||||
"base/socketaddress_unittest.cc",
|
||||
"base/stream_unittest.cc",
|
||||
"base/stringencode_unittest.cc",
|
||||
"base/stringutils_unittest.cc",
|
||||
"base/systeminfo_unittest.cc",
|
||||
"base/task_unittest.cc",
|
||||
"base/testclient_unittest.cc",
|
||||
"base/thread_unittest.cc",
|
||||
"base/timeutils_unittest.cc",
|
||||
"base/urlencode_unittest.cc",
|
||||
"base/versionparsing_unittest.cc",
|
||||
"base/virtualsocket_unittest.cc",
|
||||
"base/windowpicker_unittest.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
win_srcs = [
|
||||
"base/win32_unittest.cc",
|
||||
"base/win32regkey_unittest.cc",
|
||||
"base/win32socketserver_unittest.cc",
|
||||
"base/win32toolhelp_unittest.cc",
|
||||
"base/win32window_unittest.cc",
|
||||
"base/win32windowpicker_unittest.cc",
|
||||
"base/winfirewall_unittest.cc",
|
||||
],
|
||||
libs = [
|
||||
"jingle",
|
||||
],
|
||||
extra_srcs = [
|
||||
"base/dbus_unittest.cc",
|
||||
"base/json_unittest.cc",
|
||||
"base/linuxwindowpicker_unittest.cc",
|
||||
],
|
||||
)
|
||||
talk.Unittest(env, name = "p2p",
|
||||
mac_FRAMEWORKS = [
|
||||
"Foundation",
|
||||
"IOKit",
|
||||
"QTKit",
|
||||
],
|
||||
mac_libs = SSL_LIBS,
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
srcs = [
|
||||
"p2p/base/dtlstransportchannel_unittest.cc",
|
||||
"p2p/base/p2ptransportchannel_unittest.cc",
|
||||
"p2p/base/port_unittest.cc",
|
||||
"p2p/base/portallocatorsessionproxy_unittest.cc",
|
||||
"p2p/base/pseudotcp_unittest.cc",
|
||||
"p2p/base/relayport_unittest.cc",
|
||||
"p2p/base/relayserver_unittest.cc",
|
||||
"p2p/base/session_unittest.cc",
|
||||
"p2p/base/stun_unittest.cc",
|
||||
"p2p/base/stunport_unittest.cc",
|
||||
"p2p/base/stunrequest_unittest.cc",
|
||||
"p2p/base/stunserver_unittest.cc",
|
||||
"p2p/base/transport_unittest.cc",
|
||||
"p2p/base/transportdescriptionfactory_unittest.cc",
|
||||
"p2p/base/turnport_unittest.cc",
|
||||
"p2p/client/connectivitychecker_unittest.cc",
|
||||
"p2p/client/portallocator_unittest.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
],
|
||||
)
|
||||
talk.Unittest(env, name = "media",
|
||||
win_libs = [
|
||||
"winmm.lib",
|
||||
"strmiids",
|
||||
],
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
srcs = [
|
||||
"media/base/capturemanager_unittest.cc",
|
||||
"media/base/codec_unittest.cc",
|
||||
"media/base/filemediaengine_unittest.cc",
|
||||
"media/base/rtpdataengine_unittest.cc",
|
||||
"media/base/rtpdump_unittest.cc",
|
||||
"media/base/rtputils_unittest.cc",
|
||||
"media/base/testutils.cc",
|
||||
"media/base/videocapturer_unittest.cc",
|
||||
"media/base/videocommon_unittest.cc",
|
||||
"media/devices/devicemanager_unittest.cc",
|
||||
"media/devices/filevideocapturer_unittest.cc",
|
||||
"media/sctp/sctputils_unittest.cc",
|
||||
"session/media/channel_unittest.cc",
|
||||
"session/media/channelmanager_unittest.cc",
|
||||
"session/media/currentspeakermonitor_unittest.cc",
|
||||
"session/media/mediarecorder_unittest.cc",
|
||||
"session/media/mediamessages_unittest.cc",
|
||||
"session/media/mediasession_unittest.cc",
|
||||
"session/media/mediasessionclient_unittest.cc",
|
||||
"session/media/rtcpmuxfilter_unittest.cc",
|
||||
"session/media/srtpfilter_unittest.cc",
|
||||
"session/media/ssrcmuxfilter_unittest.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
"srtp",
|
||||
],
|
||||
extra_srcs = [
|
||||
"media/devices/dummydevicemanager_unittest.cc",
|
||||
],
|
||||
)
|
||||
talk.Unittest(env, name = "sound",
|
||||
libs = [
|
||||
"jingle",
|
||||
],
|
||||
srcs = [
|
||||
"sound/automaticallychosensoundsystem_unittest.cc",
|
||||
],
|
||||
mac_libs = SSL_LIBS,
|
||||
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
)
|
||||
talk.Unittest(env, name = "xmllite",
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
],
|
||||
srcs = [
|
||||
"xmllite/qname_unittest.cc",
|
||||
"xmllite/xmlbuilder_unittest.cc",
|
||||
"xmllite/xmlelement_unittest.cc",
|
||||
"xmllite/xmlnsstack_unittest.cc",
|
||||
"xmllite/xmlparser_unittest.cc",
|
||||
"xmllite/xmlprinter_unittest.cc",
|
||||
],
|
||||
mac_libs = SSL_LIBS,
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
)
|
||||
talk.Unittest(env, name = "xmpp",
|
||||
mac_libs = SSL_LIBS,
|
||||
cppdefines = [
|
||||
"EXPAT_RELATIVE_PATH",
|
||||
"GTEST_RELATIVE_PATH",
|
||||
"SRTP_RELATIVE_PATH",
|
||||
],
|
||||
srcs = [
|
||||
"xmpp/hangoutpubsubclient_unittest.cc",
|
||||
"xmpp/jid_unittest.cc",
|
||||
"xmpp/mucroomconfigtask_unittest.cc",
|
||||
"xmpp/mucroomdiscoverytask_unittest.cc",
|
||||
"xmpp/mucroomlookuptask_unittest.cc",
|
||||
"xmpp/mucroomuniquehangoutidtask_unittest.cc",
|
||||
"xmpp/pingtask_unittest.cc",
|
||||
"xmpp/pubsubclient_unittest.cc",
|
||||
"xmpp/pubsubtasks_unittest.cc",
|
||||
"xmpp/util_unittest.cc",
|
||||
"xmpp/xmppengine_unittest.cc",
|
||||
"xmpp/xmpplogintask_unittest.cc",
|
||||
"xmpp/xmppstanzaparser_unittest.cc",
|
||||
],
|
||||
includedirs = [
|
||||
"testing/gtest/include",
|
||||
"third_party/expat-2.0.1/lib",
|
||||
"third_party/srtp",
|
||||
"testing/gtest",
|
||||
],
|
||||
libs = [
|
||||
"jingle",
|
||||
"expat",
|
||||
],
|
||||
extra_srcs = [
|
||||
"xmpp/chatroommodule_unittest.cc",
|
||||
"xmpp/rostermodule_unittest.cc",
|
||||
],
|
||||
)
|
889
talk/main.scons
889
talk/main.scons
@ -1,889 +0,0 @@
|
||||
# -*- Python -*-
|
||||
#
|
||||
#
|
||||
# All the helper functions are defined in:
|
||||
# - site_scons/talk.py
|
||||
# Use 'import talk' in any .scons file to get access to it.
|
||||
# Add any new helper functions to it; unittest are available
|
||||
# in talk_unittest.py.
|
||||
#
|
||||
# Each 'component' that is built is defined in a .scons file.
|
||||
# See talk.Components(...) for further info on file naming convention.
|
||||
#
|
||||
# To add a new platform clone and modify the root_env object. Remember to add
|
||||
# the new environment object to the envs list otherwise it will not be included
|
||||
# in the build.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
import talk
|
||||
import os
|
||||
import platform
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# The build files/directories to 'build'.
|
||||
# If the name is the name of a directory then that directory shall contain a
|
||||
# .scons file with the same name as the directory itself:
|
||||
# Ex: The directory session/phone contains a file called phone.scons
|
||||
# This list must be in order of library dependencies. e.g., if
|
||||
# session/phone/phone.scons defines a target that links to a library target
|
||||
# defined in sound/sound.scons, then 'sound' must come first.
|
||||
# When no particular order is imposed by library dependencies, try to keep in
|
||||
# mostly alphabetical order.
|
||||
#
|
||||
components = talk.Components("libjingle.scons")
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Build environments
|
||||
#
|
||||
|
||||
# The list of build environments.
|
||||
envs = []
|
||||
|
||||
# The root of all builds.
|
||||
root_env = Environment(
|
||||
tools = [
|
||||
'component_bits',
|
||||
'component_setup',
|
||||
'replace_strings',
|
||||
'talk_noops',
|
||||
#'talk_utils',
|
||||
],
|
||||
BUILD_SCONSCRIPTS = components,
|
||||
DESTINATION_ROOT = '$MAIN_DIR/build',
|
||||
CPPPATH = [
|
||||
'$OBJ_ROOT', # generated headers are relative to here
|
||||
'$MAIN_DIR/..', # TODO(dape): how can we use GOOGLECLIENT instead?
|
||||
],
|
||||
CPPDEFINES = [
|
||||
'LOGGING=1',
|
||||
|
||||
# Feature selection
|
||||
'FEATURE_ENABLE_SSL',
|
||||
'FEATURE_ENABLE_VOICEMAIL',
|
||||
'FEATURE_ENABLE_PSTN',
|
||||
'HAVE_SRTP',
|
||||
],
|
||||
# Ensure the os environment is captured for any scripts we call out to
|
||||
ENV = os.environ,
|
||||
)
|
||||
|
||||
# This is where we set common environments
|
||||
#
|
||||
# Detect if building on 64-bit or 32-bit platform.
|
||||
DeclareBit('build_platform_64bit', 'Platform of the build machine is 64-bit')
|
||||
if platform.architecture()[0] == "64bit":
|
||||
root_env.SetBits('build_platform_64bit')
|
||||
|
||||
# This bit denotes that an env is for 64-bit builds. When set, all build
|
||||
# artifacts will be 64-bit. When unset, all build artifacts will be 32-bit.
|
||||
DeclareBit('host_platform_64bit',
|
||||
'Platform of the host machine (where artifacts will execute) is '
|
||||
'64-bit')
|
||||
|
||||
# This bit denotes that we are cross-compiling using a sysroot.
|
||||
DeclareBit('cross_compile',
|
||||
'Cross compiling using the SYSROOT environment variable')
|
||||
|
||||
def CrossArch(env):
|
||||
"""Return whether or not the host platform architecture differs from the build
|
||||
environment architecture."""
|
||||
if env.Bit('cross_compile'):
|
||||
# The architecture of the Python process may not match the architecture of
|
||||
# the sysroot, so we just assume it's not a cross-arch build or that it
|
||||
# doesn't matter. Currently it only matters if you try to build a cross-arch
|
||||
# Debian package, so just don't do that.
|
||||
return False
|
||||
else:
|
||||
return env.Bit('host_platform_64bit') != env.Bit('build_platform_64bit')
|
||||
root_env.AddMethod(CrossArch)
|
||||
|
||||
DeclareBit('use_static_openssl', 'Build OpenSSL as a static library')
|
||||
|
||||
DeclareBit('have_dbus_glib',
|
||||
'Whether the build system has the dbus-glib-1 package')
|
||||
DeclareBit('have_libpulse',
|
||||
'Whether the build system has the libpulse package')
|
||||
|
||||
|
||||
# List all the locales we localize to.
|
||||
root_env.AppendUnique(locales = [
|
||||
'af', 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en', 'en-GB',
|
||||
'es', 'es-419', 'et', 'eu', 'fa', 'fi', 'fil', 'fr', 'fr-CA', 'gl', 'gu',
|
||||
'hi', 'hr', 'hu', 'id', 'is', 'it', 'iw', 'ja', 'kn', 'ko', 'lt', 'lv',
|
||||
'ml', 'mr', 'ms', 'nl', 'no', 'or', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
|
||||
'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tl', 'tr', 'uk', 'ur',
|
||||
'vi', 'zh-CN', 'zh-HK', 'zh-TW', 'zu'])
|
||||
|
||||
AddTargetGroup('all_breakpads', 'breakpad files can be built')
|
||||
|
||||
AddTargetGroup('all_dsym', 'dsym debug packages can be built')
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# W I N D O W S
|
||||
#
|
||||
win_env = root_env.Clone(
|
||||
tools = [
|
||||
'atlmfc_vc80',
|
||||
#'code_signing',
|
||||
'component_targets_msvs',
|
||||
'directx_9_0_c',
|
||||
#'grid_builder',
|
||||
'midl',
|
||||
'target_platform_windows'
|
||||
],
|
||||
# Don't use default vc80 midl.exe. It doesn't understand vista_sdk idl files.
|
||||
MIDL = '$PLATFORM_SDK_VISTA_6_0_DIR/Bin/midl.exe ',
|
||||
WIX_DIR = '$GOOGLECLIENT/third_party/wix/v3_0_2925/files',
|
||||
# Flags for debug and optimization are added to CCFLAGS instead
|
||||
CCPDBFLAGS = '',
|
||||
CCFLAGS_DEBUG = '',
|
||||
CCFLAGS_OPTIMIZED = '',
|
||||
# We force a x86 target even when building on x64 Windows platforms.
|
||||
TARGET_ARCH = 'x86',
|
||||
)
|
||||
|
||||
|
||||
win_env.Decider('MD5-timestamp')
|
||||
win_env.Append(
|
||||
COMPONENT_LIBRARY_PUBLISH = True, # Put dlls in output dir too
|
||||
CCFLAGS = [
|
||||
'/Fd${TARGET}.pdb', # pdb per object allows --jobs=
|
||||
'/WX', # warnings are errors
|
||||
'/Zc:forScope', # handle 'for (int i = 0 ...)' right
|
||||
'/EHs-c-', # disable C++ EH
|
||||
'/GR-', # disable RTTI
|
||||
'/Gy', # enable function level linking
|
||||
'/wd4996', # ignore POSIX deprecated warnings
|
||||
|
||||
# promote certain level 4 warnings
|
||||
'/w14701', # potentially uninitialized var
|
||||
'/w14702', # unreachable code
|
||||
'/w14706', # assignment within a conditional
|
||||
'/w14709', # comma operator within array index
|
||||
'/w14063', # case 'identifier' is not a valid value for switch of enum
|
||||
'/w14064', # switch of incomplete enum 'enumeration'
|
||||
'/w14057', # 'identifier1' indirection to slightly different base
|
||||
# types from 'identifier2'
|
||||
'/w14263', # member function does not override any base class virtual
|
||||
# member function
|
||||
'/w14266', # no override available for virtual memberfunction from base
|
||||
# 'type'; function is hidden
|
||||
'/w14296', # expression is always false
|
||||
'/w14355', # 'this' : used in base member initializer list
|
||||
],
|
||||
CPPDEFINES = [
|
||||
'_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
|
||||
# TODO(dape): encapsulate all string operations that are not based
|
||||
# on std::string/std::wstring and make sure we use the safest versions
|
||||
# available on all platforms.
|
||||
'_CRT_SECURE_NO_WARNINGS',
|
||||
'_USE_32BIT_TIME_T',
|
||||
'_UNICODE',
|
||||
'UNICODE',
|
||||
'_HAS_EXCEPTIONS=0',
|
||||
'WIN32',
|
||||
# TODO(dape): remove this from logging.cc and enable here instead.
|
||||
#'WIN32_LEAN_AND_MEAN',
|
||||
|
||||
'WINVER=0x0500',
|
||||
'_WIN32_WINNT=0x0501',
|
||||
'_WIN32_IE=0x0501',
|
||||
# The Vista platform SDK 6.0 needs at least
|
||||
# this NTDDI version or else the headers
|
||||
# that LMI includes from it won't compile.
|
||||
'NTDDI_VERSION=NTDDI_WINXP',
|
||||
|
||||
# npapi.h requires the following:
|
||||
'_WINDOWS',
|
||||
],
|
||||
CPPPATH = [
|
||||
'$THIRD_PARTY/wtl_71/include',
|
||||
'$PLATFORM_SDK_VISTA_6_0_DIR/Include',
|
||||
],
|
||||
LIBPATH = [
|
||||
'$PLATFORM_SDK_VISTA_6_0_DIR/Lib'
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-manifest', # TODO(thaloun): Why do we need this?
|
||||
# Some of the third-party libraries we link in don't have public symbols, so
|
||||
# ignore that linker warning.
|
||||
'/ignore:4221',
|
||||
'/nxcompat', # Binary was tested to be be compatible with Windows DEP.
|
||||
'/dynamicbase', # Use ASLR to dynamically rebase at load-time.
|
||||
'/fixed:no', # Binary can be loaded at any base-address.
|
||||
],
|
||||
MIDLFLAGS = [
|
||||
'/win32',
|
||||
'/I$PLATFORM_SDK_VISTA_6_0_DIR/include'
|
||||
]
|
||||
)
|
||||
|
||||
# TODO(dape): Figure out what this does; found it in
|
||||
# omaha/main.scons. This fixes the problem with redefinition
|
||||
# of OS_WINDOWS symbol.
|
||||
win_env.FilterOut(CPPDEFINES = ['OS_WINDOWS=OS_WINDOWS'])
|
||||
|
||||
# Set up digital signing
|
||||
DeclareBit('test_signing', 'Sign binaries with the test certificate')
|
||||
win_env.SetBitFromOption('test_signing', False)
|
||||
if win_env.Bit('test_signing'):
|
||||
win_env.Replace(
|
||||
CERTIFICATE_PATH = win_env.File(
|
||||
'$GOOGLECLIENT/tools/test_key/testkey.pfx').abspath,
|
||||
CERTIFICATE_PASSWORD = 'test',
|
||||
)
|
||||
AddTargetGroup('signed_binaries', 'digitally signed binaries can be built')
|
||||
|
||||
win_dbg_env = win_env.Clone(
|
||||
BUILD_TYPE = 'dbg',
|
||||
BUILD_TYPE_DESCRIPTION = 'Windows debug build',
|
||||
BUILD_GROUPS = ['default', 'all'],
|
||||
tools = ['target_debug'],
|
||||
)
|
||||
|
||||
win_dbg_env.Prepend(
|
||||
CCFLAGS = [
|
||||
'/ZI', # enable debugging
|
||||
'/Od', # disable optimizations
|
||||
'/MTd', # link with LIBCMTD.LIB debug lib
|
||||
'/RTC1', # enable runtime checks
|
||||
],
|
||||
)
|
||||
|
||||
envs.append(win_dbg_env)
|
||||
|
||||
win_dbg64_env = win_dbg_env.Clone(
|
||||
BUILD_TYPE = 'dbg64',
|
||||
BUILD_TYPE_DESCRIPTION = 'Windows debug 64bit build',
|
||||
BUILD_GROUPS = ['all'],
|
||||
)
|
||||
|
||||
win_dbg64_env.FilterOut(CCFLAGS = ['/ZI'])
|
||||
|
||||
win_dbg64_env.Append(
|
||||
CCFLAGS = [
|
||||
'/Zi', # enable debugging that is 64 bit compatible.
|
||||
# TODO(fbarchard): fix warnings and remove these disables.
|
||||
'/wd4244', # disable cast warning
|
||||
'/wd4267', # disable cast warning
|
||||
],
|
||||
ARFLAGS = [
|
||||
'/MACHINE:x64',
|
||||
],
|
||||
CPPDEFINES = [
|
||||
'WIN64',
|
||||
'ARCH_CPU_64_BITS',
|
||||
],
|
||||
LIBFLAGS = [
|
||||
'/MACHINE:x64',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'/MACHINE:x64',
|
||||
],
|
||||
)
|
||||
|
||||
win_dbg64_env.FilterOut(CPPDEFINES = ['_USE_32BIT_TIME_T'])
|
||||
|
||||
win_dbg64_env.Prepend(
|
||||
LIBPATH = [
|
||||
'$VC80_DIR/vc/lib/amd64',
|
||||
'$ATLMFC_VC80_DIR/lib/amd64',
|
||||
'$PLATFORM_SDK_VISTA_6_0_DIR/Lib/x64',
|
||||
],
|
||||
)
|
||||
win_dbg64_env.PrependENVPath(
|
||||
'PATH',
|
||||
win_dbg64_env.Dir('$VC80_DIR/vc/bin/x86_amd64'))
|
||||
|
||||
win_dbg64_env.SetBits('host_platform_64bit')
|
||||
|
||||
envs.append(win_dbg64_env)
|
||||
|
||||
win_coverage_env = win_dbg_env.Clone(
|
||||
tools = ['code_coverage'],
|
||||
BUILD_TYPE = 'coverage',
|
||||
BUILD_TYPE_DESCRIPTION = 'Windows code coverage build',
|
||||
BUILD_GROUPS = ['all'],
|
||||
)
|
||||
|
||||
win_coverage_env.Append(
|
||||
CPPDEFINES = [
|
||||
'COVERAGE_ENABLED',
|
||||
],
|
||||
)
|
||||
|
||||
envs.append(win_coverage_env)
|
||||
|
||||
win_opt_env = win_env.Clone(
|
||||
BUILD_TYPE = 'opt',
|
||||
BUILD_TYPE_DESCRIPTION = 'Windows opt build',
|
||||
BUILD_GROUPS = ['all'],
|
||||
tools = ['target_optimized'],
|
||||
)
|
||||
|
||||
win_opt_env.Prepend(
|
||||
CCFLAGS=[
|
||||
'/Zi', # enable debugging
|
||||
'/O1', # optimize for size
|
||||
'/fp:fast', # float faster but less precise
|
||||
'/MT', # link with LIBCMT.LIB (multi-threaded, static linked crt)
|
||||
'/GS', # enable security checks
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'/safeseh', # protect against attacks against exception handlers
|
||||
'/opt:ref', # Remove unused references (functions/data).
|
||||
],
|
||||
)
|
||||
|
||||
envs.append(win_opt_env)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# P O S I X
|
||||
#
|
||||
posix_env = root_env.Clone()
|
||||
posix_env.Append(
|
||||
CPPDEFINES = [
|
||||
'HASHNAMESPACE=__gnu_cxx',
|
||||
'HASH_NAMESPACE=__gnu_cxx',
|
||||
'POSIX',
|
||||
'DISABLE_DYNAMIC_CAST',
|
||||
# The POSIX standard says we have to define this.
|
||||
'_REENTRANT',
|
||||
],
|
||||
CCFLAGS = [
|
||||
'-Wall',
|
||||
'-Werror',
|
||||
'-Wno-switch',
|
||||
'-fno-exceptions',
|
||||
# Needed for a clean ABI and for link-time dead-code removal to work
|
||||
# properly.
|
||||
'-fvisibility=hidden',
|
||||
# Generate debugging info in the DWARF2 format.
|
||||
'-gdwarf-2',
|
||||
# Generate maximal debugging information. (It is stripped from what we ship
|
||||
# to users, so we want it for both dbg and opt.)
|
||||
# Note that hammer automatically supplies "-g" for mac/linux dbg, so that
|
||||
# flag must be filtered out of linux_dbg and mac_dbg envs below.
|
||||
'-g3',
|
||||
],
|
||||
CXXFLAGS = [
|
||||
'-Wno-non-virtual-dtor',
|
||||
'-Wno-ctor-dtor-privacy',
|
||||
'-fno-rtti',
|
||||
],
|
||||
)
|
||||
|
||||
# Switch-hit between NSS and OpenSSL
|
||||
if 'NSS_BUILD_PLATFORM' in root_env['ENV']:
|
||||
posix_env.AppendUnique(CPPDEFINES=['HAVE_NSS_SSL_H=1',
|
||||
'NSS_SSL_RELATIVE_PATH'])
|
||||
else:
|
||||
posix_env.AppendUnique(CPPDEFINES=['HAVE_OPENSSL_SSL_H=1'])
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# M A C OSX
|
||||
#
|
||||
mac_env = posix_env.Clone(
|
||||
tools = [
|
||||
'target_platform_mac',
|
||||
#'talk_mac',
|
||||
#'fill_plist',
|
||||
],
|
||||
)
|
||||
# Use static OpenSSL on mac so that we can use the latest APIs on all
|
||||
# supported mac platforms (10.5+).
|
||||
mac_env.SetBits('use_static_openssl')
|
||||
|
||||
# For libjingle we don't specify a sysroot or minimum OS version.
|
||||
mac_osx_version_min_32 = ""
|
||||
mac_osx_version_min_64 = ""
|
||||
|
||||
# Generic mac environment common to all targets
|
||||
mac_env.Append(
|
||||
CPPDEFINES = [
|
||||
'OSX',
|
||||
],
|
||||
CCFLAGS = [
|
||||
'-arch', 'i386',
|
||||
'-fasm-blocks',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-Wl,-search_paths_first',
|
||||
# This flag makes all members of a static library be included in the
|
||||
# final exe - that increases the size of the exe, but without it
|
||||
# Obj-C categories aren't properly included in the exe.
|
||||
# TODO(thaloun): consider only defining for libs that actually have objc.
|
||||
'-ObjC',
|
||||
'-arch', 'i386',
|
||||
'-dead_strip',
|
||||
],
|
||||
FRAMEWORKS = [
|
||||
'CoreServices',
|
||||
'Security',
|
||||
'SystemConfiguration',
|
||||
'OpenGL',
|
||||
'CoreAudio',
|
||||
'Quartz',
|
||||
'Cocoa',
|
||||
'QTKit',
|
||||
]
|
||||
)
|
||||
|
||||
if 'NSS_BUILD_PLATFORM' in root_env['ENV']:
|
||||
mac_env.AppendUnique(LINKFLAGS = ['-Lthird_party/mozilla/dist/' + root_env['ENV']['NSS_BUILD_PLATFORM'] + '/lib'])
|
||||
else:
|
||||
mac_env.AppendUnique(LINKFLAGS = ['-Lthird_party/openssl'])
|
||||
|
||||
|
||||
# add debug flags to environment
|
||||
def mac_debug_include(env):
|
||||
env.Append(
|
||||
CCFLAGS = [
|
||||
'-O0',
|
||||
],
|
||||
CPPDEFINES = [
|
||||
'DEBUG=1',
|
||||
],
|
||||
)
|
||||
# Remove -g set by hammer, which is not what we want (we have set -g3 above).
|
||||
env.FilterOut(CCFLAGS = ['-g'])
|
||||
|
||||
# add 32/64 bit specific options to specified environment
|
||||
def mac_common_include_x86_32(env):
|
||||
env.Append(
|
||||
CCFLAGS = [
|
||||
'-m32',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-m32',
|
||||
],
|
||||
FRAMEWORKS = [
|
||||
'Carbon',
|
||||
'QuickTime',
|
||||
],
|
||||
)
|
||||
envs.append(env)
|
||||
|
||||
def mac_common_include_x86_64(env):
|
||||
env.Append(
|
||||
CCFLAGS = [
|
||||
'-m64',
|
||||
'-fPIC',
|
||||
],
|
||||
CPPDEFINES = [
|
||||
'ARCH_CPU_64_BITS',
|
||||
'CARBON_DEPRECATED',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-m64',
|
||||
],
|
||||
FRAMEWORKS = [
|
||||
'AppKit',
|
||||
],
|
||||
)
|
||||
env.SetBits('host_platform_64bit')
|
||||
envs.append(env)
|
||||
|
||||
def mac_osx_version_min(env, ver):
|
||||
if ver != "":
|
||||
sdk_path = '/Developer/SDKs/MacOSX%s.sdk' % ver
|
||||
env.Append(
|
||||
CCFLAGS = [
|
||||
'-mmacosx-version-min=' + ver,
|
||||
'-isysroot', sdk_path,
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-mmacosx-version-min=' + ver,
|
||||
'-isysroot', sdk_path,
|
||||
],
|
||||
osx_sdk_path = sdk_path,
|
||||
osx_version_min = ver,
|
||||
)
|
||||
|
||||
# Create all environments
|
||||
mac_dbg_env = mac_env.Clone(
|
||||
BUILD_TYPE = 'dbg',
|
||||
BUILD_TYPE_DESCRIPTION = 'Mac debug build',
|
||||
BUILD_GROUPS = ['default', 'all'],
|
||||
tools = ['target_debug'],
|
||||
)
|
||||
|
||||
mac_opt_env = mac_env.Clone(
|
||||
BUILD_TYPE = 'opt',
|
||||
BUILD_TYPE_DESCRIPTION = 'Mac opt build',
|
||||
BUILD_GROUPS = ['all'],
|
||||
tools = ['target_optimized'],
|
||||
)
|
||||
|
||||
mac_dbg64_env = mac_dbg_env.Clone(
|
||||
BUILD_TYPE = 'dbg64',
|
||||
BUILD_TYPE_DESCRIPTION = 'Mac debug 64bit build',
|
||||
BUILD_GROUPS = ['all'],
|
||||
)
|
||||
|
||||
mac_opt64_env = mac_opt_env.Clone(
|
||||
BUILD_TYPE = 'opt64',
|
||||
BUILD_TYPE_DESCRIPTION = 'Mac opt 64bit build',
|
||||
BUILD_GROUPS = ['all'],
|
||||
)
|
||||
|
||||
mac_debug_include(mac_dbg_env)
|
||||
mac_debug_include(mac_dbg64_env)
|
||||
mac_common_include_x86_32(mac_dbg_env)
|
||||
mac_common_include_x86_32(mac_opt_env)
|
||||
mac_common_include_x86_64(mac_dbg64_env)
|
||||
mac_common_include_x86_64(mac_opt64_env)
|
||||
mac_osx_version_min(mac_dbg_env, mac_osx_version_min_32)
|
||||
mac_osx_version_min(mac_opt_env, mac_osx_version_min_32)
|
||||
mac_osx_version_min(mac_dbg64_env, mac_osx_version_min_64)
|
||||
mac_osx_version_min(mac_opt64_env, mac_osx_version_min_64)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# L I N U X
|
||||
#
|
||||
linux_common_env = posix_env.Clone(
|
||||
tools = [
|
||||
'target_platform_linux',
|
||||
'talk_linux',
|
||||
],
|
||||
)
|
||||
|
||||
linux_common_env.Append(
|
||||
CPPDEFINES = [
|
||||
'LINUX',
|
||||
],
|
||||
CCFLAGS = [
|
||||
# Needed for link-time dead-code removal to work properly.
|
||||
'-ffunction-sections',
|
||||
'-fdata-sections',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
# Enable dead-code removal.
|
||||
'-Wl,--gc-sections',
|
||||
# Elide dependencies on shared libraries that we're not actually using.
|
||||
'-Wl,--as-needed',
|
||||
'-Wl,--start-group',
|
||||
],
|
||||
_LIBFLAGS = ['-Wl,--end-group'],
|
||||
)
|
||||
|
||||
# Remove default rpath set by Hammer. Hammer sets it to LIB_DIR, which is wrong.
|
||||
# The rpath is the _run-time_ library search path for the resulting binary, i.e.
|
||||
# the one used by ld.so at load time. Setting it equal to the path to build
|
||||
# output on the build machine is nonsense.
|
||||
linux_common_env.Replace(
|
||||
RPATH = [],
|
||||
)
|
||||
|
||||
# Enable the optional DBus-GLib code if the build machine has the required
|
||||
# dependency.
|
||||
linux_common_env.EnableFeatureWherePackagePresent('have_dbus_glib',
|
||||
'HAVE_DBUS_GLIB',
|
||||
'dbus-glib-1')
|
||||
|
||||
def linux_common_include_x86_32(env):
|
||||
"""Include x86-32 settings into an env based on linux_common."""
|
||||
env.Append(
|
||||
CCFLAGS = [
|
||||
'-m32',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-m32',
|
||||
],
|
||||
)
|
||||
|
||||
def linux_common_include_x86_64(env):
|
||||
"""Include x86-64 settings into an env based on linux_common."""
|
||||
env.Append(
|
||||
CCFLAGS = [
|
||||
'-m64',
|
||||
'-fPIC',
|
||||
],
|
||||
LINKFLAGS = [
|
||||
'-m64',
|
||||
],
|
||||
)
|
||||
env.SetBits('host_platform_64bit')
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# L I N U X -- C R O S S -- B U I L D
|
||||
|
||||
# Cross build requires the following tool names be provided by the environment:
|
||||
linux_cross_common_env = linux_common_env.Clone(
|
||||
AR = os.environ.get("AR"),
|
||||
AS = os.environ.get("AS"),
|
||||
LD = os.environ.get("LD"),
|
||||
NM = os.environ.get("NM"),
|
||||
RANLIB = os.environ.get("RANLIB"),
|
||||
CC = str(os.environ.get("CC")) +
|
||||
' --sysroot=' + str(os.environ.get("SYSROOT")),
|
||||
CXX = str(os.environ.get("CXX")) +
|
||||
' --sysroot=' + str(os.environ.get("SYSROOT")),
|
||||
)
|
||||
linux_cross_common_env.SetBits('cross_compile')
|
||||
|
||||
# The rest of these paths and flags are optional:
|
||||
if os.environ.get("CPPPATH"):
|
||||
linux_cross_common_env.Append(
|
||||
CPPPATH = os.environ.get("CPPPATH").split(':'),
|
||||
)
|
||||
if os.environ.get("LIBPATH"):
|
||||
linux_cross_common_env.Append(
|
||||
LIBPATH = os.environ.get("LIBPATH").split(':'),
|
||||
)
|
||||
if os.environ.get("CFLAGS"):
|
||||
linux_cross_common_env.Append(
|
||||
CFLAGS = os.environ.get("CFLAGS").split(' '),
|
||||
)
|
||||
if os.environ.get("CCFLAGS"):
|
||||
linux_cross_common_env.Append(
|
||||
CCFLAGS = os.environ.get("CCFLAGS").split(' '),
|
||||
)
|
||||
if os.environ.get("CXXFLAGS"):
|
||||
linux_cross_common_env.Append(
|
||||
CXXFLAGS = os.environ.get("CXXFLAGS").split(' '),
|
||||
)
|
||||
if os.environ.get("LIBFLAGS"):
|
||||
linux_cross_common_env.Append(
|
||||
_LIBFLAGS = os.environ.get("LIBFLAGS").split(' '),
|
||||
)
|
||||
if os.environ.get("LINKFLAGS"):
|
||||
linux_cross_common_env.Prepend(
|
||||
LINKFLAGS = os.environ.get("LINKFLAGS").split(' '),
|
||||
)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# L I N U X -- T R A D I T I O N A L -- X 8 6
|
||||
#
|
||||
# Settings that are specific to our desktop Linux x86 targets.
|
||||
def linux_common_include_traditional(env):
|
||||
"""Include traditional Linux settings into an env based on linux_common."""
|
||||
# OpenSSL has infamously poor ABI stability, so that building against one
|
||||
# version and running against a different one often will not work. Since our
|
||||
# non-ChromeOS Linux builds are used on many different distros and distro
|
||||
# versions, this means we can't safely dynamically link to OpenSSL because the
|
||||
# product would end up being broken on any computer with a different version
|
||||
# installed. So instead we build it ourself and statically link to it.
|
||||
env.SetBits('use_static_openssl')
|
||||
# Enable the optional PulseAudio code if the build machine has the required
|
||||
# dependency.
|
||||
# TODO(?): This belongs in linux_common_env, but we can't safely move it there
|
||||
# yet because pkg-config is not being used properly with ChromeOS builds (see
|
||||
# TODO below).
|
||||
env.EnableFeatureWherePackagePresent('have_libpulse',
|
||||
'HAVE_LIBPULSE',
|
||||
'libpulse')
|
||||
|
||||
def linux_traditional_include_dbg(env):
|
||||
"""Include traditional Linux dbg settings into an env based on the above."""
|
||||
# Remove -g set by hammer, which is not what we want (we have set -g3 above).
|
||||
env.FilterOut(CCFLAGS = ['-g'])
|
||||
|
||||
def linux_traditional_include_opt(env):
|
||||
"""Include traditional Linux opt settings into an env based on the above."""
|
||||
# Remove -O2 set by hammer, which is not what we want.
|
||||
env.FilterOut(CCFLAGS = ['-O2'])
|
||||
env.Append(CCFLAGS = ['-Os'])
|
||||
|
||||
def gen_linux_nonhermetic(linux_env, type_suffix, desc_suffix):
|
||||
groups = ['nonhermetic']
|
||||
if not linux_env.CrossArch():
|
||||
groups = groups + ['nonhermetic-native']
|
||||
# The non-hermetic, native-arch dbg build is the default.
|
||||
dbg_groups = groups + ['default']
|
||||
native_desc = ', native '
|
||||
# No suffix for native modes.
|
||||
type_suffix = ''
|
||||
else:
|
||||
groups = groups + ['nonhermetic-cross']
|
||||
dbg_groups = groups
|
||||
native_desc = ', cross-built for '
|
||||
|
||||
linux_dbg_env = linux_env.Clone(
|
||||
BUILD_TYPE = 'dbg' + type_suffix,
|
||||
BUILD_TYPE_DESCRIPTION = 'Linux debug build%s%s' % (native_desc,
|
||||
desc_suffix),
|
||||
BUILD_GROUPS = dbg_groups,
|
||||
tools = ['target_debug'],
|
||||
)
|
||||
linux_traditional_include_dbg(linux_dbg_env)
|
||||
envs.append(linux_dbg_env)
|
||||
|
||||
linux_opt_env = linux_env.Clone(
|
||||
BUILD_TYPE = 'opt' + type_suffix,
|
||||
BUILD_TYPE_DESCRIPTION = 'Linux optimized build%s%s' % (native_desc,
|
||||
desc_suffix),
|
||||
BUILD_GROUPS = groups,
|
||||
tools = ['target_optimized'],
|
||||
)
|
||||
linux_traditional_include_opt(linux_opt_env)
|
||||
envs.append(linux_opt_env)
|
||||
|
||||
linux_nonhermetic_common_env = linux_common_env.Clone()
|
||||
linux_common_include_traditional(linux_nonhermetic_common_env)
|
||||
|
||||
linux_nonhermetic_x86_32_env = linux_nonhermetic_common_env.Clone()
|
||||
linux_common_include_x86_32(linux_nonhermetic_x86_32_env)
|
||||
gen_linux_nonhermetic(linux_nonhermetic_x86_32_env, '32', '32-bit')
|
||||
|
||||
linux_nonhermetic_x86_64_env = linux_nonhermetic_common_env.Clone()
|
||||
linux_common_include_x86_64(linux_nonhermetic_x86_64_env)
|
||||
gen_linux_nonhermetic(linux_nonhermetic_x86_64_env, '64', '64-bit')
|
||||
|
||||
def gen_linux_hermetic(linux_env, type_suffix, desc):
|
||||
groups = ['hermetic']
|
||||
|
||||
linux_dbg_env = linux_env.Clone(
|
||||
BUILD_TYPE = 'hermetic-dbg' + type_suffix,
|
||||
BUILD_TYPE_DESCRIPTION = 'Hermetic %s Linux debug build' % desc,
|
||||
BUILD_GROUPS = groups,
|
||||
tools = ['target_debug'],
|
||||
)
|
||||
linux_traditional_include_dbg(linux_dbg_env)
|
||||
envs.append(linux_dbg_env)
|
||||
|
||||
linux_opt_env = linux_env.Clone(
|
||||
BUILD_TYPE = 'hermetic-opt' + type_suffix,
|
||||
BUILD_TYPE_DESCRIPTION = 'Hermetic %s Linux optimized build' % desc,
|
||||
BUILD_GROUPS = groups,
|
||||
tools = ['target_optimized'],
|
||||
)
|
||||
linux_traditional_include_opt(linux_opt_env)
|
||||
envs.append(linux_opt_env)
|
||||
|
||||
linux_hermetic_common_env = linux_cross_common_env.Clone()
|
||||
linux_common_include_traditional(linux_hermetic_common_env)
|
||||
|
||||
linux_hermetic_x86_32_env = linux_hermetic_common_env.Clone()
|
||||
linux_common_include_x86_32(linux_hermetic_x86_32_env)
|
||||
gen_linux_hermetic(linux_hermetic_x86_32_env, '32', '32-bit')
|
||||
|
||||
linux_hermetic_x86_64_env = linux_hermetic_common_env.Clone()
|
||||
linux_common_include_x86_64(linux_hermetic_x86_64_env)
|
||||
gen_linux_hermetic(linux_hermetic_x86_64_env, '64', '64-bit')
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# L I N U X -- C R O S S -- B U I L D -- A R M
|
||||
|
||||
# TODO(noahric): All the following Linux builds are running against a sysroot
|
||||
# but improperly using the host machine's pkg-config environment. The ChromeOS
|
||||
# ones should probably be using
|
||||
# https://cs.corp.google.com/#chrome/src/build/linux/pkg-config-wrapper.
|
||||
|
||||
linux_cross_arm_env = linux_cross_common_env.Clone()
|
||||
linux_cross_arm_env.Append(
|
||||
CPPDEFINES = [
|
||||
'NACL_BUILD_ARCH=arm',
|
||||
'DISABLE_EFFECTS=1',
|
||||
],
|
||||
CCFLAGS = [
|
||||
'-fPIC',
|
||||
],
|
||||
)
|
||||
DeclareBit('arm', 'ARM build')
|
||||
linux_cross_arm_env.SetBits('arm')
|
||||
|
||||
# Detect NEON support from the -mfpu build flag.
|
||||
DeclareBit('arm_neon', 'ARM supporting neon')
|
||||
if '-mfpu=neon' in linux_cross_arm_env['CFLAGS'] or \
|
||||
'-mfpu=neon' in linux_cross_arm_env['CCFLAGS'] or \
|
||||
'-mfpu=neon' in linux_cross_arm_env['CXXFLAGS']:
|
||||
print "Building with ARM NEON support."
|
||||
linux_cross_arm_env.SetBits('arm_neon')
|
||||
|
||||
# Detect hardfp from the -mfloat-abi build flag
|
||||
DeclareBit('arm_hardfp', 'ARM supporting hardfp')
|
||||
if '-mfloat-abi=hard' in linux_cross_arm_env['CFLAGS'] or \
|
||||
'-mfloat-abi=hard' in linux_cross_arm_env['CCFLAGS'] or \
|
||||
'-mfloat-abi=hard' in linux_cross_arm_env['CXXFLAGS']:
|
||||
print "Building with hard floating point support."
|
||||
linux_cross_arm_env.SetBits('arm_hardfp')
|
||||
|
||||
linux_cross_arm_dbg_env = linux_cross_arm_env.Clone(
|
||||
BUILD_TYPE = 'arm-dbg',
|
||||
BUILD_TYPE_DESCRIPTION = 'Cross-compiled ARM debug build',
|
||||
BUILD_GROUPS = ['arm'],
|
||||
tools = ['target_debug'],
|
||||
)
|
||||
envs.append(linux_cross_arm_dbg_env)
|
||||
|
||||
linux_cross_arm_opt_env = linux_cross_arm_env.Clone(
|
||||
BUILD_TYPE = 'arm-opt',
|
||||
BUILD_TYPE_DESCRIPTION = 'Cross-compiled ARM optimized build',
|
||||
BUILD_GROUPS = ['arm'],
|
||||
tools = ['target_optimized'],
|
||||
)
|
||||
envs.append(linux_cross_arm_opt_env)
|
||||
|
||||
|
||||
|
||||
# Create a group for installers
|
||||
AddTargetGroup('all_installers', 'installers that can be built')
|
||||
|
||||
# Parse child .scons files
|
||||
BuildEnvironments(envs)
|
||||
|
||||
# Explicitly set which targets to build when not stated on commandline
|
||||
Default(None)
|
||||
# Build the following, which excludes unit test output (ie running them)
|
||||
# To run unittests, specify the test to run, or run_all_tests. See -h option.
|
||||
Default(['all_libraries', 'all_programs', 'all_test_programs'])
|
||||
|
||||
# .sln creation code lifted from googleclient/bar/main.scons. Must be after
|
||||
# the call to BuildEnvironments for all_foo aliases to be defined.
|
||||
# Run 'hammer --mode=all --vsproj' to generate
|
||||
DeclareBit('vsproj', 'Generate Visual Studio projects and solution files.')
|
||||
win_env.SetBitFromOption('vsproj', False)
|
||||
|
||||
if win_env.Bit('vsproj'):
|
||||
vs_env = win_env.Clone()
|
||||
vs_env.Append(
|
||||
COMPONENT_VS_SOURCE_SUFFIXES = [
|
||||
'.def',
|
||||
'.grd',
|
||||
'.html',
|
||||
'.idl',
|
||||
'.mk',
|
||||
'.txt',
|
||||
'.py',
|
||||
'.scons',
|
||||
'.wxs.template',
|
||||
]
|
||||
)
|
||||
|
||||
# Source project
|
||||
p = vs_env.ComponentVSDirProject(
|
||||
'flute_source',
|
||||
['$MAIN_DIR',
|
||||
],
|
||||
COMPONENT_VS_SOURCE_FOLDERS = [
|
||||
# Files are assigned to first matching folder. Folder names of None
|
||||
# are filters.
|
||||
(None, '$DESTINATION_ROOT'),
|
||||
('flute', '$MAIN_DIR'),
|
||||
('google3', '$GOOGLE3'),
|
||||
('third_party', '$THIRD_PARTY'),
|
||||
],
|
||||
# Force source project to main dir, so that Visual Studio can find the
|
||||
# source files corresponding to build errors.
|
||||
COMPONENT_VS_PROJECT_DIR = '$MAIN_DIR',
|
||||
)
|
||||
vs_env.AlwaysBuild(p)
|
||||
|
||||
# Solution and target projects
|
||||
s = vs_env.ComponentVSSolution(
|
||||
# 'libjingle', # Please uncomment this line if you build VS proj files.
|
||||
['all_libraries', 'all_programs', 'all_test_programs'],
|
||||
projects = [p],
|
||||
)
|
||||
|
||||
print '***Unfortunately the vsproj creator isn\'t smart enough to '
|
||||
print '***automatically get the correct output locations. It is very easy'
|
||||
print '***though to change it in the properties pane to the following'
|
||||
print '***$(SolutionDir)/build/<foo>/staging/<bar>.exe'
|
||||
Default(None)
|
||||
Default([s])
|
486
talk/media/base/hybridvideoengine_unittest.cc
Normal file
486
talk/media/base/hybridvideoengine_unittest.cc
Normal file
@ -0,0 +1,486 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2004 Google Inc.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "talk/base/gunit.h"
|
||||
#include "talk/media/base/fakemediaengine.h"
|
||||
#include "talk/media/base/fakenetworkinterface.h"
|
||||
#include "talk/media/base/fakevideocapturer.h"
|
||||
#include "talk/media/base/hybridvideoengine.h"
|
||||
#include "talk/media/base/mediachannel.h"
|
||||
#include "talk/media/base/testutils.h"
|
||||
|
||||
static const cricket::VideoCodec kGenericCodec(97, "Generic", 640, 360, 30, 0);
|
||||
static const cricket::VideoCodec kVp8Codec(100, "VP8", 640, 360, 30, 0);
|
||||
static const cricket::VideoCodec kCodecsVp8Only[] = { kVp8Codec };
|
||||
static const cricket::VideoCodec kCodecsGenericOnly[] = { kGenericCodec };
|
||||
static const cricket::VideoCodec kCodecsVp8First[] = { kVp8Codec,
|
||||
kGenericCodec };
|
||||
static const cricket::VideoCodec kCodecsGenericFirst[] = { kGenericCodec,
|
||||
kVp8Codec };
|
||||
|
||||
using cricket::StreamParams;
|
||||
|
||||
class FakeVp8VideoEngine : public cricket::FakeVideoEngine {
|
||||
public:
|
||||
FakeVp8VideoEngine() {
|
||||
SetCodecs(MAKE_VECTOR(kCodecsVp8Only));
|
||||
}
|
||||
};
|
||||
class FakeGenericVideoEngine : public cricket::FakeVideoEngine {
|
||||
public:
|
||||
FakeGenericVideoEngine() {
|
||||
SetCodecs(MAKE_VECTOR(kCodecsGenericOnly));
|
||||
}
|
||||
|
||||
// For testing purposes, mimic the behavior of a media engine that throws out
|
||||
// resolutions that don't match the codec list. A width or height of 0
|
||||
// trivially will never match the codec list, so this is sufficient for
|
||||
// testing the case we want (0x0).
|
||||
virtual bool FindCodec(const cricket::VideoCodec& codec) {
|
||||
if (codec.width == 0 || codec.height == 0) {
|
||||
return false;
|
||||
} else {
|
||||
return cricket::FakeVideoEngine::FindCodec(codec);
|
||||
}
|
||||
}
|
||||
};
|
||||
class HybridVideoEngineForTest : public cricket::HybridVideoEngine<
|
||||
FakeVp8VideoEngine, FakeGenericVideoEngine> {
|
||||
public:
|
||||
HybridVideoEngineForTest()
|
||||
:
|
||||
num_ch1_send_on_(0),
|
||||
num_ch1_send_off_(0),
|
||||
send_width_(0),
|
||||
send_height_(0) { }
|
||||
cricket::FakeVideoEngine* sub_engine1() { return &video1_; }
|
||||
cricket::FakeVideoEngine* sub_engine2() { return &video2_; }
|
||||
|
||||
// From base class HybridVideoEngine.
|
||||
void OnSendChange1(cricket::VideoMediaChannel* channel1, bool send) {
|
||||
if (send) {
|
||||
++num_ch1_send_on_;
|
||||
} else {
|
||||
++num_ch1_send_off_;
|
||||
}
|
||||
}
|
||||
// From base class HybridVideoEngine
|
||||
void OnNewSendResolution(int width, int height) {
|
||||
send_width_ = width;
|
||||
send_height_ = height;
|
||||
}
|
||||
|
||||
int num_ch1_send_on() const { return num_ch1_send_on_; }
|
||||
int num_ch1_send_off() const { return num_ch1_send_off_; }
|
||||
|
||||
int send_width() const { return send_width_; }
|
||||
int send_height() const { return send_height_; }
|
||||
|
||||
private:
|
||||
int num_ch1_send_on_;
|
||||
int num_ch1_send_off_;
|
||||
|
||||
int send_width_;
|
||||
int send_height_;
|
||||
};
|
||||
|
||||
class HybridVideoEngineTest : public testing::Test {
|
||||
public:
|
||||
HybridVideoEngineTest() : sub_channel1_(NULL), sub_channel2_(NULL) {
|
||||
}
|
||||
~HybridVideoEngineTest() {
|
||||
engine_.Terminate();
|
||||
}
|
||||
bool SetupEngine() {
|
||||
bool result = engine_.Init(talk_base::Thread::Current());
|
||||
if (result) {
|
||||
channel_.reset(engine_.CreateChannel(NULL));
|
||||
result = (channel_.get() != NULL);
|
||||
sub_channel1_ = engine_.sub_engine1()->GetChannel(0);
|
||||
sub_channel2_ = engine_.sub_engine2()->GetChannel(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
bool SetupRenderAndAddStream(const StreamParams& sp) {
|
||||
if (!SetupEngine())
|
||||
return false;
|
||||
channel_->SetInterface(transport_.get());
|
||||
return channel_->SetRecvCodecs(engine_.codecs()) &&
|
||||
channel_->AddSendStream(sp) &&
|
||||
channel_->SetRender(true);
|
||||
}
|
||||
void DeliverPacket(const void* data, int len) {
|
||||
talk_base::Buffer packet(data, len);
|
||||
channel_->OnPacketReceived(&packet, talk_base::CreatePacketTime(0));
|
||||
}
|
||||
void DeliverRtcp(const void* data, int len) {
|
||||
talk_base::Buffer packet(data, len);
|
||||
channel_->OnRtcpReceived(&packet, talk_base::CreatePacketTime(0));
|
||||
}
|
||||
|
||||
protected:
|
||||
void TestSetSendCodecs(cricket::FakeVideoEngine* sub_engine,
|
||||
const std::vector<cricket::VideoCodec>& codecs) {
|
||||
EXPECT_TRUE(SetupRenderAndAddStream(StreamParams::CreateLegacy(1234)));
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||
cricket::FakeVideoMediaChannel* sub_channel = sub_engine->GetChannel(0);
|
||||
ASSERT_EQ(1U, sub_channel->send_codecs().size());
|
||||
EXPECT_EQ(codecs[0], sub_channel->send_codecs()[0]);
|
||||
EXPECT_TRUE(channel_->SetSend(true));
|
||||
EXPECT_TRUE(sub_channel->sending());
|
||||
}
|
||||
void TestSetSendBandwidth(cricket::FakeVideoEngine* sub_engine,
|
||||
const std::vector<cricket::VideoCodec>& codecs,
|
||||
int start_bitrate,
|
||||
int max_bitrate) {
|
||||
EXPECT_TRUE(SetupRenderAndAddStream(StreamParams::CreateLegacy(1234)));
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||
EXPECT_TRUE(channel_->SetStartSendBandwidth(start_bitrate));
|
||||
EXPECT_TRUE(channel_->SetMaxSendBandwidth(max_bitrate));
|
||||
cricket::FakeVideoMediaChannel* sub_channel = sub_engine->GetChannel(0);
|
||||
EXPECT_EQ(start_bitrate, sub_channel->start_bps());
|
||||
EXPECT_EQ(max_bitrate, sub_channel->max_bps());
|
||||
}
|
||||
HybridVideoEngineForTest engine_;
|
||||
talk_base::scoped_ptr<cricket::HybridVideoMediaChannel> channel_;
|
||||
talk_base::scoped_ptr<cricket::FakeNetworkInterface> transport_;
|
||||
cricket::FakeVideoMediaChannel* sub_channel1_;
|
||||
cricket::FakeVideoMediaChannel* sub_channel2_;
|
||||
};
|
||||
|
||||
TEST_F(HybridVideoEngineTest, StartupShutdown) {
|
||||
EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
|
||||
engine_.Terminate();
|
||||
}
|
||||
|
||||
// Tests that SetDefaultVideoEncoderConfig passes down to both engines.
|
||||
TEST_F(HybridVideoEngineTest, SetDefaultVideoEncoderConfig) {
|
||||
cricket::VideoEncoderConfig config(
|
||||
cricket::VideoCodec(105, "", 640, 400, 30, 0), 1, 2);
|
||||
EXPECT_TRUE(engine_.SetDefaultEncoderConfig(config));
|
||||
|
||||
cricket::VideoEncoderConfig config_1 = config;
|
||||
config_1.max_codec.name = kCodecsVp8Only[0].name;
|
||||
EXPECT_EQ(config_1, engine_.sub_engine1()->default_encoder_config());
|
||||
|
||||
cricket::VideoEncoderConfig config_2 = config;
|
||||
config_2.max_codec.name = kCodecsGenericOnly[0].name;
|
||||
EXPECT_EQ(config_2, engine_.sub_engine2()->default_encoder_config());
|
||||
}
|
||||
|
||||
// Tests that GetDefaultVideoEncoderConfig picks a meaningful encoder config
|
||||
// based on the underlying engine config and then after a call to
|
||||
// SetDefaultEncoderConfig on the hybrid engine.
|
||||
TEST_F(HybridVideoEngineTest, SetDefaultVideoEncoderConfigDefaultValue) {
|
||||
cricket::VideoEncoderConfig blank_config;
|
||||
cricket::VideoEncoderConfig meaningful_config1(
|
||||
cricket::VideoCodec(111, "abcd", 320, 240, 30, 0), 1, 2);
|
||||
cricket::VideoEncoderConfig meaningful_config2(
|
||||
cricket::VideoCodec(111, "abcd", 1280, 720, 30, 0), 1, 2);
|
||||
cricket::VideoEncoderConfig meaningful_config3(
|
||||
cricket::VideoCodec(111, "abcd", 640, 360, 30, 0), 1, 2);
|
||||
engine_.sub_engine1()->SetDefaultEncoderConfig(blank_config);
|
||||
engine_.sub_engine2()->SetDefaultEncoderConfig(blank_config);
|
||||
EXPECT_EQ(blank_config, engine_.GetDefaultEncoderConfig());
|
||||
|
||||
engine_.sub_engine2()->SetDefaultEncoderConfig(meaningful_config2);
|
||||
EXPECT_EQ(meaningful_config2, engine_.GetDefaultEncoderConfig());
|
||||
|
||||
engine_.sub_engine1()->SetDefaultEncoderConfig(meaningful_config1);
|
||||
EXPECT_EQ(meaningful_config1, engine_.GetDefaultEncoderConfig());
|
||||
|
||||
EXPECT_TRUE(engine_.SetDefaultEncoderConfig(meaningful_config3));
|
||||
// The overall config should now match, though the codec name will have been
|
||||
// rewritten for the first media engine.
|
||||
meaningful_config3.max_codec.name = kCodecsVp8Only[0].name;
|
||||
EXPECT_EQ(meaningful_config3, engine_.GetDefaultEncoderConfig());
|
||||
}
|
||||
|
||||
// Tests that our engine has the right codecs in the right order.
|
||||
TEST_F(HybridVideoEngineTest, CheckCodecs) {
|
||||
const std::vector<cricket::VideoCodec>& c = engine_.codecs();
|
||||
ASSERT_EQ(2U, c.size());
|
||||
EXPECT_EQ(kVp8Codec, c[0]);
|
||||
EXPECT_EQ(kGenericCodec, c[1]);
|
||||
}
|
||||
|
||||
// Tests that our engine has the right caps.
|
||||
TEST_F(HybridVideoEngineTest, CheckCaps) {
|
||||
EXPECT_EQ(cricket::VIDEO_SEND | cricket::VIDEO_RECV,
|
||||
engine_.GetCapabilities());
|
||||
}
|
||||
|
||||
// Tests that we can create and destroy a channel.
|
||||
TEST_F(HybridVideoEngineTest, CreateChannel) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
EXPECT_TRUE(sub_channel1_ != NULL);
|
||||
EXPECT_TRUE(sub_channel2_ != NULL);
|
||||
}
|
||||
|
||||
// Tests that we properly handle failures in CreateChannel.
|
||||
TEST_F(HybridVideoEngineTest, CreateChannelFail) {
|
||||
engine_.sub_engine1()->set_fail_create_channel(true);
|
||||
EXPECT_FALSE(SetupEngine());
|
||||
EXPECT_TRUE(channel_.get() == NULL);
|
||||
EXPECT_TRUE(sub_channel1_ == NULL);
|
||||
EXPECT_TRUE(sub_channel2_ == NULL);
|
||||
engine_.sub_engine1()->set_fail_create_channel(false);
|
||||
engine_.sub_engine2()->set_fail_create_channel(true);
|
||||
EXPECT_FALSE(SetupEngine());
|
||||
EXPECT_TRUE(channel_.get() == NULL);
|
||||
EXPECT_TRUE(sub_channel1_ == NULL);
|
||||
EXPECT_TRUE(sub_channel2_ == NULL);
|
||||
}
|
||||
|
||||
// Test that we set our inbound codecs and settings properly.
|
||||
TEST_F(HybridVideoEngineTest, SetLocalDescription) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
channel_->SetInterface(transport_.get());
|
||||
EXPECT_TRUE(channel_->SetRecvCodecs(engine_.codecs()));
|
||||
ASSERT_EQ(1U, sub_channel1_->recv_codecs().size());
|
||||
ASSERT_EQ(1U, sub_channel2_->recv_codecs().size());
|
||||
EXPECT_EQ(kVp8Codec, sub_channel1_->recv_codecs()[0]);
|
||||
EXPECT_EQ(kGenericCodec, sub_channel2_->recv_codecs()[0]);
|
||||
StreamParams stream;
|
||||
stream.id = "TestStream";
|
||||
stream.ssrcs.push_back(1234);
|
||||
stream.cname = "5678";
|
||||
EXPECT_TRUE(channel_->AddSendStream(stream));
|
||||
EXPECT_EQ(1234U, sub_channel1_->send_ssrc());
|
||||
EXPECT_EQ(1234U, sub_channel2_->send_ssrc());
|
||||
EXPECT_EQ("5678", sub_channel1_->rtcp_cname());
|
||||
EXPECT_EQ("5678", sub_channel2_->rtcp_cname());
|
||||
EXPECT_TRUE(channel_->SetRender(true));
|
||||
// We've called SetRender, so we should be playing out, but not yet sending.
|
||||
EXPECT_TRUE(sub_channel1_->playout());
|
||||
EXPECT_TRUE(sub_channel2_->playout());
|
||||
EXPECT_FALSE(sub_channel1_->sending());
|
||||
EXPECT_FALSE(sub_channel2_->sending());
|
||||
// We may get SetSend(false) calls during call setup.
|
||||
// Since this causes no change in state, they should no-op and return true.
|
||||
EXPECT_TRUE(channel_->SetSend(false));
|
||||
EXPECT_FALSE(sub_channel1_->sending());
|
||||
EXPECT_FALSE(sub_channel2_->sending());
|
||||
}
|
||||
|
||||
TEST_F(HybridVideoEngineTest, OnNewSendResolution) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsVp8First)));
|
||||
EXPECT_EQ(640, engine_.send_width());
|
||||
EXPECT_EQ(360, engine_.send_height());
|
||||
}
|
||||
|
||||
// Test that we converge to the active channel for engine 1.
|
||||
TEST_F(HybridVideoEngineTest, SetSendCodecs1) {
|
||||
// This will nuke the object that sub_channel2_ points to.
|
||||
TestSetSendCodecs(engine_.sub_engine1(), MAKE_VECTOR(kCodecsVp8First));
|
||||
EXPECT_TRUE(engine_.sub_engine2()->GetChannel(0) == NULL);
|
||||
}
|
||||
|
||||
// Test that we converge to the active channel for engine 2.
|
||||
TEST_F(HybridVideoEngineTest, SetSendCodecs2) {
|
||||
// This will nuke the object that sub_channel1_ points to.
|
||||
TestSetSendCodecs(engine_.sub_engine2(), MAKE_VECTOR(kCodecsGenericFirst));
|
||||
EXPECT_TRUE(engine_.sub_engine1()->GetChannel(0) == NULL);
|
||||
}
|
||||
|
||||
// Test that we don't accidentally eat 0x0 in SetSendCodecs
|
||||
TEST_F(HybridVideoEngineTest, SetSendCodecs0x0) {
|
||||
EXPECT_TRUE(SetupRenderAndAddStream(StreamParams::CreateLegacy(1234)));
|
||||
// Send using generic codec, but with 0x0 resolution.
|
||||
std::vector<cricket::VideoCodec> codecs(MAKE_VECTOR(kCodecsGenericFirst));
|
||||
codecs.resize(1);
|
||||
codecs[0].width = 0;
|
||||
codecs[0].height = 0;
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||
}
|
||||
|
||||
// Test setting the send bandwidth for VP8.
|
||||
TEST_F(HybridVideoEngineTest, SetSendBandwidth1) {
|
||||
TestSetSendBandwidth(engine_.sub_engine1(),
|
||||
MAKE_VECTOR(kCodecsVp8First),
|
||||
100000,
|
||||
384000);
|
||||
}
|
||||
|
||||
// Test setting the send bandwidth for a generic codec.
|
||||
TEST_F(HybridVideoEngineTest, SetSendBandwidth2) {
|
||||
TestSetSendBandwidth(engine_.sub_engine2(),
|
||||
MAKE_VECTOR(kCodecsGenericFirst),
|
||||
100001,
|
||||
384002);
|
||||
}
|
||||
|
||||
// Test that we dump RTP packets that arrive early.
|
||||
TEST_F(HybridVideoEngineTest, HandleEarlyRtp) {
|
||||
static const uint8 kPacket[1024] = { 0 };
|
||||
static const uint8 kRtcp[1024] = { 1 };
|
||||
EXPECT_TRUE(SetupRenderAndAddStream(StreamParams::CreateLegacy(1234)));
|
||||
DeliverPacket(kPacket, sizeof(kPacket));
|
||||
DeliverRtcp(kRtcp, sizeof(kRtcp));
|
||||
EXPECT_TRUE(sub_channel1_->CheckNoRtp());
|
||||
EXPECT_TRUE(sub_channel2_->CheckNoRtp());
|
||||
EXPECT_TRUE(sub_channel1_->CheckNoRtcp());
|
||||
EXPECT_TRUE(sub_channel2_->CheckNoRtcp());
|
||||
}
|
||||
|
||||
// Test that we properly pass on normal RTP packets.
|
||||
TEST_F(HybridVideoEngineTest, HandleRtp) {
|
||||
static const uint8 kPacket[1024] = { 0 };
|
||||
static const uint8 kRtcp[1024] = { 1 };
|
||||
EXPECT_TRUE(SetupRenderAndAddStream(StreamParams::CreateLegacy(1234)));
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsVp8First)));
|
||||
EXPECT_TRUE(channel_->SetSend(true));
|
||||
DeliverPacket(kPacket, sizeof(kPacket));
|
||||
DeliverRtcp(kRtcp, sizeof(kRtcp));
|
||||
EXPECT_TRUE(sub_channel1_->CheckRtp(kPacket, sizeof(kPacket)));
|
||||
EXPECT_TRUE(sub_channel1_->CheckRtcp(kRtcp, sizeof(kRtcp)));
|
||||
}
|
||||
|
||||
// Test that we properly connect media error signal.
|
||||
TEST_F(HybridVideoEngineTest, MediaErrorSignal) {
|
||||
cricket::VideoMediaErrorCatcher catcher;
|
||||
|
||||
// Verify no signal from either channel before the active channel is set.
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
channel_->SignalMediaError.connect(&catcher,
|
||||
&cricket::VideoMediaErrorCatcher::OnError);
|
||||
sub_channel1_->SignalMediaError(1, cricket::VideoMediaChannel::ERROR_OTHER);
|
||||
EXPECT_EQ(0U, catcher.ssrc());
|
||||
sub_channel2_->SignalMediaError(2,
|
||||
cricket::VideoMediaChannel::ERROR_REC_DEVICE_OPEN_FAILED);
|
||||
EXPECT_EQ(0U, catcher.ssrc());
|
||||
|
||||
// Set vp8 as active channel and verify that a signal comes from it.
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsVp8First)));
|
||||
sub_channel1_->SignalMediaError(1, cricket::VideoMediaChannel::ERROR_OTHER);
|
||||
EXPECT_EQ(cricket::VideoMediaChannel::ERROR_OTHER, catcher.error());
|
||||
EXPECT_EQ(1U, catcher.ssrc());
|
||||
|
||||
// Set generic codec as active channel and verify that a signal comes from it.
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
channel_->SignalMediaError.connect(&catcher,
|
||||
&cricket::VideoMediaErrorCatcher::OnError);
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsGenericFirst)));
|
||||
sub_channel2_->SignalMediaError(2,
|
||||
cricket::VideoMediaChannel::ERROR_REC_DEVICE_OPEN_FAILED);
|
||||
EXPECT_EQ(cricket::VideoMediaChannel::ERROR_REC_DEVICE_OPEN_FAILED,
|
||||
catcher.error());
|
||||
EXPECT_EQ(2U, catcher.ssrc());
|
||||
}
|
||||
|
||||
// Test that SetSend doesn't re-enter.
|
||||
TEST_F(HybridVideoEngineTest, RepeatSetSend) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsVp8First)));
|
||||
|
||||
// Verify initial status.
|
||||
EXPECT_FALSE(channel_->sending());
|
||||
EXPECT_FALSE(sub_channel1_->sending());
|
||||
EXPECT_EQ(0, engine_.num_ch1_send_on());
|
||||
EXPECT_EQ(0, engine_.num_ch1_send_off());
|
||||
|
||||
// Verfiy SetSend(true) works correctly.
|
||||
EXPECT_TRUE(channel_->SetSend(true));
|
||||
EXPECT_TRUE(channel_->sending());
|
||||
EXPECT_TRUE(sub_channel1_->sending());
|
||||
EXPECT_EQ(1, engine_.num_ch1_send_on());
|
||||
EXPECT_EQ(0, engine_.num_ch1_send_off());
|
||||
|
||||
// SetSend(true) again and verify nothing changes.
|
||||
EXPECT_TRUE(channel_->SetSend(true));
|
||||
EXPECT_TRUE(channel_->sending());
|
||||
EXPECT_TRUE(sub_channel1_->sending());
|
||||
EXPECT_EQ(1, engine_.num_ch1_send_on());
|
||||
EXPECT_EQ(0, engine_.num_ch1_send_off());
|
||||
|
||||
// Verify SetSend(false) works correctly.
|
||||
EXPECT_TRUE(channel_->SetSend(false));
|
||||
EXPECT_FALSE(channel_->sending());
|
||||
EXPECT_FALSE(sub_channel1_->sending());
|
||||
EXPECT_EQ(1, engine_.num_ch1_send_on());
|
||||
EXPECT_EQ(1, engine_.num_ch1_send_off());
|
||||
|
||||
// SetSend(false) again and verfiy nothing changes.
|
||||
EXPECT_TRUE(channel_->SetSend(false));
|
||||
EXPECT_FALSE(channel_->sending());
|
||||
EXPECT_FALSE(sub_channel1_->sending());
|
||||
EXPECT_EQ(1, engine_.num_ch1_send_on());
|
||||
EXPECT_EQ(1, engine_.num_ch1_send_off());
|
||||
}
|
||||
|
||||
// Test that SetOptions.
|
||||
TEST_F(HybridVideoEngineTest, SetOptions) {
|
||||
cricket::VideoOptions vmo;
|
||||
vmo.video_high_bitrate.Set(true);
|
||||
vmo.system_low_adaptation_threshhold.Set(0.10f);
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
EXPECT_TRUE(channel_->SetOptions(vmo));
|
||||
|
||||
bool high_bitrate;
|
||||
float low;
|
||||
EXPECT_TRUE(sub_channel1_->GetOptions(&vmo));
|
||||
EXPECT_TRUE(vmo.video_high_bitrate.Get(&high_bitrate));
|
||||
EXPECT_TRUE(high_bitrate);
|
||||
EXPECT_TRUE(vmo.system_low_adaptation_threshhold.Get(&low));
|
||||
EXPECT_EQ(0.10f, low);
|
||||
EXPECT_TRUE(sub_channel2_->GetOptions(&vmo));
|
||||
EXPECT_TRUE(vmo.video_high_bitrate.Get(&high_bitrate));
|
||||
EXPECT_TRUE(high_bitrate);
|
||||
EXPECT_TRUE(vmo.system_low_adaptation_threshhold.Get(&low));
|
||||
EXPECT_EQ(0.10f, low);
|
||||
|
||||
vmo.video_high_bitrate.Set(false);
|
||||
vmo.system_low_adaptation_threshhold.Set(0.50f);
|
||||
|
||||
EXPECT_TRUE(channel_->SetOptions(vmo));
|
||||
EXPECT_TRUE(sub_channel1_->GetOptions(&vmo));
|
||||
EXPECT_TRUE(vmo.video_high_bitrate.Get(&high_bitrate));
|
||||
EXPECT_FALSE(high_bitrate);
|
||||
EXPECT_TRUE(vmo.system_low_adaptation_threshhold.Get(&low));
|
||||
EXPECT_EQ(0.50f, low);
|
||||
EXPECT_TRUE(sub_channel2_->GetOptions(&vmo));
|
||||
EXPECT_TRUE(vmo.video_high_bitrate.Get(&high_bitrate));
|
||||
EXPECT_FALSE(high_bitrate);
|
||||
EXPECT_TRUE(vmo.system_low_adaptation_threshhold.Get(&low));
|
||||
EXPECT_EQ(0.50f, low);
|
||||
}
|
||||
|
||||
TEST_F(HybridVideoEngineTest, SetCapturer) {
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
// Set vp8 as active channel and verify that capturer can be set.
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsVp8First)));
|
||||
cricket::FakeVideoCapturer fake_video_capturer;
|
||||
EXPECT_TRUE(channel_->SetCapturer(0, &fake_video_capturer));
|
||||
EXPECT_TRUE(channel_->SetCapturer(0, NULL));
|
||||
|
||||
// Set generic codec active channel and verify that capturer can be set.
|
||||
EXPECT_TRUE(SetupEngine());
|
||||
EXPECT_TRUE(channel_->SetSendCodecs(MAKE_VECTOR(kCodecsGenericFirst)));
|
||||
EXPECT_TRUE(channel_->SetCapturer(0, &fake_video_capturer));
|
||||
EXPECT_TRUE(channel_->SetCapturer(0, NULL));
|
||||
}
|
@ -2544,6 +2544,9 @@ bool WebRtcVideoMediaChannel::GetStats(const StatsOptions& options,
|
||||
additional_stats.recent_arrival_time_ms);
|
||||
}
|
||||
}
|
||||
|
||||
engine_->vie()->rtp()->GetPacerQueuingDelayMs(
|
||||
recv_channels_[0]->channel_id(), &bwe.bucket_delay);
|
||||
#endif
|
||||
|
||||
// Calculations done above per send/receive stream.
|
||||
|
@ -1,313 +0,0 @@
|
||||
# Copyright 2010 Google Inc.
|
||||
# All Rights Reserved.
|
||||
# Author: tschmelcher@google.com (Tristan Schmelcher)
|
||||
|
||||
"""Tool for helpers used in linux building process."""
|
||||
|
||||
import os
|
||||
import SCons.Defaults
|
||||
import subprocess
|
||||
|
||||
|
||||
def _OutputFromShellCommand(command):
|
||||
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
||||
return process.communicate()[0].strip()
|
||||
|
||||
|
||||
# This is a pure SCons helper function.
|
||||
def _InternalBuildDebianPackage(env, debian_files, package_files,
|
||||
output_dir=None, force_version=None):
|
||||
"""Creates build rules to build a Debian package from the specified sources.
|
||||
|
||||
Args:
|
||||
env: SCons Environment.
|
||||
debian_files: Array of the Debian control file sources that should be
|
||||
copied into the package source tree, e.g., changelog, control, rules,
|
||||
etc.
|
||||
package_files: An array of 2-tuples listing the files that should be
|
||||
copied into the package source tree.
|
||||
The first element is the path where the file should be placed for the
|
||||
.install control file to find it, relative to the generated debian
|
||||
package source directory.
|
||||
The second element is the file source.
|
||||
output_dir: An optional directory to place the files in. If omitted, the
|
||||
current output directory is used.
|
||||
force_version: Optional. Forces the version of the package to start with
|
||||
this version string if specified. If the last entry in the changelog
|
||||
is not for a version that starts with this then a dummy entry is
|
||||
generated with this version and a ~prerelease suffix (so that the
|
||||
final version will compare as greater).
|
||||
|
||||
Return:
|
||||
A list of the targets (if any).
|
||||
"""
|
||||
if 0 != subprocess.call(['which', 'dpkg-buildpackage']):
|
||||
print ('dpkg-buildpackage not installed on this system; '
|
||||
'skipping DEB build stage')
|
||||
return []
|
||||
# Read the control file and changelog file to determine the package name,
|
||||
# version, and arch that the Debian build tools will use to name the
|
||||
# generated files.
|
||||
control_file = None
|
||||
changelog_file = None
|
||||
for file_name in debian_files:
|
||||
if os.path.basename(file_name) == 'control':
|
||||
control_file = env.File(file_name).srcnode().abspath
|
||||
elif os.path.basename(file_name) == 'changelog':
|
||||
changelog_file = env.File(file_name).srcnode().abspath
|
||||
if not control_file:
|
||||
raise Exception('Need to have a control file')
|
||||
if not changelog_file:
|
||||
raise Exception('Need to have a changelog file')
|
||||
source = _OutputFromShellCommand(
|
||||
"awk '/^Source:/ { print $2; }' " + control_file)
|
||||
packages = _OutputFromShellCommand(
|
||||
"awk '/^Package:/ { print $2; }' " + control_file).split('\n')
|
||||
version = _OutputFromShellCommand(
|
||||
"sed -nr '1 { s/.*\\((.*)\\).*/\\1/; p }' " + changelog_file)
|
||||
arch = _OutputFromShellCommand('dpkg --print-architecture')
|
||||
add_dummy_changelog_entry = False
|
||||
if force_version and not version.startswith(force_version):
|
||||
print ('Warning: no entry in ' + changelog_file + ' for version ' +
|
||||
force_version + ' (last is ' + version +'). A dummy entry will be ' +
|
||||
'generated. Remember to add the real changelog entry before ' +
|
||||
'releasing.')
|
||||
version = force_version + '~prerelease'
|
||||
add_dummy_changelog_entry = True
|
||||
source_dir_name = source + '_' + version + '_' + arch
|
||||
target_file_names = [ source_dir_name + '.changes' ]
|
||||
for package in packages:
|
||||
package_file_name = package + '_' + version + '_' + arch + '.deb'
|
||||
target_file_names.append(package_file_name)
|
||||
# The targets
|
||||
if output_dir:
|
||||
targets = [os.path.join(output_dir, s) for s in target_file_names]
|
||||
else:
|
||||
targets = target_file_names
|
||||
# Path to where we will construct the debian build tree.
|
||||
deb_build_tree = os.path.join(source_dir_name, 'deb_build_tree')
|
||||
# First copy the files.
|
||||
for file_name in package_files:
|
||||
env.Command(os.path.join(deb_build_tree, file_name[0]), file_name[1],
|
||||
SCons.Defaults.Copy('$TARGET', '$SOURCE'))
|
||||
env.Depends(targets, os.path.join(deb_build_tree, file_name[0]))
|
||||
# Now copy the Debian metadata sources. We have to do this all at once so
|
||||
# that we can remove the target directory before copying, because there
|
||||
# can't be any other stale files there or else dpkg-buildpackage may use
|
||||
# them and give incorrect build output.
|
||||
copied_debian_files_paths = []
|
||||
for file_name in debian_files:
|
||||
copied_debian_files_paths.append(os.path.join(deb_build_tree, 'debian',
|
||||
os.path.basename(file_name)))
|
||||
copy_commands = [
|
||||
"""dir=$$(dirname $TARGET) && \
|
||||
rm -Rf $$dir && \
|
||||
mkdir -p $$dir && \
|
||||
cp $SOURCES $$dir && \
|
||||
chmod -R u+w $$dir"""
|
||||
]
|
||||
if add_dummy_changelog_entry:
|
||||
copy_commands += [
|
||||
"""debchange -c $$(dirname $TARGET)/changelog --newversion %s \
|
||||
--distribution UNRELEASED \
|
||||
'Developer preview build. (This entry was auto-generated.)'""" %
|
||||
version
|
||||
]
|
||||
env.Command(copied_debian_files_paths, debian_files, copy_commands)
|
||||
env.Depends(targets, copied_debian_files_paths)
|
||||
# Must explicitly specify -a because otherwise cross-builds won't work.
|
||||
# Must explicitly specify -D because -a disables it.
|
||||
# Must explicitly specify fakeroot because old dpkg tools don't assume that.
|
||||
env.Command(targets, None,
|
||||
"""dir=%(dir)s && \
|
||||
cd $$dir && \
|
||||
dpkg-buildpackage -b -uc -a%(arch)s -D -rfakeroot && \
|
||||
cd $$OLDPWD && \
|
||||
for file in %(targets)s; do \
|
||||
mv $$dir/../$$file $$(dirname $TARGET) || exit 1; \
|
||||
done""" %
|
||||
{'dir':env.Dir(deb_build_tree).path,
|
||||
'arch':arch,
|
||||
'targets':' '.join(target_file_names)})
|
||||
return targets
|
||||
|
||||
|
||||
def BuildDebianPackage(env, debian_files, package_files, force_version=None):
|
||||
"""Creates build rules to build a Debian package from the specified sources.
|
||||
|
||||
This is a Hammer-ified version of _InternalBuildDebianPackage that knows to
|
||||
put the packages in the Hammer staging dir.
|
||||
|
||||
Args:
|
||||
env: SCons Environment.
|
||||
debian_files: Array of the Debian control file sources that should be
|
||||
copied into the package source tree, e.g., changelog, control, rules,
|
||||
etc.
|
||||
package_files: An array of 2-tuples listing the files that should be
|
||||
copied into the package source tree.
|
||||
The first element is the path where the file should be placed for the
|
||||
.install control file to find it, relative to the generated debian
|
||||
package source directory.
|
||||
The second element is the file source.
|
||||
force_version: Optional. Forces the version of the package to start with
|
||||
this version string if specified. If the last entry in the changelog
|
||||
is not for a version that starts with this then a dummy entry is
|
||||
generated with this version and a ~prerelease suffix (so that the
|
||||
final version will compare as greater).
|
||||
|
||||
Return:
|
||||
A list of the targets (if any).
|
||||
"""
|
||||
if not env.Bit('host_linux'):
|
||||
return []
|
||||
return _InternalBuildDebianPackage(env, debian_files, package_files,
|
||||
output_dir='$STAGING_DIR', force_version=force_version)
|
||||
|
||||
|
||||
def _GetPkgConfigCommand():
|
||||
"""Return the pkg-config command line to use.
|
||||
|
||||
Returns:
|
||||
A string specifying the pkg-config command line to use.
|
||||
"""
|
||||
return os.environ.get('PKG_CONFIG') or 'pkg-config'
|
||||
|
||||
|
||||
def _EscapePosixShellArgument(arg):
|
||||
"""Escapes a shell command line argument so that it is interpreted literally.
|
||||
|
||||
Args:
|
||||
arg: The shell argument to escape.
|
||||
|
||||
Returns:
|
||||
The escaped string.
|
||||
"""
|
||||
return "'%s'" % arg.replace("'", "'\\''")
|
||||
|
||||
|
||||
def _HavePackage(package):
|
||||
"""Whether the given pkg-config package name is present on the build system.
|
||||
|
||||
Args:
|
||||
package: The name of the package.
|
||||
|
||||
Returns:
|
||||
True if the package is present, else False
|
||||
"""
|
||||
return subprocess.call('%s --exists %s' % (
|
||||
_GetPkgConfigCommand(),
|
||||
_EscapePosixShellArgument(package)), shell=True) == 0
|
||||
|
||||
|
||||
def _GetPackageFlags(flag_type, packages):
|
||||
"""Get the flags needed to compile/link against the given package(s).
|
||||
|
||||
Returns the flags that are needed to compile/link against the given pkg-config
|
||||
package(s).
|
||||
|
||||
Args:
|
||||
flag_type: The option to pkg-config specifying the type of flags to get.
|
||||
packages: The list of package names as strings.
|
||||
|
||||
Returns:
|
||||
The flags of the requested type.
|
||||
|
||||
Raises:
|
||||
subprocess.CalledProcessError: The pkg-config command failed.
|
||||
"""
|
||||
pkg_config = _GetPkgConfigCommand()
|
||||
command = ' '.join([pkg_config] +
|
||||
[_EscapePosixShellArgument(arg) for arg in
|
||||
[flag_type] + packages])
|
||||
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
||||
output = process.communicate()[0]
|
||||
if process.returncode != 0:
|
||||
raise subprocess.CalledProcessError(process.returncode, pkg_config)
|
||||
return output.strip().split(' ')
|
||||
|
||||
|
||||
def GetPackageParams(env, packages):
|
||||
"""Get the params needed to compile/link against the given package(s).
|
||||
|
||||
Returns the params that are needed to compile/link against the given
|
||||
pkg-config package(s).
|
||||
|
||||
Args:
|
||||
env: The current SCons environment.
|
||||
packages: The name of the package, or a list of names.
|
||||
|
||||
Returns:
|
||||
A dictionary containing the params.
|
||||
|
||||
Raises:
|
||||
Exception: One or more of the packages is not installed.
|
||||
"""
|
||||
if not env.Bit('host_linux'):
|
||||
return {}
|
||||
if not SCons.Util.is_List(packages):
|
||||
packages = [packages]
|
||||
for package in packages:
|
||||
if not _HavePackage(package):
|
||||
raise Exception(('Required package \"%s\" was not found. Please install '
|
||||
'the package that provides the \"%s.pc\" file.') %
|
||||
(package, package))
|
||||
package_ccflags = _GetPackageFlags('--cflags', packages)
|
||||
package_libs = _GetPackageFlags('--libs', packages)
|
||||
# Split package_libs into libs, libdirs, and misc. linker flags. (In a perfect
|
||||
# world we could just leave libdirs in link_flags, but some linkers are
|
||||
# somehow confused by the different argument order.)
|
||||
libs = [flag[2:] for flag in package_libs if flag[0:2] == '-l']
|
||||
libdirs = [flag[2:] for flag in package_libs if flag[0:2] == '-L']
|
||||
link_flags = [flag for flag in package_libs if flag[0:2] not in ['-l', '-L']]
|
||||
return {
|
||||
'ccflags': package_ccflags,
|
||||
'libs': libs,
|
||||
'libdirs': libdirs,
|
||||
'link_flags': link_flags,
|
||||
'dependent_target_settings' : {
|
||||
'libs': libs[:],
|
||||
'libdirs': libdirs[:],
|
||||
'link_flags': link_flags[:],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def EnableFeatureWherePackagePresent(env, bit, cpp_flag, package):
|
||||
"""Enable a feature if a required pkg-config package is present.
|
||||
|
||||
Args:
|
||||
env: The current SCons environment.
|
||||
bit: The name of the Bit to enable when the package is present.
|
||||
cpp_flag: The CPP flag to enable when the package is present.
|
||||
package: The name of the package.
|
||||
"""
|
||||
if not env.Bit('host_linux'):
|
||||
return
|
||||
if _HavePackage(package):
|
||||
env.SetBits(bit)
|
||||
env.Append(CPPDEFINES=[cpp_flag])
|
||||
else:
|
||||
print ('Warning: Package \"%s\" not found. Feature \"%s\" will not be '
|
||||
'built. To build with this feature, install the package that '
|
||||
'provides the \"%s.pc\" file.') % (package, bit, package)
|
||||
|
||||
def GetGccVersion(env):
|
||||
if env.Bit('cross_compile'):
|
||||
gcc_command = env['CXX']
|
||||
else:
|
||||
gcc_command = 'gcc'
|
||||
version_string = _OutputFromShellCommand(
|
||||
'%s --version | head -n 1 |'
|
||||
r'sed "s/.*\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/g"' % gcc_command)
|
||||
return tuple([int(x or '0') for x in version_string.split('.')])
|
||||
|
||||
def generate(env):
|
||||
if env.Bit('linux'):
|
||||
env.AddMethod(EnableFeatureWherePackagePresent)
|
||||
env.AddMethod(GetPackageParams)
|
||||
env.AddMethod(BuildDebianPackage)
|
||||
env.AddMethod(GetGccVersion)
|
||||
|
||||
|
||||
def exists(env):
|
||||
return 1 # Required by scons
|
@ -1,20 +0,0 @@
|
||||
# Copyright 2010 Google Inc.
|
||||
# All Rights Reserved.
|
||||
# Author: thaloun@google.com (Tim Haloun)
|
||||
|
||||
"""Noop tool that defines builder functions for non-default platforms to
|
||||
avoid errors when scanning sconsscripts."""
|
||||
|
||||
import SCons.Builder
|
||||
|
||||
|
||||
def generate(env):
|
||||
"""SCons method."""
|
||||
if not env.Bit('windows'):
|
||||
builder = SCons.Builder.Builder(
|
||||
action=''
|
||||
)
|
||||
env.Append(BUILDERS={'RES': builder, 'Grit': builder})
|
||||
|
||||
def exists(dummy):
|
||||
return 1
|
@ -1,635 +0,0 @@
|
||||
# Copyright 2010 Google Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Author: Tim Haloun (thaloun@google.com)
|
||||
# Daniel Petersson (dape@google.com)
|
||||
#
|
||||
import os
|
||||
import SCons.Util
|
||||
|
||||
class LibraryInfo:
|
||||
"""Records information on the libraries defined in a build configuration.
|
||||
|
||||
Attributes:
|
||||
lib_targets: Dictionary of library target params for lookups in
|
||||
ExtendComponent().
|
||||
prebuilt_libraries: Set of all prebuilt static libraries.
|
||||
system_libraries: Set of libraries not found in the above (used to detect
|
||||
out-of-order build rules).
|
||||
"""
|
||||
|
||||
# Dictionary of LibraryInfo objects keyed by BUILD_TYPE value.
|
||||
__library_info = {}
|
||||
|
||||
@staticmethod
|
||||
def get(env):
|
||||
"""Gets the LibraryInfo object for the current build type.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
|
||||
Returns:
|
||||
The LibraryInfo object.
|
||||
"""
|
||||
return LibraryInfo.__library_info.setdefault(env['BUILD_TYPE'],
|
||||
LibraryInfo())
|
||||
|
||||
def __init__(self):
|
||||
self.lib_targets = {}
|
||||
self.prebuilt_libraries = set()
|
||||
self.system_libraries = set()
|
||||
|
||||
|
||||
def _GetLibParams(env, lib):
|
||||
"""Gets the params for the given library if it is a library target.
|
||||
|
||||
Returns the params that were specified when the given lib target name was
|
||||
created, or None if no such lib target has been defined. In the None case, it
|
||||
additionally records the negative result so as to detect out-of-order
|
||||
dependencies for future targets.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
lib: The library's name as a string.
|
||||
|
||||
Returns:
|
||||
Its dictionary of params, or None.
|
||||
"""
|
||||
info = LibraryInfo.get(env)
|
||||
if lib in info.lib_targets:
|
||||
return info.lib_targets[lib]
|
||||
else:
|
||||
if lib not in info.prebuilt_libraries and lib not in info.system_libraries:
|
||||
info.system_libraries.add(lib)
|
||||
return None
|
||||
|
||||
|
||||
def _RecordLibParams(env, lib, params):
|
||||
"""Record the params used for a library target.
|
||||
|
||||
Record the params used for a library target while checking for several error
|
||||
conditions.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
lib: The library target's name as a string.
|
||||
params: Its dictionary of params.
|
||||
|
||||
Raises:
|
||||
Exception: The lib target has already been recorded, or the lib was
|
||||
previously declared to be prebuilt, or the lib target is being defined
|
||||
after a reverse library dependency.
|
||||
"""
|
||||
info = LibraryInfo.get(env)
|
||||
if lib in info.lib_targets:
|
||||
raise Exception('Multiple definitions of ' + lib)
|
||||
if lib in info.prebuilt_libraries:
|
||||
raise Exception(lib + ' already declared as a prebuilt library')
|
||||
if lib in info.system_libraries:
|
||||
raise Exception(lib + ' cannot be defined after its reverse library '
|
||||
'dependencies')
|
||||
info.lib_targets[lib] = params
|
||||
|
||||
|
||||
def _IsPrebuiltLibrary(env, lib):
|
||||
"""Checks whether or not the given library is a prebuilt static library.
|
||||
|
||||
Returns whether or not the given library name has been declared to be a
|
||||
prebuilt static library. In the False case, it additionally records the
|
||||
negative result so as to detect out-of-order dependencies for future targets.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
lib: The library's name as a string.
|
||||
|
||||
Returns:
|
||||
True or False
|
||||
"""
|
||||
info = LibraryInfo.get(env)
|
||||
if lib in info.prebuilt_libraries:
|
||||
return True
|
||||
else:
|
||||
if lib not in info.lib_targets and lib not in info.system_libraries:
|
||||
info.system_libraries.add(lib)
|
||||
return False
|
||||
|
||||
|
||||
def _RecordPrebuiltLibrary(env, lib):
|
||||
"""Record that a library is a prebuilt static library.
|
||||
|
||||
Record that the given library name refers to a prebuilt static library while
|
||||
checking for several error conditions.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
lib: The library's name as a string.
|
||||
|
||||
Raises:
|
||||
Exception: The lib has already been recorded to be prebuilt, or the lib was
|
||||
previously declared as a target, or the lib is being declared as
|
||||
prebuilt after a reverse library dependency.
|
||||
"""
|
||||
info = LibraryInfo.get(env)
|
||||
if lib in info.prebuilt_libraries:
|
||||
raise Exception('Multiple prebuilt declarations of ' + lib)
|
||||
if lib in info.lib_targets:
|
||||
raise Exception(lib + ' already defined as a target')
|
||||
if lib in info.system_libraries:
|
||||
raise Exception(lib + ' cannot be declared as prebuilt after its reverse '
|
||||
'library dependencies')
|
||||
info.prebuilt_libraries.add(lib)
|
||||
|
||||
|
||||
def _GenericLibrary(env, static, **kwargs):
|
||||
"""Extends ComponentLibrary to support multiplatform builds
|
||||
of dynamic or static libraries.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
kwargs: The keyword arguments.
|
||||
|
||||
Returns:
|
||||
See swtoolkit ComponentLibrary
|
||||
"""
|
||||
params = CombineDicts(kwargs, {'COMPONENT_STATIC': static})
|
||||
return ExtendComponent(env, 'ComponentLibrary', **params)
|
||||
|
||||
|
||||
def DeclarePrebuiltLibraries(env, libraries):
|
||||
"""Informs the build engine about external static libraries.
|
||||
|
||||
Informs the build engine that the given external library name(s) are prebuilt
|
||||
static libraries, as opposed to shared libraries.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
libraries: The library or libraries that are being declared as prebuilt
|
||||
static libraries.
|
||||
"""
|
||||
if not SCons.Util.is_List(libraries):
|
||||
libraries = [libraries]
|
||||
for library in libraries:
|
||||
_RecordPrebuiltLibrary(env, library)
|
||||
|
||||
|
||||
def Library(env, **kwargs):
|
||||
"""Extends ComponentLibrary to support multiplatform builds of static
|
||||
libraries.
|
||||
|
||||
Args:
|
||||
env: The current environment.
|
||||
kwargs: The keyword arguments.
|
||||
|
||||
Returns:
|
||||
See swtoolkit ComponentLibrary
|
||||
"""
|
||||
return _GenericLibrary(env, True, **kwargs)
|
||||
|
||||
|
||||
def DynamicLibrary(env, **kwargs):
|
||||
"""Extends ComponentLibrary to support multiplatform builds
|
||||
of dynmic libraries.
|
||||
|
||||
Args:
|
||||
env: The environment object.
|
||||
kwargs: The keyword arguments.
|
||||
|
||||
Returns:
|
||||
See swtoolkit ComponentLibrary
|
||||
"""
|
||||
return _GenericLibrary(env, False, **kwargs)
|
||||
|
||||
|
||||
def Object(env, **kwargs):
|
||||
return ExtendComponent(env, 'ComponentObject', **kwargs)
|
||||
|
||||
|
||||
def Unittest(env, **kwargs):
|
||||
"""Extends ComponentTestProgram to support unittest built
|
||||
for multiple platforms.
|
||||
|
||||
Args:
|
||||
env: The current environment.
|
||||
kwargs: The keyword arguments.
|
||||
|
||||
Returns:
|
||||
See swtoolkit ComponentProgram.
|
||||
"""
|
||||
kwargs['name'] = kwargs['name'] + '_unittest'
|
||||
|
||||
common_test_params = {
|
||||
'posix_cppdefines': ['GUNIT_NO_GOOGLE3', 'GTEST_HAS_RTTI=0'],
|
||||
'libs': ['unittest_main', 'gunit']
|
||||
}
|
||||
if 'explicit_libs' not in kwargs:
|
||||
common_test_params['win_libs'] = [
|
||||
'advapi32',
|
||||
'crypt32',
|
||||
'iphlpapi',
|
||||
'secur32',
|
||||
'shell32',
|
||||
'shlwapi',
|
||||
'user32',
|
||||
'wininet',
|
||||
'ws2_32'
|
||||
]
|
||||
common_test_params['lin_libs'] = [
|
||||
'crypto',
|
||||
'pthread',
|
||||
'ssl',
|
||||
]
|
||||
|
||||
params = CombineDicts(kwargs, common_test_params)
|
||||
return ExtendComponent(env, 'ComponentTestProgram', **params)
|
||||
|
||||
|
||||
def App(env, **kwargs):
|
||||
"""Extends ComponentProgram to support executables with platform specific
|
||||
options.
|
||||
|
||||
Args:
|
||||
env: The current environment.
|
||||
kwargs: The keyword arguments.
|
||||
|
||||
Returns:
|
||||
See swtoolkit ComponentProgram.
|
||||
"""
|
||||
if 'explicit_libs' not in kwargs:
|
||||
common_app_params = {
|
||||
'win_libs': [
|
||||
'advapi32',
|
||||
'crypt32',
|
||||
'iphlpapi',
|
||||
'secur32',
|
||||
'shell32',
|
||||
'shlwapi',
|
||||
'user32',
|
||||
'wininet',
|
||||
'ws2_32'
|
||||
]}
|
||||
params = CombineDicts(kwargs, common_app_params)
|
||||
else:
|
||||
params = kwargs
|
||||
return ExtendComponent(env, 'ComponentProgram', **params)
|
||||
|
||||
def WiX(env, **kwargs):
|
||||
""" Extends the WiX builder
|
||||
Args:
|
||||
env: The current environment.
|
||||
kwargs: The keyword arguments.
|
||||
|
||||
Returns:
|
||||
The node produced by the environment's wix builder
|
||||
"""
|
||||
return ExtendComponent(env, 'WiX', **kwargs)
|
||||
|
||||
def Repository(env, at, path):
|
||||
"""Maps a directory external to $MAIN_DIR to the given path so that sources
|
||||
compiled from it end up in the correct place under $OBJ_DIR. NOT required
|
||||
when only referring to header files.
|
||||
|
||||
Args:
|
||||
env: The current environment object.
|
||||
at: The 'mount point' within the current directory.
|
||||
path: Path to the actual directory.
|
||||
"""
|
||||
env.Dir(at).addRepository(env.Dir(path))
|
||||
|
||||
|
||||
def Components(*paths):
|
||||
"""Completes the directory paths with the correct file
|
||||
names such that the directory/directory.scons name
|
||||
convention can be used.
|
||||
|
||||
Args:
|
||||
paths: The paths to complete. If it refers to an existing
|
||||
file then it is ignored.
|
||||
|
||||
Returns:
|
||||
The completed lif scons files that are needed to build talk.
|
||||
"""
|
||||
files = []
|
||||
for path in paths:
|
||||
if os.path.isfile(path):
|
||||
files.append(path)
|
||||
else:
|
||||
files.append(ExpandSconsPath(path))
|
||||
return files
|
||||
|
||||
|
||||
def ExpandSconsPath(path):
|
||||
"""Expands a directory path into the path to the
|
||||
scons file that our build uses.
|
||||
Ex: magiflute/plugin/common => magicflute/plugin/common/common.scons
|
||||
|
||||
Args:
|
||||
path: The directory path to expand.
|
||||
|
||||
Returns:
|
||||
The expanded path.
|
||||
"""
|
||||
return '%s/%s.scons' % (path, os.path.basename(path))
|
||||
|
||||
|
||||
def ReadVersion(filename):
|
||||
"""Executes the supplied file and pulls out a version definition from it. """
|
||||
defs = {}
|
||||
execfile(str(filename), defs)
|
||||
if 'version' not in defs:
|
||||
return '0.0.0.0'
|
||||
version = defs['version']
|
||||
parts = version.split(',')
|
||||
build = os.environ.get('GOOGLE_VERSION_BUILDNUMBER')
|
||||
if build:
|
||||
parts[-1] = str(build)
|
||||
return '.'.join(parts)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Helper methods for translating talk.Foo() declarations in to manipulations of
|
||||
# environmuent construction variables, including parameter parsing and merging,
|
||||
#
|
||||
def PopEntry(dictionary, key):
|
||||
"""Get the value from a dictionary by key. If the key
|
||||
isn't in the dictionary then None is returned. If it is in
|
||||
the dictionary the value is fetched and then is it removed
|
||||
from the dictionary.
|
||||
|
||||
Args:
|
||||
dictionary: The dictionary.
|
||||
key: The key to get the value for.
|
||||
Returns:
|
||||
The value or None if the key is missing.
|
||||
"""
|
||||
value = None
|
||||
if key in dictionary:
|
||||
value = dictionary[key]
|
||||
dictionary.pop(key)
|
||||
return value
|
||||
|
||||
|
||||
def MergeAndFilterByPlatform(env, params):
|
||||
"""Take a dictionary of arguments to lists of values, and, depending on
|
||||
which platform we are targetting, merge the lists of associated keys.
|
||||
Merge by combining value lists like so:
|
||||
{win_foo = [a,b], lin_foo = [c,d], foo = [e], mac_bar = [f], bar = [g] }
|
||||
becomes {foo = [a,b,e], bar = [g]} on windows, and
|
||||
{foo = [e], bar = [f,g]} on mac
|
||||
|
||||
Args:
|
||||
env: The hammer environment which knows which platforms are active
|
||||
params: The keyword argument dictionary.
|
||||
Returns:
|
||||
A new dictionary with the filtered and combined entries of params
|
||||
"""
|
||||
platforms = {
|
||||
'linux': 'lin_',
|
||||
'mac': 'mac_',
|
||||
'posix': 'posix_',
|
||||
'windows': 'win_',
|
||||
}
|
||||
active_prefixes = [
|
||||
platforms[x] for x in iter(platforms) if env.Bit(x)
|
||||
]
|
||||
inactive_prefixes = [
|
||||
platforms[x] for x in iter(platforms) if not env.Bit(x)
|
||||
]
|
||||
|
||||
merged = {}
|
||||
for arg, values in params.iteritems():
|
||||
inactive_platform = False
|
||||
|
||||
key = arg
|
||||
|
||||
for prefix in active_prefixes:
|
||||
if arg.startswith(prefix):
|
||||
key = arg[len(prefix):]
|
||||
|
||||
for prefix in inactive_prefixes:
|
||||
if arg.startswith(prefix):
|
||||
inactive_platform = True
|
||||
|
||||
if inactive_platform:
|
||||
continue
|
||||
|
||||
AddToDict(merged, key, values)
|
||||
|
||||
return merged
|
||||
|
||||
|
||||
def MergeSettingsFromLibraryDependencies(env, params):
|
||||
if 'libs' in params:
|
||||
for lib in params['libs']:
|
||||
libparams = _GetLibParams(env, lib)
|
||||
if libparams:
|
||||
if 'dependent_target_settings' in libparams:
|
||||
params = CombineDicts(
|
||||
params,
|
||||
MergeAndFilterByPlatform(
|
||||
env,
|
||||
libparams['dependent_target_settings']))
|
||||
return params
|
||||
|
||||
|
||||
def ExtendComponent(env, component, **kwargs):
|
||||
"""A wrapper around a scons builder function that preprocesses and post-
|
||||
processes its inputs and outputs. For example, it merges and filters
|
||||
certain keyword arguments before appending them to the environments
|
||||
construction variables. It can build signed targets and 64bit copies
|
||||
of targets as well.
|
||||
|
||||
Args:
|
||||
env: The hammer environment with which to build the target
|
||||
component: The environment's builder function, e.g. ComponentProgram
|
||||
kwargs: keyword arguments that are either merged, translated, and passed on
|
||||
to the call to component, or which control execution.
|
||||
TODO(): Document the fields, such as cppdefines->CPPDEFINES,
|
||||
prepend_includedirs, include_talk_media_libs, etc.
|
||||
Returns:
|
||||
The output node returned by the call to component, or a subsequent signed
|
||||
dependant node.
|
||||
"""
|
||||
env = env.Clone()
|
||||
|
||||
# prune parameters intended for other platforms, then merge
|
||||
params = MergeAndFilterByPlatform(env, kwargs)
|
||||
|
||||
# get the 'target' field
|
||||
name = PopEntry(params, 'name')
|
||||
|
||||
# get the 'packages' field and process it if present (only used for Linux).
|
||||
packages = PopEntry(params, 'packages')
|
||||
if packages and len(packages):
|
||||
params = CombineDicts(params, env.GetPackageParams(packages))
|
||||
|
||||
# save pristine params of lib targets for future reference
|
||||
if 'ComponentLibrary' == component:
|
||||
_RecordLibParams(env, name, dict(params))
|
||||
|
||||
# add any dependent target settings from library dependencies
|
||||
params = MergeSettingsFromLibraryDependencies(env, params)
|
||||
|
||||
# if this is a signed binary we need to make an unsigned version first
|
||||
signed = env.Bit('windows') and PopEntry(params, 'signed')
|
||||
if signed:
|
||||
name = 'unsigned_' + name
|
||||
|
||||
# potentially exit now
|
||||
srcs = PopEntry(params, 'srcs')
|
||||
if not srcs or not hasattr(env, component):
|
||||
return None
|
||||
|
||||
# apply any explicit dependencies
|
||||
dependencies = PopEntry(params, 'depends')
|
||||
if dependencies is not None:
|
||||
env.Depends(name, dependencies)
|
||||
|
||||
# put the contents of params into the environment
|
||||
# some entries are renamed then appended, others renamed then prepended
|
||||
appends = {
|
||||
'cppdefines' : 'CPPDEFINES',
|
||||
'libdirs' : 'LIBPATH',
|
||||
'link_flags' : 'LINKFLAGS',
|
||||
'libs' : 'LIBS',
|
||||
'FRAMEWORKS' : 'FRAMEWORKS',
|
||||
}
|
||||
prepends = {}
|
||||
if env.Bit('windows'):
|
||||
# MSVC compile flags have precedence at the beginning ...
|
||||
prepends['ccflags'] = 'CCFLAGS'
|
||||
else:
|
||||
# ... while GCC compile flags have precedence at the end
|
||||
appends['ccflags'] = 'CCFLAGS'
|
||||
if PopEntry(params, 'prepend_includedirs'):
|
||||
prepends['includedirs'] = 'CPPPATH'
|
||||
else:
|
||||
appends['includedirs'] = 'CPPPATH'
|
||||
|
||||
for field, var in appends.items():
|
||||
values = PopEntry(params, field)
|
||||
if values is not None:
|
||||
env.Append(**{var : values})
|
||||
for field, var in prepends.items():
|
||||
values = PopEntry(params, field)
|
||||
if values is not None:
|
||||
env.Prepend(**{var : values})
|
||||
|
||||
# any other parameters are replaced without renaming
|
||||
for field, value in params.items():
|
||||
env.Replace(**{field : value})
|
||||
|
||||
if env.Bit('linux') and 'LIBS' in env:
|
||||
libs = env['LIBS']
|
||||
# When using --as-needed + --start/end-group, shared libraries need to come
|
||||
# after --end-group on the command-line because the pruning decision only
|
||||
# considers the preceding modules and --start/end-group may cause the
|
||||
# effective position of early static libraries on the command-line to be
|
||||
# deferred to the point of --end-group. To effect this, we move shared libs
|
||||
# into _LIBFLAGS, which has the --end-group as its first entry. SCons does
|
||||
# not track dependencies on system shared libraries anyway so we lose
|
||||
# nothing by removing them from LIBS.
|
||||
static_libs = [lib for lib in libs if
|
||||
_GetLibParams(env, lib) or _IsPrebuiltLibrary(env, lib)]
|
||||
shared_libs = ['-l' + lib for lib in libs if not
|
||||
(_GetLibParams(env, lib) or _IsPrebuiltLibrary(env, lib))]
|
||||
env.Replace(LIBS=static_libs)
|
||||
env.Append(_LIBFLAGS=shared_libs)
|
||||
|
||||
# invoke the builder function
|
||||
builder = getattr(env, component)
|
||||
|
||||
node = builder(name, srcs)
|
||||
|
||||
if env.Bit('mac') and 'ComponentProgram' == component:
|
||||
# Build .dSYM debug packages. This is useful even for non-stripped
|
||||
# binaries, as the dsym utility will fetch symbols from all
|
||||
# statically-linked libraries (the linker doesn't include them in to the
|
||||
# final binary).
|
||||
build_dsym = env.Command(
|
||||
env.Dir('$STAGING_DIR/%s.dSYM' % node[0]),
|
||||
node,
|
||||
'mkdir -p `dirname $TARGET` && dsymutil -o $TARGET $SOURCE')
|
||||
env.Alias('all_dsym', env.Alias('%s.dSYM' % node[0], build_dsym))
|
||||
|
||||
if signed:
|
||||
# Get the name of the built binary, then get the name of the final signed
|
||||
# version from it. We need the output path since we don't know the file
|
||||
# extension beforehand.
|
||||
target = node[0].path.split('_', 1)[1]
|
||||
# postsignprefix: If defined, postsignprefix is a string that should be
|
||||
# prepended to the target executable. This is to provide a work around
|
||||
# for EXEs and DLLs with the same name, which thus have PDBs with the
|
||||
# same name. Setting postsignprefix allows the EXE and its PDB
|
||||
# to be renamed and copied in a previous step; then the desired
|
||||
# name of the EXE (but not PDB) is reconstructed after signing.
|
||||
postsignprefix = PopEntry(params, 'postsignprefix')
|
||||
if postsignprefix is not None:
|
||||
target = postsignprefix + target
|
||||
signed_node = env.SignedBinary(
|
||||
source = node,
|
||||
target = '$STAGING_DIR/' + target,
|
||||
)
|
||||
env.Alias('signed_binaries', signed_node)
|
||||
return signed_node
|
||||
|
||||
return node
|
||||
|
||||
|
||||
def AddToDict(dictionary, key, values, append=True):
|
||||
"""Merge the given key value(s) pair into a dictionary. If it contains an
|
||||
entry with that key already, then combine by appending or prepending the
|
||||
values as directed. Otherwise, assign a new keyvalue pair.
|
||||
"""
|
||||
if values is None:
|
||||
return
|
||||
|
||||
if key not in dictionary:
|
||||
dictionary[key] = values
|
||||
return
|
||||
|
||||
cur = dictionary[key]
|
||||
# TODO(dape): Make sure that there are no duplicates
|
||||
# in the list. I can't use python set for this since
|
||||
# the nodes that are returned by the SCONS builders
|
||||
# are not hashable.
|
||||
# dictionary[key] = list(set(cur).union(set(values)))
|
||||
if append:
|
||||
dictionary[key] = cur + values
|
||||
else:
|
||||
dictionary[key] = values + cur
|
||||
|
||||
|
||||
def CombineDicts(a, b):
|
||||
"""Unions two dictionaries of arrays/dictionaries.
|
||||
|
||||
Unions two dictionaries of arrays/dictionaries by combining the values of keys
|
||||
shared between them. The original dictionaries should not be used again after
|
||||
this call.
|
||||
|
||||
Args:
|
||||
a: First dict.
|
||||
b: Second dict.
|
||||
|
||||
Returns:
|
||||
The union of a and b.
|
||||
"""
|
||||
c = {}
|
||||
for key in a:
|
||||
if key in b:
|
||||
aval = a[key]
|
||||
bval = b.pop(key)
|
||||
if isinstance(aval, dict) and isinstance(bval, dict):
|
||||
c[key] = CombineDicts(aval, bval)
|
||||
else:
|
||||
c[key] = aval + bval
|
||||
else:
|
||||
c[key] = a[key]
|
||||
|
||||
for key in b:
|
||||
c[key] = b[key]
|
||||
|
||||
return c
|
||||
|
||||
|
||||
def RenameKey(d, old, new, append=True):
|
||||
AddToDict(d, new, PopEntry(d, old), append)
|
Loading…
x
Reference in New Issue
Block a user