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:
@@ -0,0 +1,44 @@
|
||||
// SwiftToolchain.swift
|
||||
// Lyrebird
|
||||
//
|
||||
// Copyright (c) 2026 Joshua Parmenter / realizedsound
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import Foundation
|
||||
|
||||
/// Locates the `swift` executable for `lyrebird run` / `lyrebird repl`.
|
||||
///
|
||||
/// Searches `PATH` first, so whatever toolchain the user's shell resolves
|
||||
/// `swift` to is honoured — a swiftly shim (`~/.local/share/swiftly/bin/swift`),
|
||||
/// Homebrew, or a custom prefix — then falls back to the well-known absolute
|
||||
/// locations for a bare environment with an empty `PATH`. Returns `nil` if no
|
||||
/// `swift` executable is found anywhere.
|
||||
///
|
||||
/// The hardcoded fallbacks alone were macOS-only (`/usr/bin/swift` etc.) and
|
||||
/// missed every non-default Linux install, most notably swiftly.
|
||||
func lyrebirdLocateSwift() -> String? {
|
||||
let fileManager: FileManager = FileManager.default
|
||||
let executableName: String = "swift"
|
||||
|
||||
// PATH, in order — the active toolchain wins over the fallbacks below.
|
||||
if let pathEnv: String = ProcessInfo.processInfo.environment["PATH"] {
|
||||
let directories: [String] = pathEnv
|
||||
.split(separator: ":", omittingEmptySubsequences: true)
|
||||
.map(String.init)
|
||||
for directory: String in directories {
|
||||
let candidate: String = directory.hasSuffix("/")
|
||||
? directory + executableName
|
||||
: directory + "/" + executableName
|
||||
if fileManager.isExecutableFile(atPath: candidate) {
|
||||
return candidate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Well-known absolute locations, for an environment with no usable PATH.
|
||||
let fallbacks: [String] = ["/usr/bin/swift", "/usr/local/bin/swift", "/opt/homebrew/bin/swift"]
|
||||
for path: String in fallbacks where fileManager.isExecutableFile(atPath: path) {
|
||||
return path
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user