From 3e785ee680b0c4f14d74e25df72f6a34abd0682d Mon Sep 17 00:00:00 2001 From: FarnaHerry Date: Sun, 30 Aug 2026 11:54:46 +0800 Subject: [PATCH 1/3] feat(ftxui): add 7.0.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pkgs/c/compat.ftxui.lua | 85 ++++++++++++++++++++++++++++++++--- tests/examples/core/mcpp.toml | 2 +- 2 files changed, 80 insertions(+), 7 deletions(-) diff --git a/pkgs/c/compat.ftxui.lua b/pkgs/c/compat.ftxui.lua index bcb180bb..2e1f7c9d 100644 --- a/pkgs/c/compat.ftxui.lua +++ b/pkgs/c/compat.ftxui.lua @@ -1,9 +1,27 @@ --- M6.x glob-aware Form B descriptor for FTXUI 6.1.9. +-- M6.x glob-aware Form B descriptor for FTXUI 6.1.9 and 7.0.3. -- -- Pure C++ library (no C++23 modules); compiled sources + public headers. --- Uses mcpp 0.0.4's glob exclusion (`!` prefix) to skip the ~46 +-- Uses mcpp 0.0.4's glob exclusion (`!` prefix) to skip the -- *_test.cpp / *_fuzzer.cpp files that live alongside the library --- sources in the same directories. +-- sources in the same directories (6.1.9: ~30 test / ~16 fuzzer; +-- 7.0.3: 47 test / 6 fuzzer). +-- +-- 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 this index's 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, +-- and the plain .cpp sources still compile header-only style. +-- +-- ONE version 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. The install() hook below deletes loop.cpp only +-- when app.cpp exists, i.e. exactly on the 7.x layout. -- -- Produces a single static archive `libftxui.a` covering all three -- upstream cmake targets (ftxui-screen, ftxui-dom, ftxui-component). @@ -26,6 +44,13 @@ package = { }, sha256 = "45819c1e54914783d4a1ca5633885035d74146778a1f74e1213cdb7b76340e71", }, + -- 7.0.3 has no CN mirror yet (never published to mcpp-res); + -- plain-string GLOBAL fallback. Flip to { GLOBAL, CN } if it gets + -- mirrored — sha256 stays the same. + ["7.0.3"] = { + url = "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v7.0.3.tar.gz", + sha256 = "e7c62ffe19009759821b4f0f8df7f2a6fb83784c3a9f1477d81f56d3ee723c88", + }, }, macosx = { ["6.1.9"] = { @@ -35,6 +60,13 @@ package = { }, sha256 = "45819c1e54914783d4a1ca5633885035d74146778a1f74e1213cdb7b76340e71", }, + -- 7.0.3 has no CN mirror yet (never published to mcpp-res); + -- plain-string GLOBAL fallback. Flip to { GLOBAL, CN } if it gets + -- mirrored — sha256 stays the same. + ["7.0.3"] = { + url = "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v7.0.3.tar.gz", + sha256 = "e7c62ffe19009759821b4f0f8df7f2a6fb83784c3a9f1477d81f56d3ee723c88", + }, }, windows = { ["6.1.9"] = { @@ -44,19 +76,26 @@ package = { }, sha256 = "45819c1e54914783d4a1ca5633885035d74146778a1f74e1213cdb7b76340e71", }, + -- 7.0.3 has no CN mirror yet (never published to mcpp-res); + -- plain-string GLOBAL fallback. Flip to { GLOBAL, CN } if it gets + -- mirrored — sha256 stays the same. + ["7.0.3"] = { + url = "https://github.com/ArthurSonzogni/FTXUI/archive/refs/tags/v7.0.3.tar.gz", + sha256 = "e7c62ffe19009759821b4f0f8df7f2a6fb83784c3a9f1477d81f56d3ee723c88", + }, }, }, -- Form B `mcpp` segment: paths are globs relative to the verdir. - -- The leading `*/` absorbs the GitHub tarball's `FTXUI-6.1.9/` wrap. + -- The leading `*/` absorbs the GitHub tarball's `FTXUI-/` wrap. mcpp = { language = "c++23", import_std = false, -- pure compiled lib, no `import std;` include_dirs = { "*/include", "*/src" }, -- src/ for private headers (box_helper.hpp etc.), sources = { "*/src/ftxui/**/*.cpp", - "!*/src/ftxui/**/*_test.cpp", -- 30+ gtest files - "!*/src/ftxui/**/*_fuzzer.cpp", -- ~16 fuzz targets + "!*/src/ftxui/**/*_test.cpp", -- gtest files (30+ in 6.1.9, 47 in 7.0.3) + "!*/src/ftxui/**/*_fuzzer.cpp", -- fuzz targets (16 in 6.1.9, 6 in 7.0.3) }, targets = { ["ftxui"] = { kind = "lib" } }, deps = { }, @@ -65,3 +104,37 @@ package = { }, }, } + +import("xim.libxpkg.pkginfo") + +function install() + -- Reproduce the default unpack shape — install_dir//src/... — so + -- the descriptor's `*/` globs keep matching exactly one wrap level (same + -- normalisation as compat.eui-neo). ⚠️ NO SHELL and no directory listing + -- in this sandbox: the wrap is asked about by name, not discovered. + local v = pkginfo.version() + local idir = pkginfo.install_dir() + local layer = path.join(idir, "FTXUI-" .. v) + os.tryrm(idir) + os.mkdir(idir) + for _, name in ipairs({ "FTXUI-" .. v, "ftxui-" .. v, + "FTXUI-v" .. v, "ftxui-v" .. v }) do + if os.isfile(path.join(name, "CMakeLists.txt")) then + os.mv(name, layer) + break + end + end + if not os.isfile(path.join(layer, "CMakeLists.txt")) then + log.error("ftxui: no CMakeLists.txt under %s after unpacking; the " + .. "archive layout is neither wrapped nor flat", layer) + return false + end + + -- See the header comment: drop the stale loop.cpp on the 7.x layout + -- (app.cpp present) where its Loop methods are duplicated; keep it for + -- 6.1.9, which has no app.cpp. + if os.isfile(path.join(layer, "src", "ftxui", "component", "app.cpp")) then + os.tryrm(path.join(layer, "src", "ftxui", "component", "loop.cpp")) + end + return true +end diff --git a/tests/examples/core/mcpp.toml b/tests/examples/core/mcpp.toml index e506e684..bfd19c61 100644 --- a/tests/examples/core/mcpp.toml +++ b/tests/examples/core/mcpp.toml @@ -7,7 +7,7 @@ version = "0.1.0" [dependencies.compat] gtest = { version = "1.15.2", features = ["main"] } -ftxui = "6.1.9" +ftxui = "7.0.3" lua = "5.4.7" mbedtls = "3.6.1" opengl = "2026.05.31" From dd44f8e37a6437e8689544970091e334a42798e5 Mon Sep 17 00:00:00 2001 From: FarnaHerry Date: Sun, 30 Aug 2026 12:06:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(ftxui):=20compile=207.0.3's=20own=20mo?= =?UTF-8?q?dule=20units=20=E2=80=94=20`import=20ftxui;`=20works?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream's new C++20 module units (src/ftxui/*.cppm) join the sources, so 7.0.3 consumers can `import ftxui;` — they are global-fragment includes + `using` re-exports, every declaration stays attached to the global module, and `#include`/`import` mix freely against the same compiled objects. On 6.1.9 the .cppm globs are zero-hit warnings (redis-plus-plus union precedent). A new CompatModule smoke test imports ftxui and renders. Verified locally (mcpp 2026.8.29.1): `mcpp test -p core` passes on 7.0.3 (both #include and `import ftxui;` smoke tests) and on 6.1.9 (loop.cpp kept, zero-hit .cppm globs are warnings); `mcpp xpkg parse` green. --- pkgs/c/compat.ftxui.lua | 17 ++++++++++++++--- tests/examples/core/tests/module.cpp | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 tests/examples/core/tests/module.cpp diff --git a/pkgs/c/compat.ftxui.lua b/pkgs/c/compat.ftxui.lua index 2e1f7c9d..9190dfea 100644 --- a/pkgs/c/compat.ftxui.lua +++ b/pkgs/c/compat.ftxui.lua @@ -10,9 +10,11 @@ -- component,util}), so the 6.1.9 globs apply verbatim, and the public header -- API this index's 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, --- and the plain .cpp sources still compile header-only style. +-- with 6.1.9. Upstream added C++20 module units (src/ftxui/*.cppm) and this +-- descriptor compiles them, so 7.0.3 consumers can `import ftxui;` — the +-- units are global-fragment includes + `using` re-exports, every declaration +-- stays attached to the global module, and `#include`/`import` can be mixed +-- in one consumer against the same compiled objects. -- -- ONE version skew the globs cannot express (no per-version build blocks, -- mcpp-community/mcpp#290): FTXUI 7 moved Loop's method definitions from @@ -96,6 +98,15 @@ package = { "*/src/ftxui/**/*.cpp", "!*/src/ftxui/**/*_test.cpp", -- gtest files (30+ in 6.1.9, 47 in 7.0.3) "!*/src/ftxui/**/*_fuzzer.cpp", -- fuzz targets (16 in 6.1.9, 6 in 7.0.3) + -- 7.0.3's own module units: global-fragment includes + `using` + -- re-exports, so `import ftxui;` works and still links against + -- the compiled .cpp objects. 6.1.9 has no .cppm — these globs + -- are zero-hit warnings there, same as the redis-plus-plus union. + "*/src/ftxui/screen.cppm", + "*/src/ftxui/dom.cppm", + "*/src/ftxui/component.cppm", + "*/src/ftxui/util.cppm", + "*/src/ftxui/ftxui.cppm", }, targets = { ["ftxui"] = { kind = "lib" } }, deps = { }, diff --git a/tests/examples/core/tests/module.cpp b/tests/examples/core/tests/module.cpp new file mode 100644 index 00000000..ffefb776 --- /dev/null +++ b/tests/examples/core/tests/module.cpp @@ -0,0 +1,19 @@ +// FTXUI 7 module smoke: compat.ftxui 7.0.3 compiles upstream's own .cppm +// units, so consumers can `import ftxui;` instead of (or mixed with) +// #include — the re-export style keeps every declaration in the global +// module, so both spellings link against the same objects. +import ftxui; + +#include + +#include + +TEST(CompatModule, FtxuiImport) { + using namespace ftxui; + Element document = hbox({text("module"), separator(), text("ftxui")}); + Screen screen = Screen::Create(Dimension::Fit(document), Dimension::Fit(document)); + Render(screen, document); + const std::string rendered = screen.ToString(); + EXPECT_TRUE(rendered.find("module") != std::string::npos && + rendered.find("ftxui") != std::string::npos); +} From 6c621602b859ddbec7b6151e9cab5ade68c193ed Mon Sep 17 00:00:00 2001 From: FarnaHerry Date: Sun, 30 Aug 2026 17:14:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Revert=20"feat(ftxui):=20compile=207.0.3's?= =?UTF-8?q?=20own=20module=20units=20=E2=80=94=20`import=20ftxui;`=20works?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit dd44f8e37a6437e8689544970091e334a42798e5. --- pkgs/c/compat.ftxui.lua | 17 +++-------------- tests/examples/core/tests/module.cpp | 19 ------------------- 2 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 tests/examples/core/tests/module.cpp diff --git a/pkgs/c/compat.ftxui.lua b/pkgs/c/compat.ftxui.lua index 9190dfea..2e1f7c9d 100644 --- a/pkgs/c/compat.ftxui.lua +++ b/pkgs/c/compat.ftxui.lua @@ -10,11 +10,9 @@ -- component,util}), so the 6.1.9 globs apply verbatim, and the public header -- API this index's 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) and this --- descriptor compiles them, so 7.0.3 consumers can `import ftxui;` — the --- units are global-fragment includes + `using` re-exports, every declaration --- stays attached to the global module, and `#include`/`import` can be mixed --- in one consumer against the same compiled objects. +-- 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, +-- and the plain .cpp sources still compile header-only style. -- -- ONE version skew the globs cannot express (no per-version build blocks, -- mcpp-community/mcpp#290): FTXUI 7 moved Loop's method definitions from @@ -98,15 +96,6 @@ package = { "*/src/ftxui/**/*.cpp", "!*/src/ftxui/**/*_test.cpp", -- gtest files (30+ in 6.1.9, 47 in 7.0.3) "!*/src/ftxui/**/*_fuzzer.cpp", -- fuzz targets (16 in 6.1.9, 6 in 7.0.3) - -- 7.0.3's own module units: global-fragment includes + `using` - -- re-exports, so `import ftxui;` works and still links against - -- the compiled .cpp objects. 6.1.9 has no .cppm — these globs - -- are zero-hit warnings there, same as the redis-plus-plus union. - "*/src/ftxui/screen.cppm", - "*/src/ftxui/dom.cppm", - "*/src/ftxui/component.cppm", - "*/src/ftxui/util.cppm", - "*/src/ftxui/ftxui.cppm", }, targets = { ["ftxui"] = { kind = "lib" } }, deps = { }, diff --git a/tests/examples/core/tests/module.cpp b/tests/examples/core/tests/module.cpp deleted file mode 100644 index ffefb776..00000000 --- a/tests/examples/core/tests/module.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// FTXUI 7 module smoke: compat.ftxui 7.0.3 compiles upstream's own .cppm -// units, so consumers can `import ftxui;` instead of (or mixed with) -// #include — the re-export style keeps every declaration in the global -// module, so both spellings link against the same objects. -import ftxui; - -#include - -#include - -TEST(CompatModule, FtxuiImport) { - using namespace ftxui; - Element document = hbox({text("module"), separator(), text("ftxui")}); - Screen screen = Screen::Create(Dimension::Fit(document), Dimension::Fit(document)); - Render(screen, document); - const std::string rendered = screen.ToString(); - EXPECT_TRUE(rendered.find("module") != std::string::npos && - rendered.find("ftxui") != std::string::npos); -}