Skip to content

Commit 892d2a5

Browse files
committed
freedesktop.wayland-protocols-{stable,staging,unstable} 1.49:补上扩展协议
合成器要的不只是核心协议 —— xdg-shell 决定窗口怎么存在,linux-dmabuf 决定 gbm_bo 怎么交给客户端。上游只发 XML,所以生成器在 mcpplibs/wayland-protocols 里 跑一次、产物签进仓,消费者构建期不跑 scanner。 三个包而不是一个,因为一个链不起来 —— 这是实测不是猜: multiple definition of `zwp_linux_dmabuf_v1_interface' 按导出的 wl_interface 数:stable∩staging=0,stable∩unstable=13, staging∩unstable=0,任一 tier 内=0。tier 正好是它们能共存的边界,而且这个边界是 上游自己的目录结构。 三个 unstable 协议不发:xdg-shell-unstable-v5、linux-dmabuf-unstable-v1、 tablet-unstable-v2 —— 它们**就是**那 13 个重叠符号,而且各自都已被同名的 stable 协议取代。上游留着旧写法只为兼容,一个包不可能两个都发。 staging/unstable 依赖 stable 也是实测的:两者都引用 xdg_toplevel_interface, staging 还引用 zwp_tablet_tool_v2_interface。fork 内部用 path 依赖,所以 tarball 自洽 —— 但这带来一条消费者必须知道的规则:要 staging 就只写 staging, 同时写 stable 会报「既是 version dep 又是 path dep」。已写进 stable 的描述符。 体积在决定之前量过:65 个协议全部编出来 270KB 的 wl_interface 表,一个 4KB; 仓里那 3.5MB 几乎全是头文件,不 include 就不花钱。按协议拆会变成 65 个包换 270KB。
1 parent 201dd67 commit 892d2a5

6 files changed

Lines changed: 409 additions & 0 deletions

File tree

‎mcpp.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ members = [
8787
"tests/examples/wayland",
8888
"tests/examples/egl",
8989
"tests/examples/gl",
90+
"tests/examples/wayland-protocols",
9091
"tests/examples/libgbm",
9192
"tests/examples/libpng",
9293
"tests/examples/libwebp",
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
-- freedesktop.wayland-protocols-stable — the stable extension protocols,
2+
-- pre-generated.
3+
--
4+
-- ─────────────────────────────────────────────────────────────────────────
5+
-- WHY THIS IS A FORK AND NOT AN INLINE DESCRIPTOR
6+
--
7+
-- wayland-protocols ships **XML and nothing else**: 65 files under `stable/`,
8+
-- `staging/`, `unstable/` and `experimental/`, plus a pkg-config entry
9+
-- naming the directory. A consumer runs `wayland-scanner` over the ones it
10+
-- uses and compiles the result itself — there is no library to link and no
11+
-- header to include until someone generates them.
12+
--
13+
-- So an inline descriptor has nothing to compile. The generator runs once in
14+
-- [mcpplibs/wayland-protocols](https://github.com/mcpplibs/wayland-protocols)
15+
-- and the output is checked in, which is the same shape as
16+
-- `freedesktop.wayland`'s own protocol code and for the same reason:
17+
-- precomputable output belongs in the repo, not in every consumer's build.
18+
-- No scanner runs when you build against this — `mcpp build` is the whole
19+
-- toolchain — and the fork's CI regenerates with the ECOSYSTEM's
20+
-- `freedesktop.wayland-scanner`, so the generated code cannot drift from the
21+
-- library that marshals it.
22+
--
23+
-- ─────────────────────────────────────────────────────────────────────────
24+
-- WHY THREE PACKAGES AND NOT ONE
25+
--
26+
-- Because all 65 in one library DOES NOT LINK, and that was measured rather
27+
-- than feared. `staging/` and `unstable/` carry the same protocol at
28+
-- different maturity levels, and the scanner emits the same symbol names:
29+
--
30+
-- multiple definition of `zwp_linux_dmabuf_v1_interface'
31+
--
32+
-- Counted, per exported `wl_interface`:
33+
--
34+
-- stable n staging = 0 stable 21 exports
35+
-- stable n unstable = 13 staging 76
36+
-- staging n unstable = 0 unstable 69
37+
-- within any one tier = 0
38+
--
39+
-- The tier is exactly the boundary along which the protocols coexist, and it
40+
-- is upstream's own directory structure rather than a split invented here. A
41+
-- consumer names the tiers it needs; needing two spellings of one protocol is
42+
-- a real conflict, which is what upstream means by shipping XML.
43+
--
44+
-- HOW A CONSUMER NAMES THEM, and it is not "list what you want". staging and
45+
-- unstable depend on stable INSIDE the fork, as a path dependency, so naming
46+
-- both a tier and stable is an ERROR rather than a redundancy:
47+
--
48+
-- dependency 'freedesktop.wayland-protocols-stable' is requested as both a
49+
-- version dep (by your project) and a path dep (by
50+
-- 'freedesktop.wayland-protocols-staging.49'). Pick one.
51+
--
52+
-- So: want staging? name staging, and stable comes with it. Want only stable?
53+
-- name stable. Never both. tests/examples/wayland-protocols takes the first
54+
-- form and proves protocols from both tiers link into one program.
55+
--
56+
-- ─────────────────────────────────────────────────────────────────────────
57+
-- THE COST OF A WHOLE TIER, MEASURED
58+
--
59+
-- mcpp links a dependency's objects into the consumer, so naming a tier means
60+
-- carrying it. All 65 protocols compile to 270 KB of `wl_interface` tables —
61+
-- 4 KB each. The bulk of the fork is HEADERS (84,288 lines), and a header
62+
-- costs nothing until it is included. Splitting per protocol would mean 65
63+
-- packages for 270 KB.
64+
--
65+
-- `kind = "lib"`, not `"shared"`, and that matches upstream: there is no
66+
-- `libwayland-protocols.so` anywhere, because the marshalling tables are
67+
-- meant to be compiled INTO the program. A shared library would invent an ABI
68+
-- upstream does not have.
69+
package = {
70+
spec = "1",
71+
namespace = "freedesktop",
72+
name = "wayland-protocols-stable",
73+
description = "wayland-protocols stable — xdg-shell, linux-dmabuf-v1, tablet-v2, viewporter, presentation-time",
74+
licenses = {"MIT"},
75+
repo = "https://github.com/mcpplibs/wayland-protocols",
76+
type = "package",
77+
78+
xpm = {
79+
linux = {
80+
-- wayland-protocols' own release number. Upstream tags without a
81+
-- leading v, and so does the fork.
82+
["1.49"] = {
83+
url = {
84+
GLOBAL = "https://github.com/mcpplibs/wayland-protocols/archive/refs/tags/1.49.tar.gz",
85+
CN = "https://gitcode.com/mcpp-res/wayland-protocols/releases/download/1.49/wayland-protocols-1.49.tar.gz",
86+
},
87+
sha256 = "0f0f6039b9899699fb3228d5bff25e2a5e5a4792b1fa9964001f73387d7a25e4",
88+
},
89+
},
90+
},
91+
92+
mcpp = "*/mcpp/stable/mcpp.toml",
93+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
-- freedesktop.wayland-protocols-staging — the staging extension protocols,
2+
-- pre-generated.
3+
--
4+
-- ─────────────────────────────────────────────────────────────────────────
5+
-- WHY THIS IS A FORK AND NOT AN INLINE DESCRIPTOR
6+
--
7+
-- wayland-protocols ships **XML and nothing else**: 65 files under `stable/`,
8+
-- `staging/`, `unstable/` and `experimental/`, plus a pkg-config entry
9+
-- naming the directory. A consumer runs `wayland-scanner` over the ones it
10+
-- uses and compiles the result itself — there is no library to link and no
11+
-- header to include until someone generates them.
12+
--
13+
-- So an inline descriptor has nothing to compile. The generator runs once in
14+
-- [mcpplibs/wayland-protocols](https://github.com/mcpplibs/wayland-protocols)
15+
-- and the output is checked in, which is the same shape as
16+
-- `freedesktop.wayland`'s own protocol code and for the same reason:
17+
-- precomputable output belongs in the repo, not in every consumer's build.
18+
-- No scanner runs when you build against this — `mcpp build` is the whole
19+
-- toolchain — and the fork's CI regenerates with the ECOSYSTEM's
20+
-- `freedesktop.wayland-scanner`, so the generated code cannot drift from the
21+
-- library that marshals it.
22+
--
23+
-- ─────────────────────────────────────────────────────────────────────────
24+
-- WHY THREE PACKAGES AND NOT ONE
25+
--
26+
-- Because all 65 in one library DOES NOT LINK, and that was measured rather
27+
-- than feared. `staging/` and `unstable/` carry the same protocol at
28+
-- different maturity levels, and the scanner emits the same symbol names:
29+
--
30+
-- multiple definition of `zwp_linux_dmabuf_v1_interface'
31+
--
32+
-- Counted, per exported `wl_interface`:
33+
--
34+
-- stable n staging = 0 stable 21 exports
35+
-- stable n unstable = 13 staging 76
36+
-- staging n unstable = 0 unstable 69
37+
-- within any one tier = 0
38+
--
39+
-- The tier is exactly the boundary along which the protocols coexist, and it
40+
-- is upstream's own directory structure rather than a split invented here. A
41+
-- consumer names the tiers it needs; needing two spellings of one protocol is
42+
-- a real conflict, which is what upstream means by shipping XML.
43+
--
44+
-- staging and unstable are NOT self-contained, and that too is measured: both
45+
-- reference `xdg_toplevel_interface`, and staging also
46+
-- `zwp_tablet_tool_v2_interface` — stable defines them. Inside the fork that
47+
-- is a path dependency on the sibling member, so this tarball is
48+
-- self-contained and a consumer does not have to know.
49+
--
50+
-- ─────────────────────────────────────────────────────────────────────────
51+
-- THE COST OF A WHOLE TIER, MEASURED
52+
--
53+
-- mcpp links a dependency's objects into the consumer, so naming a tier means
54+
-- carrying it. All 65 protocols compile to 270 KB of `wl_interface` tables —
55+
-- 4 KB each. The bulk of the fork is HEADERS (84,288 lines), and a header
56+
-- costs nothing until it is included. Splitting per protocol would mean 65
57+
-- packages for 270 KB.
58+
--
59+
-- `kind = "lib"`, not `"shared"`, and that matches upstream: there is no
60+
-- `libwayland-protocols.so` anywhere, because the marshalling tables are
61+
-- meant to be compiled INTO the program. A shared library would invent an ABI
62+
-- upstream does not have.
63+
package = {
64+
spec = "1",
65+
namespace = "freedesktop",
66+
name = "wayland-protocols-staging",
67+
description = "wayland-protocols staging — the tier upstream expects to stabilise unchanged",
68+
licenses = {"MIT"},
69+
repo = "https://github.com/mcpplibs/wayland-protocols",
70+
type = "package",
71+
72+
xpm = {
73+
linux = {
74+
-- wayland-protocols' own release number. Upstream tags without a
75+
-- leading v, and so does the fork.
76+
["1.49"] = {
77+
url = {
78+
GLOBAL = "https://github.com/mcpplibs/wayland-protocols/archive/refs/tags/1.49.tar.gz",
79+
CN = "https://gitcode.com/mcpp-res/wayland-protocols/releases/download/1.49/wayland-protocols-1.49.tar.gz",
80+
},
81+
sha256 = "0f0f6039b9899699fb3228d5bff25e2a5e5a4792b1fa9964001f73387d7a25e4",
82+
},
83+
},
84+
},
85+
86+
mcpp = "*/mcpp/staging/mcpp.toml",
87+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
-- freedesktop.wayland-protocols-unstable — the unstable extension protocols,
2+
-- pre-generated.
3+
--
4+
-- ─────────────────────────────────────────────────────────────────────────
5+
-- WHY THIS IS A FORK AND NOT AN INLINE DESCRIPTOR
6+
--
7+
-- wayland-protocols ships **XML and nothing else**: 65 files under `stable/`,
8+
-- `staging/`, `unstable/` and `experimental/`, plus a pkg-config entry
9+
-- naming the directory. A consumer runs `wayland-scanner` over the ones it
10+
-- uses and compiles the result itself — there is no library to link and no
11+
-- header to include until someone generates them.
12+
--
13+
-- So an inline descriptor has nothing to compile. The generator runs once in
14+
-- [mcpplibs/wayland-protocols](https://github.com/mcpplibs/wayland-protocols)
15+
-- and the output is checked in, which is the same shape as
16+
-- `freedesktop.wayland`'s own protocol code and for the same reason:
17+
-- precomputable output belongs in the repo, not in every consumer's build.
18+
-- No scanner runs when you build against this — `mcpp build` is the whole
19+
-- toolchain — and the fork's CI regenerates with the ECOSYSTEM's
20+
-- `freedesktop.wayland-scanner`, so the generated code cannot drift from the
21+
-- library that marshals it.
22+
--
23+
-- ─────────────────────────────────────────────────────────────────────────
24+
-- WHY THREE PACKAGES AND NOT ONE
25+
--
26+
-- Because all 65 in one library DOES NOT LINK, and that was measured rather
27+
-- than feared. `staging/` and `unstable/` carry the same protocol at
28+
-- different maturity levels, and the scanner emits the same symbol names:
29+
--
30+
-- multiple definition of `zwp_linux_dmabuf_v1_interface'
31+
--
32+
-- Counted, per exported `wl_interface`:
33+
--
34+
-- stable n staging = 0 stable 21 exports
35+
-- stable n unstable = 13 staging 76
36+
-- staging n unstable = 0 unstable 69
37+
-- within any one tier = 0
38+
--
39+
-- The tier is exactly the boundary along which the protocols coexist, and it
40+
-- is upstream's own directory structure rather than a split invented here. A
41+
-- consumer names the tiers it needs; needing two spellings of one protocol is
42+
-- a real conflict, which is what upstream means by shipping XML.
43+
--
44+
-- THREE UNSTABLE PROTOCOLS ARE NOT SHIPPED, and they ARE that 13-symbol
45+
-- overlap: `xdg-shell-unstable-v5`, `linux-dmabuf-unstable-v1` and
46+
-- `tablet-unstable-v2`. Each was SUPERSEDED by a stable protocol of the same
47+
-- name — upstream keeps the old spelling only for compatibility — so shipping
48+
-- both would make this package unusable beside the stable one it depends on.
49+
-- The choice is forced, not editorial.
50+
--
51+
-- staging and unstable are NOT self-contained, and that too is measured: both
52+
-- reference `xdg_toplevel_interface`, and staging also
53+
-- `zwp_tablet_tool_v2_interface` — stable defines them. Inside the fork that
54+
-- is a path dependency on the sibling member, so this tarball is
55+
-- self-contained and a consumer does not have to know.
56+
--
57+
-- ─────────────────────────────────────────────────────────────────────────
58+
-- THE COST OF A WHOLE TIER, MEASURED
59+
--
60+
-- mcpp links a dependency's objects into the consumer, so naming a tier means
61+
-- carrying it. All 65 protocols compile to 270 KB of `wl_interface` tables —
62+
-- 4 KB each. The bulk of the fork is HEADERS (84,288 lines), and a header
63+
-- costs nothing until it is included. Splitting per protocol would mean 65
64+
-- packages for 270 KB.
65+
--
66+
-- `kind = "lib"`, not `"shared"`, and that matches upstream: there is no
67+
-- `libwayland-protocols.so` anywhere, because the marshalling tables are
68+
-- meant to be compiled INTO the program. A shared library would invent an ABI
69+
-- upstream does not have.
70+
package = {
71+
spec = "1",
72+
namespace = "freedesktop",
73+
name = "wayland-protocols-unstable",
74+
description = "wayland-protocols unstable — the zwp_*/zxdg_* protocols still in flux",
75+
licenses = {"MIT"},
76+
repo = "https://github.com/mcpplibs/wayland-protocols",
77+
type = "package",
78+
79+
xpm = {
80+
linux = {
81+
-- wayland-protocols' own release number. Upstream tags without a
82+
-- leading v, and so does the fork.
83+
["1.49"] = {
84+
url = {
85+
GLOBAL = "https://github.com/mcpplibs/wayland-protocols/archive/refs/tags/1.49.tar.gz",
86+
CN = "https://gitcode.com/mcpp-res/wayland-protocols/releases/download/1.49/wayland-protocols-1.49.tar.gz",
87+
},
88+
sha256 = "0f0f6039b9899699fb3228d5bff25e2a5e5a4792b1fa9964001f73387d7a25e4",
89+
},
90+
},
91+
},
92+
93+
mcpp = "*/mcpp/unstable/mcpp.toml",
94+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# wayland-protocols test project.
2+
#
3+
# THIS MEMBER DECLARES ITS OWN [indices]: an index is looked up BY NAMESPACE,
4+
# and the workspace root maps `compat`, so `freedesktop.*` would resolve
5+
# against the published index rather than the packages under test.
6+
[indices]
7+
freedesktop = { path = "../../.." }
8+
9+
[package]
10+
name = "wayland-protocols-tests"
11+
version = "0.1.0"
12+
standard = "c++23"
13+
14+
# ONLY staging is named, and stable arrives with it.
15+
#
16+
# staging depends on stable INSIDE the fork, as a path dependency — measured
17+
# necessity, not convention: staging references `xdg_toplevel_interface` and
18+
# `zwp_tablet_tool_v2_interface`, which stable defines. So naming both here is
19+
# an error rather than a redundancy:
20+
#
21+
# dependency freedesktop.wayland-protocols-stable is requested as both a
22+
# version dep (by wayland-protocols-tests) and a path dep (by
23+
# freedesktop.wayland-protocols-staging.49). Pick one.
24+
#
25+
# The rule that falls out: a project that wants staging names staging; one that
26+
# wants only stable names stable. Never both. This member takes the first form,
27+
# and the test then proves that protocols from BOTH tiers link into one
28+
# program — which is the property the three-package split exists to preserve.
29+
#
30+
# stable + unstable is the pair that CANNOT coexist (13 shared symbols). That
31+
# is upstream's semantics rather than a defect, and testing it would mean
32+
# asserting a link failure.
33+
[target.'cfg(linux)'.dependencies.freedesktop]
34+
wayland-protocols-staging = "1.49"

0 commit comments

Comments
 (0)