-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcompat.usockets.lua
More file actions
90 lines (88 loc) · 4.04 KB
/
Copy pathcompat.usockets.lua
File metadata and controls
90 lines (88 loc) · 4.04 KB
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
-- compat.usockets — uSockets, the C eventing/networking layer under uWebSockets.
-- A consumer writes `#include <libusockets.h>`.
--
-- Shape A, plus two defines that are INTERFACE facts rather than private ones.
--
-- BACKEND: libuv, on every platform. uSockets 0.8.8 ships four event loops —
-- epoll/kqueue (POSIX only), GCD (macOS), libuv, and asio. Only libuv covers all
-- three platforms with ONE source list, and it is also the backend the ecosystem
-- has the most mileage on (it is what vcpkg's uwebsockets port selects). The
-- alternative — a per-platform backend — would make `us_loop_t` a different
-- struct per platform for no gain.
--
-- SSL: OFF. crypto/openssl.c and crypto/sni_tree.cpp are not compiled and
-- compat.openssl is not depended on, so the base package has ZERO external
-- dependencies beyond libuv. A TLS feature belongs here eventually; it is a
-- feature rather than a default because terminating TLS in-process is a choice,
-- and paying for OpenSSL when you have not made it is not.
--
-- ALSO OUT: quic.c (needs lsquic) and eventing/io_uring.c (Linux only, and a
-- second Linux backend would contradict the one-backend rule above).
--
-- WHY THE DEFINES REACH CONSUMERS. `libusockets.h` — the PUBLIC header — changes
-- the layout of `us_loop_t` under LIBUS_USE_LIBUV and gates its SSL declarations
-- on LIBUS_NO_SSL. A consumer that does not see the same pair gets a different
-- struct than the library was compiled with, and the mismatch surfaces as
-- corruption at run time rather than an error at build time. An index
-- descriptor's `cflags` reach only this package's own TUs, so a CONSUMER must
-- declare them too — uWebSockets does, and so must anything using uSockets
-- directly.
package = {
spec = "1",
namespace = "compat",
name = "usockets",
description = "uSockets: eventing and networking layer under uWebSockets (libuv backend, no SSL)",
licenses = {"Apache-2.0"},
repo = "https://github.com/uNetworking/uSockets",
type = "package",
xpm = {
linux = {
["0.8.8"] = {
url = {
GLOBAL = "https://github.com/uNetworking/uSockets/archive/refs/tags/v0.8.8.tar.gz",
CN = "https://gitcode.com/mcpp-res/usockets/releases/download/0.8.8/usockets-0.8.8.tar.gz",
},
sha256 = "d14d2efe1df767dbebfb8d6f5b52aa952faf66b30c822fbe464debaa0c5c0b17",
},
},
macosx = {
["0.8.8"] = {
url = {
GLOBAL = "https://github.com/uNetworking/uSockets/archive/refs/tags/v0.8.8.tar.gz",
CN = "https://gitcode.com/mcpp-res/usockets/releases/download/0.8.8/usockets-0.8.8.tar.gz",
},
sha256 = "d14d2efe1df767dbebfb8d6f5b52aa952faf66b30c822fbe464debaa0c5c0b17",
},
},
windows = {
["0.8.8"] = {
url = {
GLOBAL = "https://github.com/uNetworking/uSockets/archive/refs/tags/v0.8.8.tar.gz",
CN = "https://gitcode.com/mcpp-res/usockets/releases/download/0.8.8/usockets-0.8.8.tar.gz",
},
sha256 = "d14d2efe1df767dbebfb8d6f5b52aa952faf66b30c822fbe464debaa0c5c0b17",
},
},
},
mcpp = {
language = "c++23",
import_std = false,
c_standard = "c11",
-- src/ carries the public <libusockets.h>; the internal headers are
-- included flat from within it.
include_dirs = { "*/src" },
sources = {
"*/src/bsd.c",
"*/src/context.c",
"*/src/loop.c",
"*/src/socket.c",
"*/src/udp.c",
"*/src/eventing/libuv.c",
},
cflags = { "-DLIBUS_USE_LIBUV", "-DLIBUS_NO_SSL" },
cxxflags = { "-DLIBUS_USE_LIBUV", "-DLIBUS_NO_SSL" },
targets = { ["uSockets"] = { kind = "lib" } },
deps = { ["compat.libuv"] = "1.48.0" },
windows = { ldflags = { "-lws2_32" } },
},
}