Repository navigation
Conversation
Add FreeBSD as a supported platform for OpenTUI's native Zig core.
* packages/native/build.zig: add x86_64-freebsd and aarch64-freebsd
targets so `zig build` can produce libopentui.so for FreeBSD.
* packages/core: teach the native asset loader about freebsd
(NATIVE_FILE_NAMES + the resolveNativeLibraryPath runtime branch).
* packages/core: resolve the @opentui/core-freebsd-{x64,arm64} packages
at runtime and list them as optionalDependencies.
* packages/core: include freebsd in scripts/variants.ts so the host
build works and the release build packages freebsd binaries.
Tested on FreeBSD 15.1 (Zig 0.16.0) on both x86_64 and aarch64: the
native core builds with `zig build -Doptimize=ReleaseFast`, and the
resulting libopentui.so loads and renders correctly.
The native renderer thread deadlocks on FreeBSD (the TUI freezes after the first render), so turn it off there too, matching the existing Linux guard.
|
Follow-up for OpenCode's persistent terminals: this PR enables the native-target and asset plumbing, but Adding return switch (target.result.os.tag) {
.linux => target.result.abi.isMusl() or target.result.abi == .gnu,
.macos => true,
.windows => target.result.abi == .gnu,
.freebsd => true,
else => false,
};Verified on FreeBSD 15.1/aarch64 with Zig 0.16.0: after the change |
|
Tested this approach end to end and it works. A few gaps remain between landing the source support and actually shipping Missing pieces to publish the packages
Stale hunk
Verified
Happy to push the workflow/symbol-separation half as a follow-up branch if that is easier than amending here. |
# Conflicts: # packages/core/package.json # packages/core/src/renderer.ts
The source-side support is in place but the release pipeline is hand-enumerated, so the new variants would never ship. Add the freebsd zip blocks, npm-package copy list, verify checks, upload entries, and symbol targets to build-native/release, and fold freebsd into the ELF branch of separateNativeSymbols (FreeBSD shares readelf/objcopy/nm).
|
Opened samm-git#1 against your |
main merge + CI: publish freebsd native artifacts, fix symbol separation
|
Thanks. We're keeping #1445 as the base for FreeBSD support, so I'm closing this one. |
What
Adds FreeBSD (x86_64 and aarch64) as a supported platform for OpenTUI's native Zig core.
Changes
packages/native/build.zig: addx86_64-freebsdandaarch64-freebsdtoSUPPORTED_TARGETS.packages/core/src/node-asset-target.ts: acceptfreebsdand map it tolibopentui.so.packages/core/src/platform/runtime-assets.bun.ts: resolve@opentui/core-freebsd-{x64,arm64}at runtime.packages/core/scripts/variants.ts: build/package the FreeBSD variants.packages/core/package.json: list the FreeBSD packages asoptionalDependencies.packages/core/src/node-assets.test.ts: FreeBSD is now supported, so the "unsupported platform" case uses a different platform.Why
OpenTUI currently only ships darwin/linux/win32 binaries, and the native-asset loader hard-rejects
freebsd(theNodeAssetTargetunion andNATIVE_FILE_NAMESdon't include it). Applications that depend on OpenTUI — for example OpenCode, whose TUI is built on it — therefore can't run on FreeBSD without building the core from source and patching the loader. This makes FreeBSD a first-class target.Testing
Zig 0.16.0 on FreeBSD 15.1, both architectures:
The resulting
libopentui.soloads over FFI and renders correctly — verified end-to-end by running OpenCode's TUI on FreeBSD/amd64 and FreeBSD/aarch64.Notes
noderuntime path already resolves dynamically viaasset.packageName, so only the bun FFI path needed an explicit branch.