Files
Claude 55bd6015da iOS: SSH on libdmodemssh, the apps' own client on libssh
native-ssh is the desktop apps' SSH engine (D-Modem/gui's ssh/), built
here from libssh's and mbedTLS's release tarballs for the host, Android
and Apple's systems.  ios/build-native.sh makes it
DModemSSHNative.xcframework, each arch linked into one object whose only
globals are dmc_ssh_*, so its mbedTLS never meets the engine's.
DModemSSH's SSHShell keeps its API on it (SwiftNIO SSH goes), adding RSA,
keyboard-interactive and private keys; CI runs its tests and the
engine's against a real sshd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
2026-11-12 13:15:49 +00:00

38 lines
1.6 KiB
Swift

// swift-tools-version:5.9
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2026 Neo-Desktop
//
// DModemSSH: the iOS app's SSH client, an interactive shell on a pty, on
// libdmodemssh (native-ssh: the same engine as the Android and desktop
// apps', on libssh). On Apple's systems that is build-apple's XCFramework
// (ios/build-native.sh); on Linux the host build's libraries (cmake -S
// native-ssh -B build-ssh, or DMODEM_SSH_HOST_BUILD), so that its tests
// run there too (against a local sshd, when DMODEM_SSH_TEST names one).
import Foundation
import PackageDescription
#if os(Linux)
let host = ProcessInfo.processInfo.environment["DMODEM_SSH_HOST_BUILD"] ?? "../../build-ssh"
let native: Target = .systemLibrary(name: "CDModemSSH", path: "Sources/CDModemSSHHost")
let nativeLinking: [LinkerSetting] = [
.unsafeFlags(["-L\(host)", "-L\(host)/dmodem-libssh/lib"]),
.linkedLibrary("dmodemssh"), .linkedLibrary("ssh"),
.linkedLibrary("mbedtls"), .linkedLibrary("mbedx509"), .linkedLibrary("mbedcrypto"),
.linkedLibrary("everest"), .linkedLibrary("p256m"), .linkedLibrary("pthread"),
]
#else
let native: Target = .binaryTarget(name: "CDModemSSH", path: "../../build-apple/DModemSSHNative.xcframework")
let nativeLinking: [LinkerSetting] = []
#endif
let package = Package(
name: "DModemSSH",
platforms: [.macOS(.v12), .iOS(.v15)],
products: [.library(name: "DModemSSH", targets: ["DModemSSH"])],
targets: [
native,
.target(name: "DModemSSH", dependencies: ["CDModemSSH"], linkerSettings: nativeLinking),
.testTarget(name: "DModemSSHTests", dependencies: ["DModemSSH"]),
]
)