SCsub 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/usr/bin/env python
  2. Import('env')
  3. Import('env_modules')
  4. # Thirdparty source files
  5. env_lws = env_modules.Clone()
  6. if env['builtin_libwebsockets'] and not env["platform"] == "javascript": # already builtin for javascript
  7. thirdparty_dir = "#thirdparty/libwebsockets/"
  8. helper_dir = "win32helpers/"
  9. thirdparty_sources = [
  10. "core/alloc.c",
  11. "core/context.c",
  12. "core/libwebsockets.c",
  13. "core/output.c",
  14. "core/pollfd.c",
  15. "core/service.c",
  16. "event-libs/poll/poll.c",
  17. "misc/base64-decode.c",
  18. "misc/lejp.c",
  19. "misc/sha-1.c",
  20. "roles/h1/ops-h1.c",
  21. "roles/http/header.c",
  22. "roles/http/client/client.c",
  23. "roles/http/client/client-handshake.c",
  24. "roles/http/server/fops-zip.c",
  25. "roles/http/server/lejp-conf.c",
  26. "roles/http/server/parsers.c",
  27. "roles/http/server/server.c",
  28. "roles/listen/ops-listen.c",
  29. "roles/pipe/ops-pipe.c",
  30. "roles/raw/ops-raw.c",
  31. "roles/ws/client-ws.c",
  32. "roles/ws/client-parser-ws.c",
  33. "roles/ws/ops-ws.c",
  34. "roles/ws/server-ws.c",
  35. "tls/tls.c",
  36. "tls/tls-client.c",
  37. "tls/tls-server.c",
  38. "tls/mbedtls/wrapper/library/ssl_cert.c",
  39. "tls/mbedtls/wrapper/library/ssl_pkey.c",
  40. "tls/mbedtls/wrapper/library/ssl_stack.c",
  41. "tls/mbedtls/wrapper/library/ssl_methods.c",
  42. "tls/mbedtls/wrapper/library/ssl_lib.c",
  43. "tls/mbedtls/wrapper/library/ssl_x509.c",
  44. "tls/mbedtls/wrapper/platform/ssl_port.c",
  45. "tls/mbedtls/wrapper/platform/ssl_pm.c",
  46. "tls/mbedtls/lws-genhash.c",
  47. "tls/mbedtls/mbedtls-client.c",
  48. "tls/mbedtls/lws-genrsa.c",
  49. "tls/mbedtls/ssl.c",
  50. "tls/mbedtls/mbedtls-server.c"
  51. ]
  52. if env["platform"] == "android": # Builtin getifaddrs
  53. thirdparty_sources += ["misc/getifaddrs.c"]
  54. if env["platform"] == "windows" or env["platform"] == "uwp": # Winsock
  55. thirdparty_sources += ["plat/lws-plat-win.c", helper_dir + "getopt.c", helper_dir + "getopt_long.c", helper_dir + "gettimeofday.c"]
  56. else: # Unix socket
  57. thirdparty_sources += ["plat/lws-plat-unix.c"]
  58. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  59. env_lws.Append(CPPPATH=[thirdparty_dir])
  60. if env['builtin_mbedtls']:
  61. mbedtls_includes = "#thirdparty/mbedtls/include"
  62. env_lws.Prepend(CPPPATH=[mbedtls_includes])
  63. wrapper_includes = ["#thirdparty/libwebsockets/tls/mbedtls/wrapper/include/" + inc for inc in ["internal", "openssl", "platform", ""]]
  64. env_lws.Prepend(CPPPATH=wrapper_includes)
  65. if env["platform"] == "windows" or env["platform"] == "uwp":
  66. env_lws.Append(CPPPATH=[thirdparty_dir + helper_dir])
  67. if env["platform"] == "uwp":
  68. env_lws.Append(CCFLAGS=["/DLWS_MINGW_SUPPORT"])
  69. env_thirdparty = env_lws.Clone()
  70. env_thirdparty.disable_warnings()
  71. env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
  72. env_lws.add_source_files(env.modules_sources, "*.cpp")