Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions Sources/GeneratorCLI/GeneratorCLI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ extension GeneratorCLI {

@Option(
help: """
Name of the SDK bundle. Defaults to a string composed of Swift version, Linux distribution, Linux release \
Name of the SDK bundle. Defaults to a string composed of Swift version, target OS release/version \
and target CPU architecture.
"""
)
Expand Down Expand Up @@ -160,7 +160,8 @@ extension GeneratorCLI {
@Option(
help: """
The target arch of the bundle. The default depends on a recipe used for SDK generation. \
If this is passed, the target triple will default to `<target-arch>-unknown-linux-gnu`. \
If this is passed, the target triple will default to an appropriate value for the target \
platform, with its arch component set to this value. \
Use the `--target` param to pass the full target triple if needed.
"""
)
Expand Down Expand Up @@ -323,22 +324,15 @@ extension GeneratorCLI {
commandName: "make-freebsd-sdk",
abstract: "Generate a Swift SDK bundle for FreeBSD.",
discussion: """
The default `--target` triple is FreeBSD for x86_64
The default `--target` triple is FreeBSD with the same CPU architecture with host triple
"""
)

@OptionGroup
var generatorOptions: GeneratorOptions

@Option(
help: """
Swift toolchain for FreeBSD from which to copy the Swift libraries. \
This must match the architecture of the target triple.
"""
)
var fromSwiftToolchain: String? = nil

@Option(
name: .customLong("freebsd-version"),
help: """
Version of FreeBSD to use as a target platform. Example: 14.3
"""
Expand Down Expand Up @@ -377,8 +371,12 @@ extension GeneratorCLI {
let hostTriples = try self.generatorOptions.deriveHostTriples()
let targetTriple = try self.deriveTargetTriple(hostTriples: hostTriples, freeBSDVersion: self.freeBSDVersion)

if self.generatorOptions.hostSwiftPackagePath != nil {
throw StringError("This tool does not support embedding host-specific toolchains into FreeBSD SDKs")
}

let sourceSwiftToolchain: FilePath?
if let fromSwiftToolchain {
if let fromSwiftToolchain = self.generatorOptions.targetSwiftPackagePath {
sourceSwiftToolchain = .init(fromSwiftToolchain)
} else {
sourceSwiftToolchain = nil
Expand Down