2017-12-21 02:13:23 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
Import('env')
|
|
|
|
Import('env_modules')
|
|
|
|
|
|
|
|
# Thirdparty source files
|
|
|
|
|
|
|
|
env_lws = env_modules.Clone()
|
|
|
|
|
2018-06-07 08:46:05 +00:00
|
|
|
thirdparty_dir = "#thirdparty/libwebsockets/"
|
2017-12-21 02:13:23 +00:00
|
|
|
helper_dir = "win32helpers/"
|
|
|
|
thirdparty_sources = [
|
|
|
|
"client/client.c",
|
|
|
|
"client/client-handshake.c",
|
|
|
|
"client/client-parser.c",
|
|
|
|
"client/ssl-client.c",
|
|
|
|
|
|
|
|
"ext/extension.c",
|
|
|
|
"ext/extension-permessage-deflate.c",
|
|
|
|
|
|
|
|
"server/fops-zip.c",
|
|
|
|
"server/lejp-conf.c",
|
|
|
|
"server/parsers.c",
|
|
|
|
"server/ranges.c",
|
|
|
|
"server/server.c",
|
|
|
|
"server/server-handshake.c",
|
|
|
|
"server/ssl-server.c",
|
|
|
|
|
|
|
|
"misc/base64-decode.c",
|
|
|
|
"misc/lejp.c",
|
|
|
|
"misc/sha-1.c",
|
|
|
|
|
|
|
|
"alloc.c",
|
|
|
|
"context.c",
|
|
|
|
"handshake.c",
|
|
|
|
"header.c",
|
|
|
|
"libwebsockets.c",
|
|
|
|
"output.c",
|
|
|
|
"pollfd.c",
|
|
|
|
"service.c",
|
|
|
|
"ssl.c",
|
|
|
|
|
2018-02-08 21:06:09 +00:00
|
|
|
"mbedtls_wrapper/library/ssl_cert.c",
|
|
|
|
"mbedtls_wrapper/library/ssl_pkey.c",
|
|
|
|
"mbedtls_wrapper/library/ssl_stack.c",
|
|
|
|
"mbedtls_wrapper/library/ssl_methods.c",
|
|
|
|
"mbedtls_wrapper/library/ssl_lib.c",
|
|
|
|
"mbedtls_wrapper/library/ssl_x509.c",
|
|
|
|
"mbedtls_wrapper/platform/ssl_port.c",
|
|
|
|
"mbedtls_wrapper/platform/ssl_pm.c",
|
2017-12-21 02:13:23 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
if env_lws["platform"] == "android": # Builtin getifaddrs
|
|
|
|
thirdparty_sources += ["misc/getifaddrs.c"]
|
|
|
|
|
2018-02-20 14:03:57 +00:00
|
|
|
if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp": # Winsock
|
2017-12-21 02:13:23 +00:00
|
|
|
thirdparty_sources += ["plat/lws-plat-win.c", helper_dir + "getopt.c", helper_dir + "getopt_long.c", helper_dir + "gettimeofday.c"]
|
|
|
|
else: # Unix socket
|
|
|
|
thirdparty_sources += ["plat/lws-plat-unix.c"]
|
|
|
|
|
|
|
|
|
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
|
|
|
|
|
|
|
if env_lws["platform"] == "javascript": # No need to add third party libraries at all
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
env_lws.add_source_files(env.modules_sources, thirdparty_sources)
|
|
|
|
env_lws.Append(CPPPATH=[thirdparty_dir])
|
|
|
|
|
2018-06-07 08:46:05 +00:00
|
|
|
wrapper_includes = ["#thirdparty/libwebsockets/mbedtls_wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
|
2018-02-28 18:00:49 +00:00
|
|
|
env_lws.Prepend(CPPPATH=wrapper_includes)
|
2018-02-08 21:06:09 +00:00
|
|
|
|
2018-02-10 13:06:38 +00:00
|
|
|
if env['builtin_mbedtls']:
|
|
|
|
mbedtls_includes = "#thirdparty/mbedtls/include"
|
2018-02-28 18:00:49 +00:00
|
|
|
env_lws.Prepend(CPPPATH=[mbedtls_includes])
|
2017-12-21 02:13:23 +00:00
|
|
|
|
2018-02-20 14:03:57 +00:00
|
|
|
if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp":
|
2017-12-21 02:13:23 +00:00
|
|
|
env_lws.Append(CPPPATH=[thirdparty_dir + helper_dir])
|
|
|
|
|
2018-02-20 14:03:57 +00:00
|
|
|
if env_lws["platform"] == "uwp":
|
|
|
|
env_lws.Append(CCFLAGS=["/DLWS_MINGW_SUPPORT"])
|
|
|
|
|
2017-12-21 02:13:23 +00:00
|
|
|
env_lws.add_source_files(env.modules_sources, "*.cpp")
|