Skip to content

feat: add FreeBSD (x86_64, aarch64) build support - #53371

Closed
samm-git wants to merge 3 commits into
anomalyco:devfrom
samm-git:freebsd-support
Closed

samm-git wants to merge 3 commits into
anomalyco:devfrom
samm-git:freebsd-support

Conversation

@samm-git

@samm-git samm-git commented Oct 5, 2026 •

Copy link
Copy Markdown

Issue for this PR

Refs #48658 — the @ff-labs/fff-bun startup crash this also fixes.

Type of change

  • New feature

What does this PR do?

Adds FreeBSD as a build target so the CLI can be built from source there.

In packages/cli/script/build.ts:

  • adds the freebsd arm64/x64 targets, so --target=opencode-freebsd-<arch> resolves and Bun.build({ compile: { target: "bun-freebsd-<arch>" } }) produces a FreeBSD binary;
  • stubs the @parcel/watcher binding on FreeBSD. There is no @parcel/watcher-freebsd-* package, and the watcher already falls back to node:fs for file/entries watches and logs "backend not supported" for recursive directories, so a throwing stub is enough;
  • replaces the @ff-labs/fff-bun module with an unavailable backend on FreeBSD. That package is not published for FreeBSD (its os field excludes it), so bun never installs it and the static import { FileFinder } in fff.bun.ts throws Cannot find module before anything runs. The stub keeps available false and makes create return a clean error instead of crashing startup;
  • turns bytecode off for --compile on FreeBSD, where bun does not emit it.

Every change is gated on the FreeBSD target (either item.os === "freebsd" in the build script, or a plugin that only applies for that target), so Linux/macOS/Windows behaviour is untouched.

The TUI also needs OpenTUI to accept freebsd; that is anomalyco/opentui#1565.

How did you verify your code works?

Built with Bun 1.4.2 on FreeBSD 15.1-RELEASE, on amd64 and aarch64:

bun run script/build.ts --target=opencode-freebsd-x64
bun run script/build.ts --target=opencode-freebsd-arm64

Both produce a self-contained executable that starts and runs a conversation. I checked the degraded paths explicitly: the watcher falls back to node:fs, and fff.available is false with create returning the "unavailable" error rather than throwing.

Screenshots / recordings

N/A — no UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- add the freebsd targets so `--target=opencode-freebsd-<arch>` resolves
  and Bun.build({ compile: { target: "bun-freebsd-<arch>" } }) works
- degrade the @parcel/watcher binding to a stub on FreeBSD, which has no
  prebuilt @parcel/watcher-freebsd-* package
- disable --compile bytecode on FreeBSD, where bun does not emit it
@ff-labs/fff-bun is not published for every platform (FreeBSD, for one),
so the hard import aborts the CLI at startup with "Cannot find module".
Fall back to the existing unavailable path instead of importing it.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

The previous change dropped the @ff-labs/fff-bun import unconditionally,
which also disabled the file finder on linux/darwin/win32 where that
package is published.  Restore the import in fff.bun.ts and instead
replace the module with an unavailable stub only for the freebsd target,
mirroring the parcel-watcher handling in build.ts.
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@samm-git

samm-git commented Nov 6, 2026

Copy link
Copy Markdown
Author

Please reopen. Patch is still valid and relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant