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/",
             ],
             win_cppdefines = [
               "COMPILED_FROM_DSP",
             ],
             posix_cppdefines = [
               "HAVE_EXPAT_CONFIG_H",
             ],
)
talk.Library(env, name = "libsrtp",
             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",
             ],
)
talk.Library(env, name = "libjingle",
             lin_srcs = [
               "base/latebindingsymboltable.cc",
               "base/linux.cc",
               "session/phone/libudevsymboltable.cc",
               "session/phone/v4llookup.cc",
             ],
             mac_srcs = [
               "base/macconversion.cc",
               "base/macutils.cc",
               "session/phone/devicemanager_mac.mm",
             ],
             posix_srcs = [
               "base/unixfilesystem.cc",
               "base/opensslidentity.cc",
               "base/opensslstreamadapter.cc",
               "base/sslidentity.cc",
               "base/sslstreamadapter.cc",
             ],
             cppdefines = [
               "FEATURE_ENABLE_VOICEMAIL",
               "EXPAT_RELATIVE_PATH",
               "SRTP_RELATIVE_PATH",
               "XML_STATIC",
             ],
             srcs = [
               "base/asyncfile.cc",
               "base/asynchttprequest.cc",
               "base/asyncsocket.cc",
               "base/asynctcpsocket.cc",
               "base/asyncudpsocket.cc",
               "base/autodetectproxy.cc",
               "base/base64.cc",
               "base/basicpacketsocketfactory.cc",
               "base/bytebuffer.cc",
               "base/checks.cc",
               "base/common.cc",
               "base/diskcache.cc",
               "base/event.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/logging.cc",
               "base/md5c.c",
               "base/messagehandler.cc",
               "base/messagequeue.cc",
               "base/nethelpers.cc",
               "base/network.cc",
               "base/openssladapter.cc",
               "base/pathutils.cc",
               "base/physicalsocketserver.cc",
               "base/proxydetect.cc",
               "base/proxyinfo.cc",
               "base/ratetracker.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/stream.cc",
               "base/stringdigest.cc",
               "base/stringencode.cc",
               "base/stringutils.cc",
               "base/task.cc",
               "base/taskparent.cc",
               "base/taskrunner.cc",
               "base/thread.cc",
               "base/time.cc",
               "base/urlencode.cc",
               "p2p/base/constants.cc",
               "p2p/base/p2ptransport.cc",
               "p2p/base/p2ptransportchannel.cc",
               "p2p/base/parsing.cc",
               "p2p/base/port.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/udpport.cc",
               "p2p/client/basicportallocator.cc",
               "p2p/client/httpportallocator.cc",
               "p2p/client/socketmonitor.cc",
               "session/tunnel/pseudotcpchannel.cc",
               "session/tunnel/tunnelsessionclient.cc",
               "session/tunnel/securetunnelsessionclient.cc",
               "session/phone/audiomonitor.cc",
               "session/phone/call.cc",
               "session/phone/channel.cc",
               "session/phone/channelmanager.cc",
               "session/phone/codec.cc",
               "session/phone/devicemanager.cc",
               "session/phone/filemediaengine.cc",
               "session/phone/mediaengine.cc",
               "session/phone/mediamonitor.cc",
               "session/phone/mediasessionclient.cc",
               "session/phone/rtpdump.cc",
               "session/phone/rtcpmuxfilter.cc",
               "session/phone/soundclip.cc",
               "session/phone/srtpfilter.cc",
               "xmllite/qname.cc",
               "xmllite/xmlbuilder.cc",
               "xmllite/xmlconstants.cc",
               "xmllite/xmlelement.cc",
               "xmllite/xmlnsstack.cc",
               "xmllite/xmlparser.cc",
               "xmllite/xmlprinter.cc",
               "xmpp/constants.cc",
               "xmpp/jid.cc",
               "xmpp/ratelimitmanager.cc",
               "xmpp/saslmechanism.cc",
               "xmpp/xmppclient.cc",
               "xmpp/xmppengineimpl.cc",
               "xmpp/xmppengineimpl_iq.cc",
               "xmpp/xmpplogintask.cc",
               "xmpp/xmppstanzaparser.cc",
               "xmpp/xmpptask.cc",
             ],
             includedirs = [
               "third_party/libudev",
               "third_party/expat-2.0.1/",
               "third_party/srtp/include",
               "third_party/srtp/crypto/include",
             ],
             win_srcs = [
               "base/schanneladapter.cc",
               "base/win32.cc",
               "base/win32filesystem.cc",
               "base/win32securityerrors.cc",
               "base/win32socketserver.cc",
               "base/win32socketinit.cc",
               "base/win32window.cc",
               "base/winfirewall.cc",
               "base/winping.cc",
             ],
)
talk.App(env, name = "login",
         libs = [
           "libjingle",
           "expat",
           "libxmpphelp",
         ],
         srcs = [
           "examples/login/xmppthread.cc",
           "examples/login/login_main.cc",
         ],
         mac_libs = [
           "crypto",
           "ssl",
         ],
         lin_libs = [
           "libpthread",
           ":libssl.so.0.9.8",
         ],
)
talk.Library(env, name = "libxmpphelp",
             libs = [
               "libjingle",
             ],
             srcs = [
               "examples/login/xmppauth.cc",
               "examples/login/xmpppump.cc",
               "examples/login/xmppsocket.cc",
             ],
)
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",
         ],
         mac_libs = [
           "crypto",
           "ssl",
         ],
         cppdefines = [
           "FEATURE_ENABLE_VOICEMAIL",
         ],
         lin_libs = [
           "libasound",
           "libpthread",
           ":libssl.so.0.9.8",
         ],
         srcs = [
           "examples/call/call_main.cc",
           "examples/call/callclient.cc",
           "examples/call/console.cc",
           "examples/call/discoitemsquerytask.cc",
           "examples/call/friendinvitesendtask.cc",
           "examples/call/mucinviterecvtask.cc",
           "examples/call/mucinvitesendtask.cc",
           "examples/call/presenceouttask.cc",
           "examples/call/presencepushtask.cc",
           "examples/call/voicemailjidrequester.cc",
         ],
         libs = [
           "libjingle",
           "expat",
           "libsrtp",
           "libxmpphelp",
         ],
)
talk.App(env, name = "relayserver",
         libs = [
           "libjingle",
         ],
         srcs = [
           "p2p/base/relayserver_main.cc",
         ],
         lin_libs = [
           "libpthread",
         ],
)
talk.App(env, name = "stunserver",
         libs = [
           "libjingle",
         ],
         srcs = [
           "p2p/base/stunserver_main.cc",
         ],
         lin_libs = [
           "libpthread",
         ],
)