Skip to content

Commit 997080c

Browse files
authored
Declare GLFW GLX runtime metadata
Declare compat.glfw runtime metadata for GLX/OpenGL package validation.
1 parent c5bee46 commit 997080c

4 files changed

Lines changed: 109 additions & 2 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# mcpp-index: GL Runtime Packages Plan
2+
3+
> 状态: active
4+
> 分支: `codex/gl-runtime-closure-index`
5+
> PR: pending
6+
> Last updated: 2026-06-03
7+
> 目标: 让 GLFW/OpenGL 相关包描述表达标准运行时需求,而不是依赖 smoke 脚本里的临时 `LD_LIBRARY_PATH` shim。
8+
9+
## Scope
10+
11+
This repository owns package metadata and package-level smoke tests. It should
12+
model OpenGL headers, GL dispatch/runtime libraries, and system GPU/display
13+
requirements as separate concepts.
14+
15+
## Package Boundary
16+
17+
- `compat.opengl`
18+
- Keep as Khronos OpenGL registry/header provider.
19+
- Do not turn it into a host driver wrapper.
20+
- `compat.glfw`
21+
- Owns GLFW source build and X11/GLX backend selection.
22+
- Should declare runtime requirements for the GLX libraries it loads through
23+
GLFW's upstream `dlopen` behavior.
24+
- `compat.glvnd` or `compat.libglvnd`
25+
- New standard runtime package candidate for GL dispatch libraries:
26+
`libOpenGL.so`, `libGL.so`, `libGLX.so`, `libGLdispatch.so`.
27+
- `compat.mesa-llvmpipe`
28+
- Optional follow-up for self-contained software rendering and CI/headless
29+
validation. This is larger and should not block the first metadata path.
30+
- Host GPU/OpenGL driver
31+
- Model as a system capability such as `opengl.glx.driver`.
32+
- Do not silently pretend vendor drivers are normal redistributable packages.
33+
34+
## Implementation Plan
35+
36+
- [x] Create this repository-level plan checkpoint.
37+
- [ ] Keep `compat.opengl` header-only and update docs if needed.
38+
- Candidate file: `pkgs/c/compat.opengl.lua`.
39+
- [ ] Add a GL runtime provider package.
40+
- Candidate file: `pkgs/c/compat.glvnd.lua`.
41+
- The first version may expose libglvnd runtime/headers if the source build
42+
is practical in current mcpp package descriptors.
43+
- If libglvnd source packaging is not yet practical, keep this task open and
44+
document the exact blocker rather than replacing it with a host shim.
45+
- [x] Update `compat.glfw` runtime metadata.
46+
- Candidate file: `pkgs/c/compat.glfw.lua`.
47+
- Declare `dlopen_libs = {"libGLX.so.0", "libGL.so.1", "libGL.so"}`.
48+
- Declare `capabilities = {"x11.display", "opengl.glx.driver"}` for Linux
49+
X11/GLX window execution.
50+
- Keep X11 link/runtime packages as normal dependencies.
51+
- [ ] Replace script-only GL runtime behavior in the window smoke.
52+
- Candidate file: `tests/smoke_compat_imgui_window.sh`.
53+
- The target behavior is `mcpp run` with package-declared runtime metadata.
54+
- The existing host shim may remain only as diagnostic evidence until the
55+
mcpp runtime metadata support lands.
56+
- [x] Add README package semantics.
57+
- Candidate file: `README.md`.
58+
- Document the difference between OpenGL headers, GL runtime dispatch, and
59+
host display/GPU capabilities.
60+
61+
## Verification
62+
63+
- [x] `lua5.4 -e "assert(loadfile('pkgs/c/compat.glfw.lua', 't'))"`
64+
- [x] `lua5.4 -e "assert(loadfile('pkgs/c/compat.opengl.lua', 't'))"`
65+
- [x] Lua syntax check for all `pkgs/**/*.lua`
66+
- [x] `bash -n tests/smoke_compat_imgui_window.sh`
67+
- [x] Static metadata check: `compat.glfw` contains `dlopen_libs`,
68+
`libGLX.so.0`, and `opengl.glx.driver`.
69+
- [ ] `MCPP=<mcpp> tests/smoke_compat_imgui.sh`
70+
- [ ] `MCPP=<mcpp> tests/smoke_compat_imgui_window.sh`
71+
- Attempted locally on 2026-06-03; the run was stopped after the temporary
72+
sandbox stalled in dependency installation. This remains unchecked until a
73+
full smoke completes.
74+
- [ ] `MCPP=<mcpp> MCPP_INDEX_RUN_WINDOW_SMOKE=1 tests/smoke_compat_imgui_window.sh`
75+
- [ ] A focused GLFW/OpenGL smoke that uses `mcpp run` without script-local
76+
`LD_LIBRARY_PATH` once mcpp runtime metadata support is available.
77+
78+
## PR / CI / Merge Notes
79+
80+
- [x] Commit this plan as the first checkpoint.
81+
- [ ] Open a PR with sanitized paths and no local machine details.
82+
- [ ] Include a test plan and note which runtime checks require a display.
83+
- [ ] Wait for repository validation CI.
84+
- [ ] Squash merge after required checks pass.
85+
86+
## Cross-Repository Dependencies
87+
88+
- Depends on `mcpp` runtime metadata support for the final no-shim run smoke.
89+
- Feeds `imgui-m` validation by making its window example runnable through
90+
standard package metadata.
91+
- Does not require `xim-pkgindex` until a released mcpp or package-index update
92+
needs to be mirrored or distributed through xlings.

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ mcpp 0.0.3+ 的 transitive walker 自动沿链路传播头文件和依赖,消费
112112

113113
> 当前 X11/XCB/Xau/Xdmcp 以及 GLFW 需要的 Xcursor/Xext/Xfixes/Xi/Xinerama/
114114
> Xrandr/Xrender 都已按上游源码提供 runtime `.so``compat.glfw` 仍沿用
115-
> GLFW 上游的 GLX/OpenGL 动态加载行为,窗口运行时需要宿主环境提供可用的
116-
> X server/GLX/OpenGL 驱动。
115+
> GLFW 上游的 GLX/OpenGL 动态加载行为,包描述会声明需要 `dlopen`
116+
> `libGLX.so.0`/`libGL.so.1`/`libGL.so` 以及 `opengl.glx.driver` 能力。
117+
> 窗口运行时仍需要宿主环境提供可用的 X server/GLX/OpenGL 驱动。
117118
118119
### 本地 smoke 验证
119120

pkgs/c/compat.glfw.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ package = {
5454
},
5555
linux = {
5656
cflags = { "-D_DEFAULT_SOURCE", "-D_GLFW_X11" },
57+
runtime = {
58+
dlopen_libs = { "libGLX.so.0", "libGL.so.1", "libGL.so" },
59+
capabilities = { "x11.display", "opengl.glx.driver" },
60+
},
5761
sources = {
5862
"src/x11_init.c",
5963
"src/x11_monitor.c",

tests/smoke_compat_imgui_window.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ if [[ -z "$MCPP_BIN" || ! -x "$MCPP_BIN" ]]; then
1414
exit 1
1515
fi
1616

17+
glfw_pkg="$ROOT/pkgs/c/compat.glfw.lua"
18+
grep -q 'dlopen_libs' "$glfw_pkg" || {
19+
echo "FATAL: compat.glfw missing GLX/OpenGL dlopen runtime metadata" >&2
20+
exit 1
21+
}
22+
grep -q 'opengl.glx.driver' "$glfw_pkg" || {
23+
echo "FATAL: compat.glfw missing OpenGL GLX system capability metadata" >&2
24+
exit 1
25+
}
26+
1727
TMP="$(mktemp -d)"
1828
if [[ "${MCPP_INDEX_KEEP_SMOKE_TMP:-0}" == "1" ]]; then
1929
echo "KEEP: $TMP"

0 commit comments

Comments
 (0)