Skip to content

Commit 3e785ee

Browse files
committed
feat(ftxui): add 7.0.3
Source layout is unchanged (include/ftxui + src/ftxui/{screen,dom, component,util}), so the 6.1.9 globs apply verbatim, and the public header API the core smoke test uses (hbox/text/separator, Dimension::Fit, Screen::Create(Dimensions, Dimensions), Render) is source-compatible with 6.1.9. Upstream added C++20 module units (src/ftxui/*.cppm, FTXUI_BUILD_MODULES off by default); the `*.cpp` globs never match them. 7.0.3 ships 47 *_test.cpp / 6 *_fuzzer.cpp, still covered by the existing exclusions. One skew the globs cannot express (no per-version build blocks, mcpp-community/mcpp#290): FTXUI 7 moved Loop's method definitions from loop.cpp into app.cpp and dropped loop.cpp from the CMake build, but the stale file still ships in the 7.0.3 tarball. Compiling both duplicates Loop::{~Loop,RunOnce,...} at the consumer's link (a dependency's objects all enter the link — no lazy archive selection). 6.1.9 has no app.cpp and genuinely needs loop.cpp, so a small install() hook (same normalisation pattern as compat.eui-neo) deletes loop.cpp only when app.cpp exists — exactly the 7.x layout. No CN mirror yet (never published to mcpp-res); plain-string GLOBAL fallback, same as eui-neo 0.5.7. sha256 double-checked against the GitHub tag archive. Verified locally (mcpp 2026.8.29.1): `mcpp test -p core` passes on both 7.0.3 and 6.1.9 (the latter through the new hook, confirming loop.cpp is kept there); check_mirror_urls, check_package_name, check_platform_version_parity, check_duplicate_versions, check_cross_package_refs and `mcpp xpkg parse` all green.
1 parent 89cfee7 commit 3e785ee

2 files changed

Lines changed: 80 additions & 7 deletions

File tree

pkgs/c/compat.ftxui.lua

Lines changed: 79 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
-- M6.x glob-aware Form B descriptor for FTXUI 6.1.9.
1+
-- M6.x glob-aware Form B descriptor for FTXUI 6.1.9 and 7.0.3.
22
--
33
-- Pure C++ library (no C++23 modules); compiled sources + public headers.
4-
-- Uses mcpp 0.0.4's glob exclusion (`!` prefix) to skip the ~46
4+
-- Uses mcpp 0.0.4's glob exclusion (`!` prefix) to skip the
55
-- *_test.cpp / *_fuzzer.cpp files that live alongside the library
6-
-- sources in the same directories.
6+
-- sources in the same directories (6.1.9: ~30 test / ~16 fuzzer;
7+
-- 7.0.3: 47 test / 6 fuzzer).
8+
--
9+
-- 7.0.3: source layout is unchanged (include/ftxui + src/ftxui/{screen,dom,
10+
-- component,util}), so the 6.1.9 globs apply verbatim, and the public header
11+
-- API this index's smoke test uses (hbox/text/separator, `Dimension::Fit`,
12+
-- `Screen::Create(Dimensions, Dimensions)`, `Render`) is source-compatible
13+
-- with 6.1.9. Upstream added C++20 module units (src/ftxui/*.cppm,
14+
-- FTXUI_BUILD_MODULES, off by default); the `*.cpp` globs never match them,
15+
-- and the plain .cpp sources still compile header-only style.
16+
--
17+
-- ONE version skew the globs cannot express (no per-version build blocks,
18+
-- mcpp-community/mcpp#290): FTXUI 7 moved Loop's method definitions from
19+
-- loop.cpp into app.cpp and dropped loop.cpp from the CMake build, but the
20+
-- stale file still ships in the 7.0.3 tarball. Compiling both duplicates
21+
-- `Loop::{~Loop,RunOnce,...}` at the consumer's link (a dependency's objects
22+
-- ALL enter the link — no lazy archive selection). 6.1.9 has no app.cpp and
23+
-- genuinely needs loop.cpp. The install() hook below deletes loop.cpp only
24+
-- when app.cpp exists, i.e. exactly on the 7.x layout.
725
--
826
-- Produces a single static archive `libftxui.a` covering all three
927
-- upstream cmake targets (ftxui-screen, ftxui-dom, ftxui-component).
@@ -26,6 +44,13 @@ package = {
2644
},
2745
sha256 = "45819c1e54914783d4a1ca5633885035d74146778a1f74e1213cdb7b76340e71",
2846
},
47+
-- 7.0.3 has no CN mirror yet (never published to mcpp-res);
48+
-- plain-string GLOBAL fallback. Flip to { GLOBAL, CN } if it gets
49+
-- mirrored — sha256 stays the same.
50+
["7.0.3"] = {
51+
url = "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v7.0.3.tar.gz",
52+
sha256 = "e7c62ffe19009759821b4f0f8df7f2a6fb83784c3a9f1477d81f56d3ee723c88",
53+
},
2954
},
3055
macosx = {
3156
["6.1.9"] = {
@@ -35,6 +60,13 @@ package = {
3560
},
3661
sha256 = "45819c1e54914783d4a1ca5633885035d74146778a1f74e1213cdb7b76340e71",
3762
},
63+
-- 7.0.3 has no CN mirror yet (never published to mcpp-res);
64+
-- plain-string GLOBAL fallback. Flip to { GLOBAL, CN } if it gets
65+
-- mirrored — sha256 stays the same.
66+
["7.0.3"] = {
67+
url = "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v7.0.3.tar.gz",
68+
sha256 = "e7c62ffe19009759821b4f0f8df7f2a6fb83784c3a9f1477d81f56d3ee723c88",
69+
},
3870
},
3971
windows = {
4072
["6.1.9"] = {
@@ -44,19 +76,26 @@ package = {
4476
},
4577
sha256 = "45819c1e54914783d4a1ca5633885035d74146778a1f74e1213cdb7b76340e71",
4678
},
79+
-- 7.0.3 has no CN mirror yet (never published to mcpp-res);
80+
-- plain-string GLOBAL fallback. Flip to { GLOBAL, CN } if it gets
81+
-- mirrored — sha256 stays the same.
82+
["7.0.3"] = {
83+
url = "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v7.0.3.tar.gz",
84+
sha256 = "e7c62ffe19009759821b4f0f8df7f2a6fb83784c3a9f1477d81f56d3ee723c88",
85+
},
4786
},
4887
},
4988

5089
-- Form B `mcpp` segment: paths are globs relative to the verdir.
51-
-- The leading `*/` absorbs the GitHub tarball's `FTXUI-6.1.9/` wrap.
90+
-- The leading `*/` absorbs the GitHub tarball's `FTXUI-<ver>/` wrap.
5291
mcpp = {
5392
language = "c++23",
5493
import_std = false, -- pure compiled lib, no `import std;`
5594
include_dirs = { "*/include", "*/src" }, -- src/ for private headers (box_helper.hpp etc.),
5695
sources = {
5796
"*/src/ftxui/**/*.cpp",
58-
"!*/src/ftxui/**/*_test.cpp", -- 30+ gtest files
59-
"!*/src/ftxui/**/*_fuzzer.cpp", -- ~16 fuzz targets
97+
"!*/src/ftxui/**/*_test.cpp", -- gtest files (30+ in 6.1.9, 47 in 7.0.3)
98+
"!*/src/ftxui/**/*_fuzzer.cpp", -- fuzz targets (16 in 6.1.9, 6 in 7.0.3)
6099
},
61100
targets = { ["ftxui"] = { kind = "lib" } },
62101
deps = { },
@@ -65,3 +104,37 @@ package = {
65104
},
66105
},
67106
}
107+
108+
import("xim.libxpkg.pkginfo")
109+
110+
function install()
111+
-- Reproduce the default unpack shape — install_dir/<wrap>/src/... — so
112+
-- the descriptor's `*/` globs keep matching exactly one wrap level (same
113+
-- normalisation as compat.eui-neo). ⚠️ NO SHELL and no directory listing
114+
-- in this sandbox: the wrap is asked about by name, not discovered.
115+
local v = pkginfo.version()
116+
local idir = pkginfo.install_dir()
117+
local layer = path.join(idir, "FTXUI-" .. v)
118+
os.tryrm(idir)
119+
os.mkdir(idir)
120+
for _, name in ipairs({ "FTXUI-" .. v, "ftxui-" .. v,
121+
"FTXUI-v" .. v, "ftxui-v" .. v }) do
122+
if os.isfile(path.join(name, "CMakeLists.txt")) then
123+
os.mv(name, layer)
124+
break
125+
end
126+
end
127+
if not os.isfile(path.join(layer, "CMakeLists.txt")) then
128+
log.error("ftxui: no CMakeLists.txt under %s after unpacking; the "
129+
.. "archive layout is neither wrapped nor flat", layer)
130+
return false
131+
end
132+
133+
-- See the header comment: drop the stale loop.cpp on the 7.x layout
134+
-- (app.cpp present) where its Loop methods are duplicated; keep it for
135+
-- 6.1.9, which has no app.cpp.
136+
if os.isfile(path.join(layer, "src", "ftxui", "component", "app.cpp")) then
137+
os.tryrm(path.join(layer, "src", "ftxui", "component", "loop.cpp"))
138+
end
139+
return true
140+
end

tests/examples/core/mcpp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ version = "0.1.0"
77

88
[dependencies.compat]
99
gtest = { version = "1.15.2", features = ["main"] }
10-
ftxui = "6.1.9"
10+
ftxui = "7.0.3"
1111
lua = "5.4.7"
1212
mbedtls = "3.6.1"
1313
opengl = "2026.05.31"

0 commit comments

Comments
 (0)