-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcompat.miniaudio.lua
More file actions
85 lines (83 loc) · 3.71 KB
/
Copy pathcompat.miniaudio.lua
File metadata and controls
85 lines (83 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
-- Form B inline descriptor for miniaudio — a single-file audio playback and
-- capture library that wraps every platform's native backend (WASAPI/DirectSound/
-- WinMM, Core Audio, ALSA/PulseAudio/JACK, OSS, AAudio/OpenSL, Web Audio) behind
-- one API, plus decoding for WAV/FLAC/MP3 and a mixing/resampling engine.
--
-- SHAPE: header-only WITH an upstream-supplied implementation TU. `miniaudio.h`
-- carries both the declarations and, behind MINIAUDIO_IMPLEMENTATION, the whole
-- implementation; `miniaudio.c` at the tarball root is upstream's own two-line
-- driver for it:
--
-- #define MINIAUDIO_IMPLEMENTATION
-- #include "miniaudio.h"
--
-- Compiling that file here is what makes this a linkable package rather than a
-- pile of headers, and it is upstream's supported way to do it (CMakeLists.txt
-- builds the `miniaudio` library target from exactly this source).
--
-- CONSEQUENCE FOR CONSUMERS: do NOT also define MINIAUDIO_IMPLEMENTATION in your
-- own code. The implementation is already compiled into this package's lib, and
-- defining the macro a second time gives you every miniaudio symbol twice --
-- a LINK error, not a compile error, so it surfaces late. Just
-- `#include <miniaudio.h>` and link.
--
-- SYSTEM LIBRARIES: miniaudio dlopen()s its backends rather than linking them,
-- which is why the Linux link line is `-ldl -lpthread -lm` and NOT -lasound /
-- -lpulse -- ALSA and PulseAudio are resolved at runtime if present, so the
-- package builds on a machine that has neither. (CMakeLists.txt: THREADS,
-- ${CMAKE_DL_LIBS}, m.)
package = {
spec = "1",
namespace = "compat",
name = "miniaudio",
description = "Single-file audio playback and capture library with native backends and WAV/FLAC/MP3 decoding",
licenses = {"MIT-0", "Unlicense"},
repo = "https://github.com/mackron/miniaudio",
type = "package",
xpm = {
linux = {
["0.11.25"] = {
url = {
GLOBAL = "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.25.tar.gz",
CN = "https://gitcode.com/mcpp-res/miniaudio/releases/download/0.11.25/miniaudio-0.11.25.tar.gz",
},
sha256 = "b900edcffe979816e2560a0580b9b1216d674b4f17fbadeca8f777a7f8ab0274",
},
},
macosx = {
["0.11.25"] = {
url = {
GLOBAL = "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.25.tar.gz",
CN = "https://gitcode.com/mcpp-res/miniaudio/releases/download/0.11.25/miniaudio-0.11.25.tar.gz",
},
sha256 = "b900edcffe979816e2560a0580b9b1216d674b4f17fbadeca8f777a7f8ab0274",
},
},
windows = {
["0.11.25"] = {
url = {
GLOBAL = "https://github.com/mackron/miniaudio/archive/refs/tags/0.11.25.tar.gz",
CN = "https://gitcode.com/mcpp-res/miniaudio/releases/download/0.11.25/miniaudio-0.11.25.tar.gz",
},
sha256 = "b900edcffe979816e2560a0580b9b1216d674b4f17fbadeca8f777a7f8ab0274",
},
},
},
mcpp = {
language = "c++23",
import_std = false,
c_standard = "c11",
-- Tarball root: `#include <miniaudio.h>`.
include_dirs = { "*" },
sources = { "*/miniaudio.c" },
targets = { ["miniaudio"] = { kind = "lib" } },
deps = { },
linux = {
-- Backends are dlopen()ed, so no -lasound / -lpulse here.
ldflags = { "-ldl", "-lpthread", "-lm" },
},
macosx = {
ldflags = { "-lpthread", "-lm" },
},
},
}