Skip to content

feat(pkg): compat.opencv 合一(源码直编 5.0.0 + FFmpeg videoio)+ compat.ffmpeg 瘦身#79

Merged
Sunrisepeak merged 5 commits into
mainfrom
feat/compat-opencv-unification
Jul 19, 2026
Merged

feat(pkg): compat.opencv 合一(源码直编 5.0.0 + FFmpeg videoio)+ compat.ffmpeg 瘦身#79
Sunrisepeak merged 5 commits into
mainfrom
feat/compat-opencv-unification

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Jul 18, 2026

Copy link
Copy Markdown
Member

draft 直到 mcpp#240 修复发版并升 CI pin(de-stub 后依赖包与消费者同名源即触发链接输入漏改名;OpenCV 自带两个 main.cpp × 消费者 src/main.cpp 几乎必踩)。已基于 workspace-only(#78,已合并)的 main 重排。

内容(用户决策 1/2 + R3 视频主线 + R4 unifont)

  • B0 合一:老 install()-CMake compat.opencv(4.13)删除,compat.opencv = 源码直编 5.0.0;compat.opencv5 过渡期保留(已发布 opencv 0.0.2 模块包依赖它),v0.0.3 切换后删。
  • B1 v2 regen(mcpp 0.0.97 de-stub):sources 改真实 tarball 路径(385 文件 → 19 个目录/花括号 glob),457-TU 转发 stub 层撤销;只留字体/OpenCL 内核/jpeg12+16 重复编译走 build.mcpp(组前缀唯一 basename,规避 mcpp#239)。WITH_FFMPEG=ON:cap_ffmpeg 进 videoio 组,描述符 deps = { ["compat.ffmpeg"] = "8.1.2" }(compat 依赖 compat 首例)。111KB → 102KB。
  • B4 compat.ffmpeg 瘦身:2281 条显式 sources → 28 个 glob;展开集逐文件相等(脚本断言),其余段 byte 级一致。337KB → 267KB。
  • R4 unifont feature:数据资产包 compat.opencv-unifont(上游 raw url + CN 镜像 mcpp-res/opencv@unifont-1.0.0)+ compat.opencv feature unifont(0.0.97 features 的 deps/defines 门控)+ build.mcpp 按 MCPP_FEATURE_UNIFONT 嵌字体;成员 tests/examples/opencv-unifont 断言 FontFace("uni") + CJK putText 出墨(该内建字体面只在 HAVE_UNIFONT 下存在,本身即探针)。
  • 成员:tests/examples/opencv 重写为 compat.opencv 5.0.0 + 真实 mp4 编→解码回环(CAP_FFMPEG 双向 10 帧,R3 在 compat 层的验收)。

本地验证

  • 消费端 fresh 全链:OpenCV 5.0.0 FFmpeg mp4 roundtrip ok: 10 frames encoded+decoded (9 backends)
  • mcpp test -p opencv ✅ · -p opencv-unifont ✅(feature 依赖解析 + 字体嵌入 + CJK ink)· 默认成员回归 ✅ · 3 个新/改描述符 xpkg parse + mirror lint ✅。

过程发现(已提 issue)

mcpp#240(合并门槛)、#239(对象树逃逸)、#241(build.mcpp 缺 MCPP_DEP__DIR,unifont 暂用 store runtimedir 约定自寻)。

Sunrisepeak added a commit that referenced this pull request Jul 18, 2026
fetch 'compat.opencv@4.13.0' fails deterministically (2/2) on the
windows leg under mcpp 0.0.97. Not investigating: the install() CMake
form is replaced wholesale by the source-build compat.opencv in the
unification PR (#79); until then the member covers linux+macos.
@Sunrisepeak
Sunrisepeak force-pushed the feat/compat-opencv-unification branch from f46a2be to 06f1897 Compare July 18, 2026 16:58
Sunrisepeak added a commit that referenced this pull request Jul 18, 2026
…78)

* ci: mcpp 0.0.97 — drop the mcpp#232 index-refresh pre-step, retire per-package module smoke jobs

0.0.97 carries the default-namespace index redirect (R6), the synchronous
nasm bootstrap (#232), obj-path disambiguation (#233), spacey-defines
quoting (#234) and purview-include tracking (#235). The three module smoke
jobs (imgui-module/ffmpeg-module/opencv-module) and the tinyhttps smoke
step are deleted — the module packages are ordinary workspace members now
(next commit), so 'workspace' is the single build/run channel.

* feat(tests): public module packages as workspace members (zero shell)

tinyhttps/imgui/ffmpeg/opencv consume their bare names from THIS checkout
via a member-level '[indices] default = { path = "../../.." }' (mcpp >=
0.0.97). Test sources are line-for-line ports of the smoke consumers
(assertions unchanged); ffmpeg/opencv/imgui members are cfg(linux)-gated
to the CI-validated surface with no-op mains elsewhere. The four reseeding
smoke shells are deleted.

Notes:
- exactly ONE [indices] entry per member: xlings fails silently with >1
  project-scoped index repo (mcpp#238); root-level centralization (#224)
  is deferred until that lands.
- the old smoke's llvm@20.1.7 pin for imgui is dropped: it predates gcc16
  module support; imgui-m upstream CI builds with gcc@16.1.0 (verified
  locally: member passes with the workspace default toolchain).

* docs: workspace-only testing — README, schema/CI reference, add-package skill, design doc

Also retires two-generations-stale CI descriptions (detect/smoke-examples/
run_example.sh) from docs/repository-and-schema.md.

* ci: gate the install()-form opencv member off windows

fetch 'compat.opencv@4.13.0' fails deterministically (2/2) on the
windows leg under mcpp 0.0.97. Not investigating: the install() CMake
form is replaced wholesale by the source-build compat.opencv in the
unification PR (#79); until then the member covers linux+macos.
…deoio backend; compat.ffmpeg slimmed

B0: the old install()-CMake compat.opencv (4.13) is replaced by the
source-build form (per the one-compat.opencv decision); compat.opencv5
stays as a transition alias until the opencv module package switches.

B1 (v2 regen, mcpp 0.0.97): de-stub — sources are real tarball paths
(385 files compressed to 19 dir/brace globs, #228), flags on real-path
globs; only fonts/CL-kernels/jpeg12+16 re-compiles stay in build.mcpp
(group-prefixed stub basenames dodge mcpp#239). WITH_FFMPEG=ON reference
build; descriptor deps on compat.ffmpeg 8.1.2 (first compat->compat
dependency). 111KB -> 100KB.

B4: compat.ffmpeg sources 2281 explicit files -> 28 globs (expansion
verified file-for-file identical; every other section byte-identical).
337KB -> 267KB.

tests/examples/opencv rewritten for compat.opencv 5.0.0 with a real
mp4 encode->decode roundtrip via CAP_FFMPEG (R3 acceptance at the
compat layer); passes locally.

DO NOT MERGE before mcpp#240 (post-#233 link inputs miss the
disambiguated object names when dep and consumer share a source
basename — consumers named src/main.cpp would break) ships in a
release and the CI pin is bumped.
@Sunrisepeak
Sunrisepeak force-pushed the feat/compat-opencv-unification branch from 06f1897 to c610e07 Compare July 18, 2026 17:28
…et package (R4)

- pkgs/c/compat.opencv-unifont.lua: data-only asset package for the
  upstream WenQuanYiMicroHei.ttf.gz (GLOBAL = the pinned opencv_3rdparty
  raw url, CN = mcpp-res/opencv@unifont-1.0.0, sha256-pinned; raw .gz
  payloads are parked byte-preserved in the store's shared runtimedir,
  so the descriptor carries an asio-style anchor-TU mcpp shell).
- compat.opencv feature `unifont` (mcpp 0.0.97 features now gate deps +
  defines): pulls the asset package and defines HAVE_UNIFONT; the
  embedded build.mcpp sees MCPP_FEATURE_UNIFONT=1 and hex-embeds the
  compressed font as builtin_font_uni.h (OcvBuiltinFontUni), byte-
  faithful to cmake's ocv_blob2hdr. Payload located via the store
  runtimedir convention (no MCPP_DEP_<NAME>_DIR contract var yet).
- tests/examples/opencv-unifont member: long-form feature dependency;
  asserts FontFace("uni") usability (that builtin only exists under
  HAVE_UNIFONT — the probe itself) + real CJK putText ink. Passes
  locally; default member regression clean.
…tive sources (R5, compat layer)

Reference build switches to BUILD_LIST+dnn (vendored protobuf compiled,
flatbuffers/dlpack header-only, mlas incl. 8 .S kernels); the generator
cross-asserts the feature-off TU set is file-for-file identical to the
non-dnn reference build (BASE_BLD env). features.dnn = 309 sources -> 23
globs + HAVE_OPENCV_DNN. Profile-drifting snapshot trio proved benign
(build-dir path now neutralized by rewrite; HAVE_OPENCV_DNN consumed by
no TU -> featureDefines; version string cosmetic) so no variant
machinery. ISA overlays now keyed per (group, ISA); -isystem dirs join
include_dirs (protobuf headers were dropped before).

Three curated exceptions, each commented in the generator: mlas group
_GNU_SOURCE; platform.cpp -include unistd.h (upstream leans on
transitive includes); MlasHGemmSupported stub (declared+called but not
vendored — upstream's archive-selective linking hides it, mcpp's
whole-object linking doesn't; false = correct fallback). Second
same-source re-compile case (mlas_threading.cpp) rides the tu-stub
manifest with a new `?dnn` feature-guard prefix.

New member tests/examples/opencv-dnn (blobFromImage NCHW value check +
Net; test file deliberately not named dnn.cpp — collides with the dep's
modules/dnn/src/dnn.cpp, #233-family test-scan gap, noted on #240).
Local: dnn member + feature-off roundtrip + unifont + default members
all green. Descriptor 130KB.
…ce-build OpenCV

mcpp 0.0.98 closes the obj-path disambiguation follow-ups that gated the
source-build compat.opencv unification: #240 (link inputs now follow the
disambiguated object names — a dependency + consumer sharing a source
basename like src/main.cpp no longer 'obj/main.o missing and no known
rule', which is near-universal since OpenCV ships modules/*/src/main.cpp)
and #239 (absolute/`..` dep-generated source paths sanitized so objects
stay under obj/). Bump the pin in all four places (env + 3 matrix legs).

Raise the workspace job timeout 60 -> 150. The previous run was cancelled
at the 60-min cap mid-build (not a #240 error): a full run — forced because
this workflow file is in the diff — serially source-builds several OpenCV
variants on one runner (compat.opencv base + unifont + dnn, plus the
transition-window compat.opencv5 pulled by opencv-module). 150 covers the
one-time cold full build; the registry cache amortizes subsequent runs, and
the transition double-build retires when opencv-m moves to compat.opencv.

Floor comments elsewhere stay "mcpp >= 0.0.97" — they mark where a grammar
feature first landed, not the CI pin.
@Sunrisepeak
Sunrisepeak marked this pull request as ready for review July 18, 2026 23:16
@Sunrisepeak
Sunrisepeak merged commit 9547103 into main Jul 19, 2026
5 checks passed
Sunrisepeak added a commit that referenced this pull request Jul 19, 2026
…v5 transition alias

opencv-m v0.0.3 switched its dependency from the transitional compat.opencv5
alias to the unified compat.opencv (source build + FFmpeg videoio). With the
module package now on compat.opencv, the alias has no remaining consumers, so
this bump completes the transition decided in #79:

- pkgs/o/opencv.lua: 0.0.2 -> 0.0.3 (v0.0.3 tarball GLOBAL + CN mirror,
  sha256 92ffae8b…; byte-identical, mirror-cn-reachable verified). Form A —
  the compat.opencv dep lives in the tarball's mcpp.toml.
- delete pkgs/c/compat.opencv5.lua and the tests/examples/opencv5 member
  (redundant with the opencv base member; opencv-module now exercises
  compat.opencv transitively via opencv 0.0.3).
- tests/examples/opencv-module: pin opencv 0.0.3, fix compat.opencv comments.
- README + opencv.lua comments: compat.opencv5 -> compat.opencv, note the
  alias is retired.

xpkg parse + lua load green locally on mcpp 0.0.98.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant