Skip to content

Commit ea74cf1

Browse files
FarnaHerryFARNA-HERRY-OFF\farna
andauthored
feat: add 6 compat packages for EUI-NEO deps (md4c, yyjson, glad, tray, libpng, freetype) (#131)
* Add 6 compat packages for EUI-NEO deps: md4c, yyjson, glad, tray, libpng, freetype All 6 packages pass mcpp test with verified sha256: - compat.md4c 0.5.3 PASS (0 deps) - compat.yyjson 0.12.0 PASS (0 deps) - compat.glad 0.0.0-651a425 PASS (0 deps) - compat.tray 0.0.0-8dd1358 PASS (0 deps, header-only) - compat.libpng 1.6.43 PASS (dep: compat.zlib) - compat.freetype 2.13.3 PASS (dep: compat.libpng -> compat.zlib) Tested on Windows x86_64 with llvm@20.1.7, C++23 standard. * Add design doc for EUI-NEO compat dependency packages Documenting shape decisions, build strategy, and verification results for md4c, yyjson, glad, tray, libpng, and freetype. * fix: use plain-string url for all 6 EUI-NEO compat deps (no mcpp-res access) * fix: freetype c_standard gnu11 for macOS POSIX; libpng disable ARM NEON on Apple Silicon * fix: freetype add -Wno-implicit-function-declaration for macOS Clang 20 * fix: freetype add -D_DARWIN_C_SOURCE for O_RDONLY on macOS * fix: freetype macOS force-include fcntl.h for O_RDONLY * fix: freetype add -include fcntl.h for linux too (O_RDONLY on Unix) * fix: freetype add ftdebug.c for FT_Trace symbols on Unix --------- Co-authored-by: FARNA-HERRY-OFF\farna <farnaherryoffical@outlook.com>
1 parent 4d7e5bc commit ea74cf1

20 files changed

Lines changed: 782 additions & 0 deletions

File tree

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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`.

mcpp.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ members = [
3333
"tests/examples/opencv-module-dnn",
3434
"tests/examples/opencv-module-unifont",
3535
"tests/examples/spdlog",
36+
"tests/examples/freetype",
37+
"tests/examples/glad",
38+
"tests/examples/libpng",
39+
"tests/examples/md4c",
3640
"tests/examples/spdlog-compiled",
3741
"tests/examples/tinyhttps",
42+
"tests/examples/tray",
43+
"tests/examples/yyjson",
3844
]
3945

4046
# ── The index redirect, hoisted to the workspace root ───────────────────

pkgs/c/compat.freetype.lua

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
-- compat.freetype — FreeType 2.13.3 font rendering engine.
2+
-- Built from aggregate source files (~20 .c files), depends on compat.libpng.
3+
-- EUI-NEO uses FreeType for all text/font rendering.
4+
--
5+
-- Build strategy: aggregate source files (one per module directory).
6+
-- This is the recommended approach for non-CMake/autotools builds.
7+
--
8+
-- All `mcpp` paths are GLOBS relative to the verdir; the leading `*/`
9+
-- absorbs the tarball's `freetype-VER-2-13-3/` wrap layer.
10+
package = {
11+
spec = "1",
12+
namespace = "compat",
13+
name = "freetype",
14+
description = "FreeType 2 — portable font engine with TrueType/CFF/WOFF/SVG support",
15+
licenses = {"FreeType"},
16+
repo = "https://gitlab.freedesktop.org/freetype/freetype",
17+
type = "package",
18+
19+
xpm = {
20+
linux = {
21+
["2.13.3"] = {
22+
url = "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-3.tar.gz",
23+
sha256 = "bc5c898e4756d373e0d991bab053036c5eb2aa7c0d5c67e8662ddc6da40c4103",
24+
},
25+
},
26+
macosx = {
27+
["2.13.3"] = {
28+
url = "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-3.tar.gz",
29+
sha256 = "bc5c898e4756d373e0d991bab053036c5eb2aa7c0d5c67e8662ddc6da40c4103",
30+
},
31+
},
32+
windows = {
33+
["2.13.3"] = {
34+
url = "https://github.com/freetype/freetype/archive/refs/tags/VER-2-13-3.tar.gz",
35+
sha256 = "bc5c898e4756d373e0d991bab053036c5eb2aa7c0d5c67e8662ddc6da40c4103",
36+
},
37+
},
38+
},
39+
40+
mcpp = {
41+
language = "c++23",
42+
import_std = false,
43+
c_standard = "gnu11",
44+
include_dirs = { "*/include" },
45+
sources = {
46+
-- Base (aggregate + required extra files)
47+
"*/src/base/ftbase.c",
48+
"*/src/base/ftinit.c",
49+
"*/src/base/ftglyph.c",
50+
"*/src/base/ftbitmap.c",
51+
"*/src/base/ftbbox.c",
52+
-- Base extra (individual)
53+
"*/src/base/ftmm.c",
54+
-- Modules (aggregates)
55+
"*/src/autofit/autofit.c",
56+
"*/src/bdf/bdf.c",
57+
"*/src/cff/cff.c",
58+
"*/src/cid/type1cid.c",
59+
"*/src/cache/ftcache.c",
60+
"*/src/gzip/ftgzip.c",
61+
"*/src/lzw/ftlzw.c",
62+
"*/src/pcf/pcf.c",
63+
"*/src/pfr/pfr.c",
64+
"*/src/psaux/psaux.c",
65+
"*/src/pshinter/pshinter.c",
66+
"*/src/psnames/psnames.c",
67+
"*/src/raster/raster.c",
68+
"*/src/sdf/sdf.c",
69+
"*/src/sfnt/sfnt.c",
70+
"*/src/smooth/smooth.c",
71+
"*/src/svg/svg.c",
72+
"*/src/truetype/truetype.c",
73+
"*/src/type1/type1.c",
74+
"*/src/type42/type42.c",
75+
"*/src/winfonts/winfnt.c",
76+
},
77+
targets = { ["freetype"] = { kind = "lib" } },
78+
deps = { ["compat.libpng"] = "1.6.43" },
79+
cflags = { "-DFT2_BUILD_LIBRARY", "-DFT_DISABLE_ZLIB", "-DFT_DISABLE_BZIP2", "-DFT_DISABLE_HARFBUZZ", "-DFT_DISABLE_BROTLI", "-Wno-implicit-function-declaration", "-D_DARWIN_C_SOURCE" },
80+
linux = {
81+
ldflags = { "-lm" },
82+
sources = { "*/builds/unix/ftsystem.c", "*/src/base/ftdebug.c" },
83+
cflags = { "-include", "fcntl.h" },
84+
},
85+
macosx = {
86+
ldflags = { "-lm" },
87+
sources = { "*/builds/unix/ftsystem.c", "*/src/base/ftdebug.c" },
88+
cflags = { "-include", "fcntl.h" },
89+
},
90+
windows = {
91+
sources = {
92+
"*/builds/windows/ftdebug.c",
93+
"*/builds/windows/ftsystem.c",
94+
},
95+
},
96+
},
97+
}

pkgs/c/compat.glad.lua

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
-- compat.glad — OpenGL 4.1 Core Profile function loader.
2+
-- Single-source C library, generated by glad for libigl.
3+
-- EUI-NEO uses this to load OpenGL entry points at runtime.
4+
--
5+
-- All `mcpp` paths are GLOBS relative to the verdir; the leading `*/`
6+
-- absorbs the GitHub tarball's `libigl-glad-<sha>/` wrap layer.
7+
package = {
8+
spec = "1",
9+
namespace = "compat",
10+
name = "glad",
11+
description = "OpenGL 4.1 Core Profile loader (libigl-glad fork)",
12+
licenses = {"MIT"},
13+
repo = "https://github.com/libigl/libigl-glad",
14+
type = "package",
15+
16+
xpm = {
17+
linux = {
18+
["0.0.0-651a425"] = {
19+
url = "https://github.com/libigl/libigl-glad/archive/651a425101365aa6e8504988ef9bb363d066c5ee.tar.gz",
20+
sha256 = "e144575e32f0b4bad311e5912ee4c7bed4f926d63359ae290bf34067c3dfb003",
21+
},
22+
},
23+
macosx = {
24+
["0.0.0-651a425"] = {
25+
url = "https://github.com/libigl/libigl-glad/archive/651a425101365aa6e8504988ef9bb363d066c5ee.tar.gz",
26+
sha256 = "e144575e32f0b4bad311e5912ee4c7bed4f926d63359ae290bf34067c3dfb003",
27+
},
28+
},
29+
windows = {
30+
["0.0.0-651a425"] = {
31+
url = "https://github.com/libigl/libigl-glad/archive/651a425101365aa6e8504988ef9bb363d066c5ee.tar.gz",
32+
sha256 = "e144575e32f0b4bad311e5912ee4c7bed4f926d63359ae290bf34067c3dfb003",
33+
},
34+
},
35+
},
36+
37+
mcpp = {
38+
language = "c++23",
39+
import_std = false,
40+
c_standard = "c99",
41+
include_dirs = { "*/include" },
42+
sources = { "*/src/glad.c" },
43+
targets = { ["glad"] = { kind = "lib" } },
44+
deps = {},
45+
linux = { ldflags = { "-ldl" } },
46+
macosx = { ldflags = { "-ldl" } },
47+
},
48+
}

0 commit comments

Comments
 (0)