|
| 1 | +# Design doc: add EUI-NEO compat dependency packages |
| 2 | + |
| 3 | +Date: 2026-07-28 |
| 4 | + |
| 5 | +## Motivation |
| 6 | + |
| 7 | +[EUI-NEO](https://github.com/sudoevolve/EUI-NEO) is a declarative retained-mode C++20 UI |
| 8 | +framework. Its v0.5.3 release depends on several third-party C libraries that have no mcpp |
| 9 | +support. This batch adds 6 of those dependencies as `compat.*` packages, plus a placeholder |
| 10 | +for the 7th (`compat.eui` — the framework itself) which will follow in a separate PR once |
| 11 | +its 8-dependency chain is fully end-to-end tested. |
| 12 | + |
| 13 | +## Packages (this PR) |
| 14 | + |
| 15 | +| # | Package | Version | Shape | Upstream | |
| 16 | +|---|---------|---------|-------|----------| |
| 17 | +| 1 | `compat.md4c` | 0.5.3 | C source (1 TU) | https://github.com/mity/md4c | |
| 18 | +| 2 | `compat.yyjson` | 0.12.0 | C source (1 TU) | https://github.com/ibireme/yyjson | |
| 19 | +| 3 | `compat.glad` | 0.0.0-651a425 | C source (1 TU) | https://github.com/libigl/libigl-glad | |
| 20 | +| 4 | `compat.tray` | 0.0.0-8dd1358 | Header-only | https://github.com/zserge/tray | |
| 21 | +| 5 | `compat.libpng` | 1.6.43 | C source (15 TU) | https://github.com/pnggroup/libpng | |
| 22 | +| 6 | `compat.freetype` | 2.13.3 | C source (26 TU) | https://github.com/freetype/freetype | |
| 23 | + |
| 24 | +## Shape decisions |
| 25 | + |
| 26 | +### md4c, yyjson, glad — Single-source C libraries |
| 27 | +Each has exactly one `.c` file and one public header. Standard Form B descriptor: |
| 28 | +`language = "c++23"`, `c_standard = "c99"`, include directory + single source glob. |
| 29 | +No features, no dependencies (glad needs `-ldl` on Linux/macOS for `dlopen`). |
| 30 | + |
| 31 | +### tray — Header-only |
| 32 | +Single-file header `tray.h` with `#define TRAY_IMPLEMENTATION` pattern (stb-style). |
| 33 | +Uses a generated anchor `.c` file to prevent an empty static library. |
| 34 | +No dependencies, no features. |
| 35 | + |
| 36 | +### libpng — 15-source C library with generated config |
| 37 | +Upstream tarball does NOT include `pnglibconf.h` — it is generated at CMake time |
| 38 | +from `scripts/pnglibconf.h.prebuilt`. We ship the prebuilt version as a |
| 39 | +`generated_files` entry, mirroring the approach used by `compat.zlib`. |
| 40 | + |
| 41 | +Depends on `compat.zlib` (already in index). Hardware optimizations disabled |
| 42 | +via `-DPNG_HARDWARE_OPTIMIZATIONS=0`. |
| 43 | + |
| 44 | +### freetype — 26-source aggregate build |
| 45 | +Uses FreeType's aggregate source file pattern (one `.c` per module directory). |
| 46 | +The `ftbase.c` aggregate covers 18 base files but NOT `ftinit.c`, `ftglyph.c`, |
| 47 | +`ftbitmap.c`, `ftbbox.c`, or `ftmm.c` — those are compiled individually. |
| 48 | + |
| 49 | +Critical define: `-DFT2_BUILD_LIBRARY` prevents `fterrors.h` from undefining |
| 50 | +`FT_ERR_PREFIX`, which is required for aggregate builds to link correctly. |
| 51 | + |
| 52 | +Platform-specific sources: `builds/windows/{ftdebug,ftsystem}.c` on Windows, |
| 53 | +`builds/unix/ftsystem.c` on Linux/macOS. |
| 54 | + |
| 55 | +Depends on `compat.libpng` (this PR) → `compat.zlib` (existing). |
| 56 | + |
| 57 | +## CN mirror |
| 58 | + |
| 59 | +No `mcpp-res` write access. CN URLs use placeholder gitcode.com paths with |
| 60 | +the upstream GitHub sha256. Maintainers will upload byte-identical tarballs |
| 61 | +and update the CN URLs post-merge. |
| 62 | + |
| 63 | +## Features |
| 64 | + |
| 65 | +None of these packages expose optional features. All compile the full library. |
| 66 | + |
| 67 | +- md4c, yyjson, glad, tray: single compilation unit — nothing to gate |
| 68 | +- libpng: all 15 source files are mandatory for basic read/write |
| 69 | +- freetype: all modules are required by EUI-NEO (autofit, cff, truetype, sfnt, etc.) |
| 70 | + |
| 71 | +## Verification |
| 72 | + |
| 73 | +All 6 packages pass `mcpp test -p <member>` on Windows x86_64 with llvm@20.1.7: |
| 74 | + |
| 75 | +``` |
| 76 | +✅ compat.md4c test_md4c ... ok (1 passed, 0 failed) |
| 77 | +✅ compat.yyjson parse ... ok (1 passed, 0 failed) |
| 78 | +✅ compat.glad header ... ok (1 passed, 0 failed) |
| 79 | +✅ compat.tray header ... ok (1 passed, 0 failed) |
| 80 | +✅ compat.libpng read ... ok (1 passed, 0 failed) |
| 81 | +✅ compat.freetype init ... ok (1 passed, 0 failed) |
| 82 | +``` |
| 83 | + |
| 84 | +CI mcpp version: 0.0.109 (from validate.yml). Local mcpp: 2026.7.27.1. |
| 85 | + |
| 86 | +## Follow-up |
| 87 | + |
| 88 | +`compat.eui` (the 7th package) wraps EUI-NEO itself as a C++ module. It depends |
| 89 | +on all 6 packages here plus `compat.glfw`, `compat.opengl`, and `compat.zlib`. |
| 90 | +Will be submitted as a separate PR once the full 8-dependency chain passes |
| 91 | +end-to-end `mcpp test`. |
0 commit comments