Lyrebird 2.0.0 — Linux support

Consolidated release: the cross-platform Linux port (engine, generators, CLI,
REPL, NRT, portable DSP), live ALSA audio + ALSA MIDI + POSIX OSC + portable
WAV codec, the GTK4 GUI (LyrebirdUI on the SwiftOpenUI backend), and the Linux
live-coding scratchpad (LiveCompile). Apple platforms unchanged; all additive.
See RELEASES.md and LINUX_README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-10 21:09:11 -07:00
parent 77580ee98e
commit b6fdee8bfc
293 changed files with 16800 additions and 775 deletions
@@ -424,7 +424,60 @@ func argumentExpression(_ p: ScannedParameter, builtin: String) -> String {
return "try DSLArgument.\(helper)(\(source), \(where_))"
}
/// Number of registry entries per emitted chunk array.
///
/// The registry is emitted as several `private static let _chunkN` arrays
/// concatenated into `generated`, rather than one big `[ ... ]` literal. A
/// single literal of all ~300 entries is checked by the Swift type-checker as
/// one expression and needs several GB of RAM to compile — enough to OOM-kill
/// the compiler (SIGKILL) on a memory-constrained Linux/CI runner. Splitting it
/// lets each chunk type-check independently, keeping peak memory low and the
/// Linux build parallelizable.
let registryChunkSize: Int = 32
/// Renders one `DSLBuiltin(...)` entry (trailing `,\n`) at the indentation used
/// inside a chunk array literal.
func emitRegistryEntry(_ g: ScannedGenerator) -> String {
let exposed: [ScannedParameter] = g.exposedParameters
let paramList: String = exposed
.map { " DSLParameter(label: \"\($0.label)\", hasDefault: \(effectiveHasDefault($0))),\n" }
.joined()
let callArgs: String = exposed
.map { p in
let expr: String = argumentExpression(p, builtin: g.name)
let prefix: String = p.isPositional ? "" : "\(p.label): "
return " \(prefix)\(expr)"
}
.joined(separator: ",\n")
// Empty-argument constructors emit `Foo()`; otherwise a multi-line call.
let makeBody: String = exposed.isEmpty
? " \(g.constructor)()"
: " \(g.constructor)(\n\(callArgs)\n )"
return """
DSLBuiltin(
name: "\(g.name)",
rate: .\(g.rate),
parameters: [
\(paramList) ],
make: { args in
\(makeBody)
}
),\n
"""
}
func emitRegistry(_ generators: [ScannedGenerator]) -> String {
// Split entries into fixed-size chunks so each emitted array literal stays
// small enough to type-check cheaply. Always emit at least one chunk (even
// when empty) so `generated` has a well-formed initializer.
let chunks: [[ScannedGenerator]] = stride(from: 0, to: max(generators.count, 1), by: registryChunkSize)
.map { start in
let end: Int = min(start + registryChunkSize, generators.count)
return start < end ? Array(generators[start..<end]) : []
}
let chunkNames: [String] = chunks.indices.map { "_chunk\($0)" }
let concatExpr: String = chunkNames.joined(separator: " + ")
var out: String = """
// GeneratedDSLRegistry.swift
// Lyrebird
@@ -444,38 +497,21 @@ func emitRegistry(_ generators: [ScannedGenerator]) -> String {
/// sources. A generator appears here when all of its init parameters are
/// either DSL-expressible (a signal/number) or have a Swift default that
/// can be omitted.
static let generated: [DSLBuiltin] = [\n
///
/// Assembled from `_chunkN` arrays below. The split keeps each emitted
/// literal small enough for the type-checker to compile in modest memory;
/// a single ~300-element literal OOM-kills the compiler on constrained
/// Linux/CI runners.
static let generated: [DSLBuiltin] = \(concatExpr)\n\n
"""
for g: ScannedGenerator in generators {
let exposed: [ScannedParameter] = g.exposedParameters
let paramList: String = exposed
.map { " DSLParameter(label: \"\($0.label)\", hasDefault: \(effectiveHasDefault($0))),\n" }
.joined()
let callArgs: String = exposed
.map { p in
let expr: String = argumentExpression(p, builtin: g.name)
let prefix: String = p.isPositional ? "" : "\(p.label): "
return " \(prefix)\(expr)"
}
.joined(separator: ",\n")
// Empty-argument constructors emit `Foo()`; otherwise a multi-line call.
let makeBody: String = exposed.isEmpty
? " \(g.constructor)()"
: " \(g.constructor)(\n\(callArgs)\n )"
out += """
DSLBuiltin(
name: "\(g.name)",
rate: .\(g.rate),
parameters: [
\(paramList) ],
make: { args in
\(makeBody)
}
),\n
"""
for (index, chunk): (Int, [ScannedGenerator]) in chunks.enumerated() {
out += " private static let \(chunkNames[index]): [DSLBuiltin] = [\n"
for g: ScannedGenerator in chunk {
out += emitRegistryEntry(g)
}
out += " ]\n\n"
}
out += """
]
}
"""