Repository navigation
Conversation
2e794aa to
77a6267
Compare
…ndency row (LNPANDY#117) and the bundled tools (LNPANDY#121)
3576743 to
d9c0c99
Compare
…omebrew The release app carries zstd, glslangValidator, spirv-cross and xcodegen (Contents/Resources/tools/bin, built from pinned sources for macOS 13 with static libraries) and a relocatable CPython 3.13 with the packages the build scripts import. The dependency check prefers them to Homebrew's and to a system Python and shows 'bundled'; the build's PATH starts with them. Without a bundle (swift run, older builds) nothing changes.
Package.swift, the bundle's LSMinimumSystemVersion, the bundled tools' deployment target and the player requirements in both READMEs say macOS 26.6 or later, Xcode 27.1; the requirements no longer list Homebrew or Python, which the app carries.
The row says zstd, spirv-cross, xcodegen or glslangValidator with the detail bundled; the brew: label stays on rows that refer to a Homebrew copy (installed there, or missing with the install button).
d9c0c99 to
1a57d85
Compare
After unpacking, the new bundle's LSMinimumSystemVersion is compared with the running macOS. Above it, nothing is installed: the update sheet and the status line say that NX2Apple <version> needs macOS <min> and this Mac has <current>, and the running version stays.
|
Thank you — the work is careful (pinned sources, static builds, ad-hoc signatures, 21 tests), and it would remove exactly the class of pain users hit with Homebrew today ( Decision: not now. The cost that stops it is the macOS floor: bundling the tools raises the minimum to 26.6, and that cuts off users who are otherwise fine with an older Xcode. The dependency problem is real, but we will solve it from the other side first: complete, actionable error messages for every dependency/build failure (a new issue is open for it), so a user whose Homebrew is broken reads what to type instead of a one-second spinner. Keeping this open as the future direction if the floor ever moves for another reason; closing it for now so it does not read as pending. Please don't take it as a judgement of the work itself — it is the strongest PR of the batch in engineering terms. |
|
Fair point, and the floor was my mistake: the bundling doesn't need it. The first commit of this PR built the tools for macOS 13; I raised the floor afterwards to match upstream's Xcode 27.1, but as you say, non-NVN games (and NVN with Why I'd still like the bundling soon:
The new PR follows as a feature PR (48h), with the compatibility section saying the floor stays at macOS 13. |
Builds on #117.
The release app now carries the build tools and a Python, so a player installs neither Homebrew nor Python.
What is bundled
In
NX2Apple.app/Contents/Resources:tools/bin/zstdtools/bin/glslangValidatortools/bin/spirv-crossdm/gfx/tools/spirv_cross_bin/build.shbuilds)tools/bin/xcodegen(+tools/share/xcodegen)python/install_onlyarm64)frontend/tools/bundled-python-requirements.txt)--only-binary, at build timeLicense files go to
tools/licenses(the tools' and each Python package's).Why not Homebrew's bottles (the design suggested them first): they are built for the macOS they are poured on (bottles of 2026 say
minos15 or later; the launcher now requires macOS 26.6, which they would meet, but they still need their dylibs copied and re-pathed and are pinned only by a registry digest) and link their siblings from/opt/homebrew(zstd: libzstd, liblzma, liblz4; glslang: libglslang, SPIRV-Tools).frontend/tools/bundle_tools.shbuilds the tools from the pinned sources withMACOSX_DEPLOYMENT_TARGET=26.6and static libraries instead, so each is one file linking only/usr/lib(libSystem, libc++) and, for xcodegen, the system's Swift libraries. glslang is built without the SPIR-V optimizer (the repo only callsglslangValidator -V/-E/--version). Noinstall_name_toolrewriting is needed.Size
The macOS zip grows from 2.6 MB to 53.1 MB (+50.5 MB; tools 21 MB and Python 121 MB unpacked, 151 MB app). Python's test suite, IDLE, turtle demos and Tk are dropped. The release uploads the zip under three names, so the release assets grow three times.
Launcher
BundledTools.swift: the bundledtools/binand Python fromBundle.main.resourceURL, nil outside a.app(swift run).BuildModel.toolPath, replaces the four build-related PATH strings (build, nsz install, RomFS image, venv): bundledtools/bin, then the bundled Python'sbin, then the old directories. The git, dotnet and stage-command environments are untouched.PYTHONDONTWRITEBYTECODE=1, so no.pycis written into the signed app.scripts/build_ipa_from_nsp.pyneeds no change: it finds tools withshutil.whichon the PATH the launcher passes and runs withsys.executable. One thing to know: the script prepends/opt/homebrew/binand/usr/local/binto that PATH itself (TOOL_PATHS), so on a Mac that also has Homebrew's copy, the script uses Homebrew's. Both work; the bundle matters where Homebrew is absent. It also builds with its own in-repospirv_cross_bin/spirv-cross; the bundledspirv-crossis for the check and for tools that call it by name.Signing
bundle_tools.shad-hoc signs every Mach-O file undertoolsandpython(62 files) itself, becausecodesign --deepdoes not reach code inResources. Then the app is signed as before.codesign -v --deep --strictpasses, also on a copy unzipped elsewhere.Unchanged
.NET stays as it is (dotnet-install.sh into
~/.dotnet), Xcode and the iOS SDK and Metal toolchain are still the player's. The Brewfile stays for source users and CI.scripts/,dm/,docs/are untouched.Tests
swift test:BundledToolsTests(fake bundle: detection precedence, the Homebrew row rule, the Python choice, the PATH helper, and that the pinned packages coverpipPackages).swift build -c releasepasses.frontend/tools/check_bundle.sh, run by the workflow after assembling and by hand: each tool runs from the bundle withenv -i PATH=/usr/bin:/bin(zstd --version,glslangValidator --version,spirv-cross --help,xcodegen --version), the bundled Python imports lz4, capstone, fontTools, nsz and zstd and has the bundle as its prefix, no Mach-O file links outside/usr/lib,/System/Libraryor the bundle (nothing into/opt/homebrew) and none needs macOS later than 26.6.frontend/or itself (artifact only, no release), so this PR's CI assembles the real bundle.Not tested: a Mac on exactly macOS 26.6 (checked with
otool), an Intel Mac (the app is arm64 only), a build of a game from the launcher with the bundled tools (no game files here).Floor: macOS 26.6
Second commit: the launcher's macOS floor (a default from its first commit) is now what upstream requires, macOS 26.6 and Xcode 27.1.
Package.swift(.macOS("26.6"), accepted by swift-tools 5.9),LSMinimumSystemVersion, the tools' deployment target, and the player requirements in README.md and README.zh-CN.md (no Homebrew or Python for players; the build-from-source section keeps them). There were no#availablebranches to remove.Screenshots
Settings → Build tools → Device dependencies with a fake bundle that holds the four tools and a Python (English): every tool and the Python row say "bundled", and there is no Homebrew row. Rendered offscreen from the branch. A bundled tool's row is named by the tool ("zstd", "glslangValidator", "spirv-cross", "xcodegen"); the "brew: …" label stays on rows that refer to a Homebrew copy.
Compatibility cost
The launcher's minimum goes from macOS 13 (
Package.swiftandLSMinimumSystemVersionon main) to 26.6.What it buys
LSMinimumSystemVersion26.6 (checked on this Mac with Xcode 27.1). A launcher that opens on macOS 13 to 26.5 cannot build anything there.MACOSX_DEPLOYMENT_TARGET=26.6, andcheck_bundle.shfails on any Mach-O file that needs later). There is no 13 to 26.5 matrix that we cannot test.dm/mac/pack_app.pymin_os()reads the host'sLC_BUILD_VERSIONminos, anddm/host/Makefilesets no-mmacosx-version-min, so the host takes the building Mac's default (a plainclangon this macOS 27 Mac gives minos 27.0). A game built on macOS 26.6 needs 26.6, one built on macOS 27 needs 27. So the 26.6 floor does not widen or narrow what a built game runs on; the game's minimum is whatever the Mac that built it had.Who it leaves behind
LSMinimumSystemVersion. If it is above the running macOS, nothing is installed. The update sheet and the status line say "NX2Apple needs macOS and this Mac has " (en and zh), and the running version stays. Without it, an older launcher would replace itself with a 26.6-only app that does not open. Unit tests cover the version comparison, the decision and staging.For Andy (releases)
This changes the supported-OS line in the README and the release notes. The release notes of the version that ships this should state the new minimum, macOS 26.6.