Skip to content

[FEATURE]: allow --single to accept an optional platform target #32091

Description

@charlesverge

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

  • I have verified this feature does not already exist in the issue tracker.

Problem

The build script (script/build.ts) only supports --single to build for the current platform. Cross-compiling for a different platform (e.g. building linux-arm64 from macOS) requires either building all 14 targets or editing the source file to narrow allTargets.

Proposed approach

charlesverge#1

Make --single accept an optional value like --single linux-arm64 or --single win32. Without an argument it keeps the existing behavior (current platform). The value is parsed as <os>[-<arch>[-<variant>]] and matched against the target definitions.

Valid examples:

Command Builds
--single current platform, native variant
--single linux-arm64 Linux ARM64 (glibc)
--single linux-arm64-musl Linux ARM64 (musl)
--single linux-x64 Linux x64 (glibc)
--single linux-x64-musl Linux x64 (musl)
--single linux-x64-baseline Linux x64 baseline/SSE
--single linux-x64-musl-baseline Linux x64 musl baseline
--single darwin all macOS variants
--single win32 all Windows variants

The implementation adds ~30 lines of matching logic to packages/opencode/script/build.ts and a usage comment at the top of the file.

Why it belongs in OpenCode

Developers who need to test platform-specific builds or deploy to remote machines (Linux ARM64 servers, etc.) currently have no ergonomic way to build a single cross-compiled target. This is a small change to the existing build entrypoint with no effect on CI or release workflows.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions