Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

glslangValidator is a required row in the launcher's dependency check

v0lumehicee6efedd514
diff --git a/Brewfile b/Brewfile
index 0f9c9db0..e9546f3b 100644
--- a/Brewfile
+++ b/Brewfile
@@ -3,5 +3,5 @@
brew "xcodegen" # generates the Xcode project
brew "zstd" # decompression
brew "spirv-cross" # shader translation
-brew "glslang" # only for OpenGL (LÖVE) games
+brew "glslang" # glslangValidator: the NSP script checks for it before every build
cask "dotnet-sdk" # the .NET SDK (10) the extractor and the shader translator run on
diff --git a/README.md b/README.md
index 5aa6956d..4a86d4a9 100644
--- a/README.md
+++ b/README.md
@@ -265,7 +265,7 @@ packages, then pack an IPA.
```bash
git clone https://github.com/<you>/NX2Apple.git
cd NX2Apple
-brew bundle --file=Brewfile # xcodegen, zstd, spirv-cross, glslang (OpenGL games only), .NET SDK
+brew bundle --file=Brewfile # xcodegen, zstd, spirv-cross, glslang (the NSP script checks for it), .NET SDK
python3 -m venv .venv # Homebrew's Python refuses global pip installs (PEP 668)
.venv/bin/python -m pip install lz4 capstone fonttools nsz "backports.zstd; python_version < '3.14'"
source .venv/bin/activate # so that python3 below is the venv's (in each new terminal)
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 9661f25d..320ac5dc 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -261,7 +261,7 @@ Homebrew 工具和 Python 包,然后打 IPA。
```bash
git clone https://github.com/<you>/NX2Apple.git
cd NX2Apple
-brew bundle --file=Brewfile # xcodegen, zstd, spirv-cross, glslang(仅 OpenGL 游戏), .NET SDK
+brew bundle --file=Brewfile # xcodegen, zstd, spirv-cross, glslang(打包脚本会检查它), .NET SDK
python3 -m venv .venv # Homebrew 的 Python 不允许全局 pip 安装(PEP 668)
.venv/bin/python -m pip install lz4 capstone fonttools nsz "backports.zstd; python_version < '3.14'"
source .venv/bin/activate # 之后的 python3 即 venv 的(每个新终端都要执行)
diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swift
index fe4e7097..2b7a33e8 100644
--- a/frontend/Sources/NSPortBuilder/ContentView.swift
+++ b/frontend/Sources/NSPortBuilder/ContentView.swift
@@ -1835,9 +1835,6 @@ final class BuildModel: ObservableObject {
var present: Bool
var installing = false
var detail = ""
- /// An optional tool (glslangValidator, only for OpenGL games) that is missing neither counts in
- /// "N missing" nor stops a build.
- var required = true
let installCmd: [String] // run via bash; empty = manual (Xcode from the App Store)
}
@@ -1875,13 +1872,13 @@ final class BuildModel: ObservableObject {
/// The Homebrew formulae the dependency check offers, with the localization key of each row. The repo-root
/// Brewfile lists the same formulae (BrewfileTests keeps the two equal).
- /// `binary` is the file the formula puts in the Homebrew bin folder. glslang is optional: only OpenGL (LÖVE)
- /// games need it, so a missing one is shown but does not block a build.
- nonisolated static let brewDeps: [(formula: String, binary: String, key: String, required: Bool)] = [
- ("xcodegen", "xcodegen", "dep.xcodegen", true),
- ("zstd", "zstd", "dep.zstd", true),
- ("spirv-cross", "spirv-cross", "dep.spirv", true),
- ("glslang", "glslangValidator", "dep.glslang", false),
+ /// `binary` is the file the formula puts in the Homebrew bin folder (glslang installs glslangValidator, which the
+ /// NSP script's environment check requires).
+ nonisolated static let brewDeps: [(formula: String, binary: String, key: String)] = [
+ ("xcodegen", "xcodegen", "dep.xcodegen"),
+ ("zstd", "zstd", "dep.zstd"),
+ ("spirv-cross", "spirv-cross", "dep.spirv"),
+ ("glslang", "glslangValidator", "dep.glslang"),
]
/// The interpreter probe: lz4 / capstone / fontTools always, and zstd from either source —
@@ -2107,10 +2104,10 @@ final class BuildModel: ObservableObject {
out.append(Dep(id: "brew", name: "dep.brew", hint: "dep.brew.hint", present: brew != nil,
installCmd: ["/bin/bash", "-c",
"NONINTERACTIVE=1 /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""]))
- for (pkg, binary, key, required) in brewDeps {
+ for (pkg, binary, key) in brewDeps {
let path = firstExisting(["/opt/homebrew/bin/\(binary)", "/usr/local/bin/\(binary)"])
out.append(Dep(id: "brew:" + pkg, name: key, hint: key + ".hint", present: path != nil,
- detail: path ?? (required ? "" : "dep.optionalMissing"), required: required,
+ detail: path ?? "",
installCmd: [(brew ?? "/opt/homebrew/bin/brew"), "install", pkg]))
}
@@ -2205,7 +2202,7 @@ final class BuildModel: ObservableObject {
return p.terminationStatus == 0
}
- var allDepsPresent: Bool { depsChecked && deps.allSatisfy { $0.present || !$0.required } }
+ var allDepsPresent: Bool { depsChecked && deps.allSatisfy { $0.present } }
/// Home shown as ~ (shorter in a one-line row, and it keeps the account name out of
/// screenshots).
@@ -2796,7 +2793,7 @@ struct BuilderView: View {
Button(action: { withAnimation(.easeInOut(duration: 0.18)) { m.toggleDeps() } }) {
row(m.t("dep.title"),
detail: !m.depsChecked ? m.t("dep.checking")
- : (m.allDepsPresent ? m.t("dep.allReady") : String(format: m.t("dep.missing"), m.deps.filter { $0.required && !$0.present }.count)),
+ : (m.allDepsPresent ? m.t("dep.allReady") : String(format: m.t("dep.missing"), m.deps.filter { !$0.present }.count)),
dot: !m.depsChecked ? LauncherPalette.unbuilt : (m.allDepsPresent ? LauncherPalette.ready : LauncherPalette.building),
open: m.depsOpen) {
if !m.depsChecked { ProgressView().controlSize(.small) }
@@ -2809,7 +2806,7 @@ struct BuilderView: View {
if m.depsOpen {
ForEach(m.deps, id: \.id) { d in
divider
- row(m.t(d.name), detail: m.shortPath(m.depDetail(d)), dot: d.present ? LauncherPalette.ready : (d.required ? LauncherPalette.building : LauncherPalette.unbuilt),
+ row(m.t(d.name), detail: m.shortPath(m.depDetail(d)), dot: d.present ? LauncherPalette.ready : LauncherPalette.building,
help: m.t(d.hint)) {
if d.installing {
ProgressView().controlSize(.small)
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index 80c7f76b..67f7be35 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -427,8 +427,8 @@ enum L10n {
"dep.probe.metal.hint": ("验证 metal.exe 能产出 metallib",
"checks that metal.exe produces a metallib"),
"dep.optionalMissing": ("可选,未安装", "optional, not installed"),
- "dep.glslang": ("glslangValidator(可选)", "glslangValidator (optional)"),
- "dep.glslang.hint": ("仅 OpenGL 游戏需要", "only needed for OpenGL games"),
+ "dep.glslang": ("brew: glslang", "brew: glslang"),
+ "dep.glslang.hint": ("编译 OpenGL 游戏的着色器;打包脚本的环境检查要求它", "compiles OpenGL games' shaders; the NSP script's environment check requires it"),
"dep.installTimeout": ("安装超时(30 分钟)——网络太慢或卡住了",
"Install timed out (30 minutes) — the network is slow or stuck"),
"dep.installAll": ("一键安装全部缺失项", "Install all missing"),
diff --git a/frontend/Tests/NSPortBuilderTests/BrewfileTests.swift b/frontend/Tests/NSPortBuilderTests/BrewfileTests.swift
index 2355e840..aef4799a 100644
--- a/frontend/Tests/NSPortBuilderTests/BrewfileTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/BrewfileTests.swift
@@ -28,18 +28,6 @@ final class BrewfileTests: XCTestCase {
XCTAssertEqual(try entries("brew").count, launcher.count, "a formula is listed twice")
}
- func testGlslangIsAnOptionalRowThatDoesNotBlockBuilding() throws {
- let rows = BuildModel.brewDeps.filter { !$0.required }
- XCTAssertEqual(rows.map { $0.formula }, ["glslang"])
- for r in rows { XCTAssertNotNil(L10n.table[r.key]); XCTAssertNotNil(L10n.table[r.key + ".hint"]) }
- let model = BuildModel()
- model.depsChecked = true
- model.deps = [BuildModel.Dep(id: "g", name: "dep.glslang", hint: "dep.glslang.hint", present: false, required: false, installCmd: [])]
- XCTAssertTrue(model.allDepsPresent)
- model.deps.append(BuildModel.Dep(id: "z", name: "dep.zstd", hint: "", present: false, installCmd: []))
- XCTAssertFalse(model.allDepsPresent)
- }
-
func testBrewfileCaskIsTheDotnetSdkTheLauncherNeeds() throws {
// The launcher checks for an SDK (`dotnet --list-sdks`) and installs channel 10.0; the cask is Homebrew's SDK.
XCTAssertEqual(try entries("cask"), ["dotnet-sdk"])