Skip to content

Commit e403417

Browse files
authored
mcpplibs.mwrap.dr_libs 2026.03.03: dr_libs-m (dr_wav, dr_flac, dr_mp3 as C++23 modules) (#614)
Descriptor pkgs/mwrap/dr_libs.lua (form A, the immutable mwrap-2026.03.03 release asset; CN is the gitcode mcpp-res/mwrap-dr_libs mirror with the same bytes), over compat.dr_libs 2026.03.03. Consumer tests/mwrap/dr_libs-audio: a WAV written and read back, a FLAC stream built in the test decoded and seeked, an MP3 decoded to its LAME tag's gapless length with its 440 Hz tone, one header's module alone, the mapped macros, and the side header beside the import. The installed-template check in validate.yml with its deployment contract (the wrapper's LICENSE/NOTICE, dr_libs' README and LICENSE, byte for byte in a relocated bundle), and the plan.
1 parent d88824f commit e403417

10 files changed

Lines changed: 403 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Add mcpplibs.mwrap.dr_libs (dr_libs-m 2026.03.03)
2+
3+
## Form
4+
5+
- Third-party upstream [mackron/dr_libs](https://github.com/mackron/dr_libs), a choice of Unlicense or MIT-0. Upstream
6+
tags each header on its own; compat.dr_libs 2026.03.03 (the parent change) pins the commit archive of `wav-0.14.5`
7+
(fa931f3, `b56be593…bb7e`), whose `dr_flac.h` and `dr_mp3.h` are byte-identical to `flac-0.13.3` and `mp3-0.7.3`.
8+
- Form A external mwrap module repository [mcpplibs/dr_libs-m](https://github.com/mcpplibs/dr_libs-m), package
9+
`mcpplibs.mwrap.dr_libs`, version 2026.03.03 (compat.dr_libs' date version; the three header versions and the commit
10+
in `[package.metadata.mwrap]`), tag series `mwrap-${version}`, tagged on the merged main commit (0d4c72e); release
11+
asset `dr_libs-m-2026.03.03.tar.gz` (`0dc7ac0e…dbe2`), CN mirror `gitcode.com/mcpp-res/mwrap-dr_libs` with identical
12+
bytes.
13+
- One package, as compat.nanosvg packages its two stb-style headers: the three headers share one commit and one
14+
implementation TU, and a program using one usually uses another (miniaudio embeds all three). Each header is still
15+
its own module.
16+
- Implementation ownership: the library is compat.dr_libs'. The wrapper vendors no upstream code; it retains
17+
upstream's README.md and LICENSE under `upstream/dr_libs/` (checksums in `upstream/documents.json`) and deploys them
18+
with its own LICENSE/NOTICE (`runtime.deploy`).
19+
20+
## Modules
21+
22+
- `mcpplibs.mwrap.dr_libs.wav` / `.flac` / `.mp3`: every type, enumerator and `*_API` function of the header's public
23+
part by `export using` (wav 42 / 48 / 94, flac 32 / 6 / 31, mp3 28 / 8 / 29), generated from the pinned headers; each
24+
re-exports `.macros` and is complete on its own. Every enum is named by its typedef, so the enumerators have linkage
25+
and are exported as they are. The root `mcpplibs.mwrap.dr_libs` re-exports all four.
26+
- `mcpplibs.mwrap.dr_libs.macros`: the 171 object-like macros as `inline constexpr` of the type of their expansion (the
27+
version strings as references to constexpr char arrays). The headers define no computation macro.
28+
- Stay macros, in `<mwrap/dr_libs/macros.hpp>` (= the three headers): `*_API`, `*_PRIVATE`, `*_DLL_*`,
29+
`DRFLAC_DEPRECATED`, `DRMP3_INLINE`, `DRMP3_GNUC_INLINE_HINT`, `*_STRINGIFY` / `*_XSTRINGIFY`, `DRFLAC_64BIT`,
30+
`DRFLAC_X64`, `DRFLAC_X86`, `DRFLAC_ARM` (28). Not mapped: the 3 include guards.
31+
32+
`tools/check_exports.py` fails when the generated sources are stale, a declaration is not exported by its submodule, or
33+
a macro is neither mapped nor listed; every mapping is checked against the raw header in a header-mixing test.
34+
35+
## Verification
36+
37+
Wrapper CI (Linux x86_64 GCC 16.1 and LLVM 23.1.3, Linux arm64 GCC 16.1, macOS LLVM, Windows LLVM, all required): build,
38+
eight test programs (the API through the module — WAV round trips in RIFF / Wave64 / RF64, IEEE float, A-law, mu-law,
39+
a hand-written AIFF, cue metadata, narrow and wide paths; a FLAC fixture sample-exact against the signal of its
40+
STREAMINFO MD5; an MP3 fixture to its LAME-gapless length; each submodule alone; the macros against the headers; header
41+
mixing; compat.miniaudio in the same program decoding the fixtures to identical samples), the export audit, and the
42+
example tool on the fixtures. The templates job scaffolds the default `tone` template as an installed package and runs
43+
it. Until compat.dr_libs is on this index's main, the wrapper's CI resolves the compat namespace from the parent
44+
change's branch (`tools/candidate_index.py`, a no-op once published).
45+
46+
Here, with the CI-pinned mcpp 2026.10.26.1:
47+
48+
- `bash tests/run_members.sh dr_libs-audio`: the real release archive through the candidate index; a WAV written and
49+
read back, a FLAC stream built in the test (CONSTANT subframes, CRC-8/16) decoded and seeked, the MP3 to 4410 frames
50+
with its 440 Hz tone, the `.flac` module alone, and the side header beside the import: `test result ok`.
51+
- `python3 tests/mwrap/check_installed_template.py --package mcpplibs.mwrap.dr_libs@2026.03.03 --deploy`: the
52+
unmodified template from the real archive, then a relocated self-contained bundle whose `licenses/dr_libs/` holds the
53+
wrapper's LICENSE/NOTICE and dr_libs' README and LICENSE byte for byte.
54+
55+
## Motivation
56+
57+
openmui's coming audio engine (media.audio) decodes WAV, FLAC and MP3 assets; these permissively licensed decoders,
58+
through modules, fit its statically linked framework, beside miniaudio for playback.

‎.github/workflows/validate.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,6 +1638,11 @@ jobs:
16381638
shell: bash
16391639
run: python3 tests/mwrap/check_installed_template.py --mcpp "$MCPP" --package mcpplibs.mwrap.sheenbidi@3.0.0 --deploy
16401640

1641+
- name: Installed dr_libs wrapper archive, actual default tone template and its relocated notices
1642+
if: contains(format(' {0} ', env.MEMBERS), ' dr_libs-audio ') && matrix.toolchain == 'default'
1643+
shell: bash
1644+
run: python3 tests/mwrap/check_installed_template.py --mcpp "$MCPP" --package mcpplibs.mwrap.dr_libs@2026.03.03 --deploy
1645+
16411646
- name: Installed Opus wrapper archive, actual default tone template and its relocated BSD notices
16421647
if: contains(format(' {0} ', env.MEMBERS), ' opus-ogg ') && matrix.toolchain == 'default'
16431648
shell: bash

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@
99

1010
### Added
1111

12+
- **mcpplibs.mwrap.dr_libs 2026.03.03(新包)。** dr_libs-m:以 C++23 模块(`import mcpplibs.mwrap.dr_libs;`)使用
13+
compat.dr_libs 2026.03.03(dr_wav 0.14.5、dr_flac 0.13.3、dr_mp3 0.7.3)。每个头文件各一个模块且可单独导入:
14+
`mcpplibs.mwrap.dr_libs.wav`(42 个类型、48 个枚举值、94 个函数)、`.flac`(32、6、31)、`.mp3`(28、8、29),全部以
15+
`export using` 导出上游全局名;每个枚举都由 typedef 命名,枚举值按原样导出。`mcpplibs.mwrap.dr_libs.macros` 把 171 个
16+
对象式宏映射为其自身类型的常量;`*_API` 等属性、字符串化宏与 dr_flac 的平台检测宏共 28 个留在
17+
`<mwrap/dr_libs/macros.hpp>`。包装仓库的 CI(Linux x86_64 GCC/LLVM、Linux arm64、macOS、Windows)逐样本核对 FLAC
18+
解码、按 LAME 标签的无缝长度解码 MP3、在各容器中往返 WAV,并与 compat.miniaudio 链接在同一程序中解码出相同样本。
19+
GLOBAL 为 `mwrap-2026.03.03` 发布资产,CN 为 GitCode `mcpp-res/mwrap-dr_libs` 镜像,sha256 一致。新增测试成员
20+
`tests/mwrap/dr_libs-audio` 与已安装模板及其许可文件的部署检查。
1221
- **compat.dr_libs 2026.03.03(新包)。** dr_libs:单文件的 WAV/AIFF、FLAC 与 MP3 解码器(以及 WAV 编码器),C 实现,
1322
无依赖,许可为 MIT-0 或 Unlicense 二选一。上游按头文件分别打标签(`wav-*`、`flac-*`、`mp3-*`),没有同时覆盖三者的标签;
1423
本包固定 `wav-0.14.5` 的提交 `fa931f3`(2026-03-03)的归档,其中 `dr_flac.h`、`dr_mp3.h` 与 `flac-0.13.3`、`mp3-0.7.3`

‎mcpp.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ members = [
2323
"tests/mwrap/concurrentqueue-mpmc",
2424
"tests/mwrap/fribidi-bidi",
2525
"tests/mwrap/sheenbidi-bidi",
26+
"tests/mwrap/dr_libs-audio",
2627
"tests/mwrap/opus-ogg",
2728
"tests/mwrap/box2d-physics",
2829
"tests/mwrap/miniaudio-engine",

‎pkgs/mwrap/dr_libs.lua‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
-- Immutable upstream-aligned mwrap source release (dr_libs-m mwrap-2026.03.03);
2+
-- GLOBAL and CN bytes are identical.
3+
--
4+
-- The wrapper is Apache-2.0; the library it links, compat.dr_libs 2026.03.03
5+
-- (dr_wav 0.14.5, dr_flac 0.13.3, dr_mp3 0.7.3 from upstream commit fa931f3),
6+
-- is a choice of Unlicense or MIT-0, linked statically: the package deploys
7+
-- dr_libs' README and LICENSE beside programs (runtime.deploy) with its own
8+
-- LICENSE and NOTICE.
9+
package = {
10+
spec = "1",
11+
namespace = "mcpplibs.mwrap",
12+
name = "dr_libs",
13+
description = "dr_libs-m: dr_wav, dr_flac and dr_mp3 (WAV/AIFF, FLAC and MP3 decoding, WAV writing) as C++23 modules",
14+
licenses = { "Apache-2.0" },
15+
repo = "https://github.com/mcpplibs/dr_libs-m",
16+
type = "package",
17+
extensions = {
18+
autoupdate = {
19+
tag = "mwrap-${version}",
20+
url = "https://github.com/mcpplibs/dr_libs-m/releases/download/${tag}/dr_libs-m-${version}.tar.gz",
21+
},
22+
},
23+
xpm = {
24+
linux = {
25+
["2026.03.03"] = {
26+
url = {
27+
GLOBAL = "https://github.com/mcpplibs/dr_libs-m/releases/download/mwrap-2026.03.03/dr_libs-m-2026.03.03.tar.gz",
28+
CN = "https://gitcode.com/mcpp-res/mwrap-dr_libs/releases/download/2026.03.03/dr_libs-m-2026.03.03.tar.gz",
29+
},
30+
sha256 = "0dc7ac0ea3cfbbf8fe57eca3cb5290757597ae2268e1e308082a34f241edbbe2",
31+
},
32+
},
33+
macosx = {
34+
["2026.03.03"] = {
35+
url = {
36+
GLOBAL = "https://github.com/mcpplibs/dr_libs-m/releases/download/mwrap-2026.03.03/dr_libs-m-2026.03.03.tar.gz",
37+
CN = "https://gitcode.com/mcpp-res/mwrap-dr_libs/releases/download/2026.03.03/dr_libs-m-2026.03.03.tar.gz",
38+
},
39+
sha256 = "0dc7ac0ea3cfbbf8fe57eca3cb5290757597ae2268e1e308082a34f241edbbe2",
40+
},
41+
},
42+
windows = {
43+
["2026.03.03"] = {
44+
url = {
45+
GLOBAL = "https://github.com/mcpplibs/dr_libs-m/releases/download/mwrap-2026.03.03/dr_libs-m-2026.03.03.tar.gz",
46+
CN = "https://gitcode.com/mcpp-res/mwrap-dr_libs/releases/download/2026.03.03/dr_libs-m-2026.03.03.tar.gz",
47+
},
48+
sha256 = "0dc7ac0ea3cfbbf8fe57eca3cb5290757597ae2268e1e308082a34f241edbbe2",
49+
},
50+
},
51+
},
52+
}

‎tests/mwrap/check_installed_template.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,26 @@ def main():
183183
notice = (roots[0] / "NOTICE").read_bytes()
184184
assert b"mcpp-community" in notice and b"Muhammad Tayyab Akram" in notice
185185
print(f"Verified {len(declared)} byte-identical wrapper/SheenBidi license files", flush=True)
186+
elif identity == "mcpplibs.mwrap.dr_libs":
187+
# dr_libs (Unlicense OR MIT-0) is linked statically: its README
188+
# and LICENSE travel with the program beside the wrapper's.
189+
sources = [path for store in (home / "xpkgs", home / "registry/data/xpkgs")
190+
for path in store.glob(f"mcpplibs.mwrap-x-dr_libs/{version}/*/src/dr_libs.cppm")]
191+
assert len(sources) == 1, sources
192+
source = sources[0].parent.parent
193+
declared = tomllib.loads((source / "mcpp.toml").read_text(encoding="utf-8"))["runtime"]["deploy"]
194+
roots = list(relocated.rglob("licenses/dr_libs"))
195+
assert len(roots) == 1, f"Missing dr_libs runtime license tree: {roots}"
196+
for entry in declared:
197+
notice = source / entry["from"]
198+
copied = roots[0].parent.parent / entry["to"] / notice.name
199+
assert copied.is_file() and copied.read_bytes() == notice.read_bytes(), copied
200+
upstream = (roots[0] / "upstream/dr_libs/LICENSE").read_bytes()
201+
assert b"unlicense.org" in upstream and b"MIT No Attribution" in upstream
202+
assert b"Apache License" in (roots[0] / "LICENSE").read_bytes()
203+
notice = (roots[0] / "NOTICE").read_bytes()
204+
assert b"mcpp-community" in notice and b"David Reid" in notice
205+
print(f"Verified {len(declared)} byte-identical wrapper/dr_libs license files", flush=True)
186206
elif identity == "mcpplibs.mwrap.opus":
187207
# libopus, opusfile and libogg are BSD-3-Clause and linked
188208
# statically: each one's README and COPYING (libopus's with its
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "dr_libs-audio"
3+
version = "2026.03.03"
4+
description = "Consume the immutable dr_libs wrapper: a WAV written and read back, a FLAC stream built here decoded and seeked, an MP3 decoded to its gapless length, each header's module alone, the mapped macros, the side header beside the import"
5+
6+
[indices]
7+
# Use the complete candidate built-in index prepared by tests/run_members.sh.
8+
# An explicit empty table overrides the legacy workspace redirect.
9+
10+
[dependencies]
11+
"mcpplibs.mwrap.dr_libs" = "2026.03.03"

0 commit comments

Comments
 (0)