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"