2017-12-21 02:13:23 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
Import('env')
|
|
|
|
Import('env_modules')
|
|
|
|
|
|
|
|
# Thirdparty source files
|
|
|
|
|
2019-06-24 13:46:24 +00:00
|
|
|
env_ws = env_modules.Clone()
|
2017-12-21 02:13:23 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # already builtin for javascript
|
2018-08-11 11:05:48 +00:00
|
|
|
thirdparty_dir = "#thirdparty/libwebsockets/"
|
2019-04-01 00:14:42 +00:00
|
|
|
helper_dir = "win32helpers/"
|
2018-08-11 11:05:48 +00:00
|
|
|
thirdparty_sources = [
|
|
|
|
|
2019-04-01 00:14:42 +00:00
|
|
|
"core/alloc.c",
|
|
|
|
"core/context.c",
|
|
|
|
"core/libwebsockets.c",
|
|
|
|
"core/output.c",
|
|
|
|
"core/pollfd.c",
|
|
|
|
"core/service.c",
|
|
|
|
|
|
|
|
"event-libs/poll/poll.c",
|
|
|
|
|
|
|
|
"misc/base64-decode.c",
|
|
|
|
"misc/lejp.c",
|
|
|
|
"misc/sha-1.c",
|
|
|
|
|
|
|
|
"roles/h1/ops-h1.c",
|
|
|
|
"roles/http/header.c",
|
|
|
|
"roles/http/client/client.c",
|
|
|
|
"roles/http/client/client-handshake.c",
|
|
|
|
"roles/http/server/fops-zip.c",
|
|
|
|
"roles/http/server/lejp-conf.c",
|
|
|
|
"roles/http/server/parsers.c",
|
|
|
|
"roles/http/server/server.c",
|
|
|
|
"roles/listen/ops-listen.c",
|
|
|
|
"roles/pipe/ops-pipe.c",
|
|
|
|
"roles/raw/ops-raw.c",
|
|
|
|
|
|
|
|
"roles/ws/client-ws.c",
|
|
|
|
"roles/ws/client-parser-ws.c",
|
|
|
|
"roles/ws/ops-ws.c",
|
|
|
|
"roles/ws/server-ws.c",
|
|
|
|
|
|
|
|
"tls/tls.c",
|
|
|
|
"tls/tls-client.c",
|
|
|
|
"tls/tls-server.c",
|
|
|
|
|
|
|
|
"tls/mbedtls/wrapper/library/ssl_cert.c",
|
|
|
|
"tls/mbedtls/wrapper/library/ssl_pkey.c",
|
|
|
|
"tls/mbedtls/wrapper/library/ssl_stack.c",
|
|
|
|
"tls/mbedtls/wrapper/library/ssl_methods.c",
|
|
|
|
"tls/mbedtls/wrapper/library/ssl_lib.c",
|
|
|
|
"tls/mbedtls/wrapper/library/ssl_x509.c",
|
|
|
|
"tls/mbedtls/wrapper/platform/ssl_port.c",
|
|
|
|
"tls/mbedtls/wrapper/platform/ssl_pm.c",
|
|
|
|
"tls/mbedtls/lws-genhash.c",
|
|
|
|
"tls/mbedtls/mbedtls-client.c",
|
|
|
|
"tls/mbedtls/lws-genrsa.c",
|
|
|
|
"tls/mbedtls/ssl.c",
|
|
|
|
"tls/mbedtls/mbedtls-server.c"
|
2018-08-11 11:05:48 +00:00
|
|
|
]
|
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
if env["platform"] == "android": # Builtin getifaddrs
|
2019-04-01 00:14:42 +00:00
|
|
|
thirdparty_sources += ["misc/getifaddrs.c"]
|
2018-08-11 11:05:48 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
if env["platform"] == "windows" or env["platform"] == "uwp": # Winsock
|
2019-04-01 00:14:42 +00:00
|
|
|
thirdparty_sources += ["plat/lws-plat-win.c", helper_dir + "getopt.c", helper_dir + "getopt_long.c", helper_dir + "gettimeofday.c"]
|
2018-08-11 11:05:48 +00:00
|
|
|
else: # Unix socket
|
2019-04-01 00:14:42 +00:00
|
|
|
thirdparty_sources += ["plat/lws-plat-unix.c"]
|
|
|
|
|
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
2018-08-11 11:05:48 +00:00
|
|
|
|
2019-04-01 00:14:42 +00:00
|
|
|
env_lws.Prepend(CPPPATH=[thirdparty_dir])
|
2018-09-28 11:29:52 +00:00
|
|
|
|
|
|
|
if env['builtin_mbedtls']:
|
|
|
|
mbedtls_includes = "#thirdparty/mbedtls/include"
|
|
|
|
env_lws.Prepend(CPPPATH=[mbedtls_includes])
|
2018-08-11 11:05:48 +00:00
|
|
|
|
2019-04-01 00:14:42 +00:00
|
|
|
wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
|
2018-09-28 11:29:52 +00:00
|
|
|
env_lws.Prepend(CPPPATH=wrapper_includes)
|
2018-08-11 11:05:48 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
if env["platform"] == "windows" or env["platform"] == "uwp":
|
2019-04-01 00:14:42 +00:00
|
|
|
env_lws.Prepend(CPPPATH=[thirdparty_dir + helper_dir])
|
2018-08-11 11:05:48 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
if env["platform"] == "uwp":
|
2019-07-03 07:16:20 +00:00
|
|
|
env_lws.Append(CPPDEFINES=["LWS_MINGW_SUPPORT"])
|
2018-08-11 11:05:48 +00:00
|
|
|
|
2018-09-28 11:29:52 +00:00
|
|
|
env_thirdparty = env_lws.Clone()
|
|
|
|
env_thirdparty.disable_warnings()
|
|
|
|
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
|
2018-02-20 14:03:57 +00:00
|
|
|
|
2019-06-24 13:46:24 +00:00
|
|
|
wslay_dir = "#thirdparty/wslay/"
|
|
|
|
wslay_sources = [
|
|
|
|
"wslay_net.c",
|
|
|
|
"wslay_event.c",
|
|
|
|
"wslay_queue.c",
|
|
|
|
"wslay_stack.c",
|
|
|
|
"wslay_frame.c",
|
|
|
|
]
|
|
|
|
wslay_sources = [wslay_dir + s for s in wslay_sources]
|
|
|
|
env_ws.Prepend(CPPPATH=[wslay_dir + "includes/"])
|
|
|
|
env_ws.Append(CPPFLAGS=["-DHAVE_CONFIG_H"])
|
|
|
|
if env["platform"] == "windows" or env["platform"] == "uwp":
|
|
|
|
env_ws.Append(CPPFLAGS=["-DHAVE_WINSOCK2_H"])
|
|
|
|
else:
|
|
|
|
env_ws.Append(CPPFLAGS=["-DHAVE_NETINET_IN_H"])
|
|
|
|
env_wslay = env_ws.Clone()
|
|
|
|
env_wslay.disable_warnings()
|
|
|
|
env_wslay.add_source_files(env.modules_sources, wslay_sources)
|
|
|
|
|
|
|
|
env_ws.add_source_files(env.modules_sources, "*.cpp")
|