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