build: bundle playback and YouTube dependencies

Build pinned LGPL playback libraries and package standalone YouTube helpers inside the signed native app. Keep the CLI inside the app and relocate private library links for installation without runtime Homebrew dependencies.

Record adaptive fixture completion in its EXIT trap: cancellation can exit with status 143 before the TERM trap writes its marker, while native pause and quality preservation remain correct.
This commit is contained in:
2026-10-12 01:17:22 +02:00
parent 8eba97579f
commit 31c4759c1d
13 changed files with 911 additions and 113 deletions
+6 -4
View File
@@ -14,11 +14,11 @@ enum FFmpegRuntime {
guard paths.count == libraries.count else { return metadataError }
var found = Set<String>()
for path in paths {
guard path.hasPrefix("/"), !path.contains("\0"), !path.contains("\r") else {
guard !path.contains("/"), !path.contains("\0"), !path.contains("\r") else {
return metadataError
}
let parts = URL(fileURLWithPath: path).lastPathComponent.split(separator: ".", omittingEmptySubsequences: false)
guard parts.count >= 2, parts.last == "dylib" else { return metadataError }
guard parts.count >= 3, parts.last == "dylib" else { return metadataError }
let library = String(parts[0])
guard libraries.contains(library),
parts.dropFirst().dropLast().allSatisfy({ !$0.isEmpty && $0.utf8.allSatisfy { (48...57).contains($0) } }),
@@ -26,11 +26,13 @@ enum FFmpegRuntime {
return metadataError
}
}
for path in paths {
let frameworks = app.appendingPathComponent("Contents/Frameworks", isDirectory: true)
for filename in paths {
let path = frameworks.appendingPathComponent(filename).path
_ = dlerror()
guard dlopen(path, RTLD_NOW | RTLD_LOCAL) != nil else {
let detail = dlerror().map { String(cString: $0) } ?? "The dynamic loader could not load this library."
return "The FFmpeg libraries required by this build are unavailable or broken.\n\nRequired library: \(path)\n\(detail)\n\nInstall FFmpeg with `brew install ffmpeg`. If FFmpeg was upgraded or its library versions changed, rebuild and reinstall terebi."
return "This app's bundled FFmpeg libraries are missing or broken.\n\nRequired library: \(filename)\n\(detail)\n\nRebuild and reinstall terebi, or reinstall a complete bundled app."
}
// Deliberately never dlclose: retain successful loads until exit.
}