summaryrefslogtreecommitdiff
path: root/modules/websocket/SCsub
blob: 15a88773e71c11c7feceee88e8184d6121acf23d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python

Import('env')
Import('env_modules')

# Thirdparty source files

env_lws = env_modules.Clone()

thirdparty_dir = "#thirdparty/libwebsockets/"
helper_dir = "win32helpers/"
thirdparty_sources = [

    "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"
]

if env_lws["platform"] == "android": # Builtin getifaddrs
    thirdparty_sources += ["misc/getifaddrs.c"]

if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp": # Winsock
    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])

    wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
    env_lws.Prepend(CPPPATH=wrapper_includes)

    if env['builtin_mbedtls']:
        mbedtls_includes = "#thirdparty/mbedtls/include"
        env_lws.Prepend(CPPPATH=[mbedtls_includes])

    if env_lws["platform"] == "windows" or env_lws["platform"] == "uwp":
        env_lws.Append(CPPPATH=[thirdparty_dir + helper_dir])

    if env_lws["platform"] == "uwp":
        env_lws.Append(CCFLAGS=["/DLWS_MINGW_SUPPORT"])

env_lws.add_source_files(env.modules_sources, "*.cpp")