初始提交:terminalX 可运行态(M0/M1/M1.5 已真机验证)
- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
87
vendor/build/build-cssh.sh
vendored
Executable file
87
vendor/build/build-cssh.sh
vendored
Executable file
@@ -0,0 +1,87 @@
|
||||
#!/bin/bash
|
||||
# 交叉编译 libssh2 + mbedTLS → CSSHCore.xcframework(iOS device / simulator / macOS)。
|
||||
# mbedTLS 作为 libssh2 的 crypto backend(M0 选型;后续可换 OpenSSL,TXTransport 接口不变)。
|
||||
set -euo pipefail
|
||||
|
||||
VENDOR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
MBEDTLS="$VENDOR/mbedtls"
|
||||
LIBSSH2="$VENDOR/libssh2"
|
||||
OUT="$VENDOR/build/cssh"
|
||||
ARTIFACTS="$VENDOR/../artifacts"
|
||||
IOS_DEPLOY=17.0
|
||||
MAC_DEPLOY=14.0
|
||||
|
||||
build_slice() {
|
||||
local name="$1" sysname="$2" sysroot="$3" archs="$4" deploy="$5"
|
||||
local prefix="$OUT/$name/prefix"
|
||||
echo "==================== slice: $name ($archs @ $sysroot) ===================="
|
||||
rm -rf "$OUT/$name"; mkdir -p "$prefix"
|
||||
|
||||
local common=(
|
||||
-G Ninja
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_SYSTEM_NAME="$sysname"
|
||||
-DCMAKE_OSX_SYSROOT="$sysroot"
|
||||
-DCMAKE_OSX_ARCHITECTURES="$archs"
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="$deploy"
|
||||
-DCMAKE_INSTALL_PREFIX="$prefix"
|
||||
)
|
||||
|
||||
# --- mbedTLS ---
|
||||
cmake -S "$MBEDTLS" -B "$OUT/$name/mbedtls" "${common[@]}" \
|
||||
-DENABLE_TESTING=OFF -DENABLE_PROGRAMS=OFF \
|
||||
-DUSE_STATIC_MBEDTLS_LIBRARY=ON -DUSE_SHARED_MBEDTLS_LIBRARY=OFF
|
||||
cmake --build "$OUT/$name/mbedtls" --target install
|
||||
|
||||
# --- libssh2 (mbedTLS backend) ---
|
||||
cmake -S "$LIBSSH2" -B "$OUT/$name/libssh2" "${common[@]}" \
|
||||
-DCRYPTO_BACKEND=mbedTLS \
|
||||
-DCMAKE_PREFIX_PATH="$prefix" \
|
||||
-DMBEDTLS_INCLUDE_DIR="$prefix/include" \
|
||||
-DMBEDCRYPTO_LIBRARY="$prefix/lib/libmbedcrypto.a" \
|
||||
-DBUILD_SHARED_LIBS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF \
|
||||
-DENABLE_ZLIB_COMPRESSION=OFF
|
||||
cmake --build "$OUT/$name/libssh2" --target install
|
||||
|
||||
# --- 合并静态库:libssh2 + mbedtls* → 单一 libCSSHCore.a ---
|
||||
libtool -static -o "$OUT/$name/libCSSHCore.a" \
|
||||
"$prefix/lib/libssh2.a" \
|
||||
"$prefix/lib/libmbedtls.a" \
|
||||
"$prefix/lib/libmbedx509.a" \
|
||||
"$prefix/lib/libmbedcrypto.a"
|
||||
echo "[+] $name → $(lipo -archs "$OUT/$name/libCSSHCore.a")"
|
||||
}
|
||||
|
||||
pack_xcframework() {
|
||||
echo "==================== packing CSSHCore.xcframework (library-only) ===================="
|
||||
# 只打包静态库切片;头文件与 modulemap 由 TXTransport 包内的 CSSH(C) target 提供,
|
||||
# 避免 SwiftPM binaryTarget 自带 modulemap 复制到 include/ 时的冲突。
|
||||
rm -rf "$ARTIFACTS/CSSHCore.xcframework"; mkdir -p "$ARTIFACTS"
|
||||
local args=()
|
||||
for s in "$@"; do
|
||||
args+=(-library "$OUT/$s/libCSSHCore.a")
|
||||
done
|
||||
xcodebuild -create-xcframework "${args[@]}" -output "$ARTIFACTS/CSSHCore.xcframework"
|
||||
echo "[+] CSSHCore.xcframework:"; ls "$ARTIFACTS/CSSHCore.xcframework"
|
||||
|
||||
# 同步 libssh2 公共头到 CSSH C target(供 import CSSH)。
|
||||
local csshinc="$VENDOR/../packages/TXTransport/Sources/CSSH/include"
|
||||
mkdir -p "$csshinc"
|
||||
cp "$OUT/iossim/prefix/include/libssh2.h" \
|
||||
"$OUT/iossim/prefix/include/libssh2_publickey.h" \
|
||||
"$OUT/iossim/prefix/include/libssh2_sftp.h" "$csshinc/"
|
||||
echo "[+] synced libssh2 headers → $csshinc"
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
iossim) build_slice iossim iOS iphonesimulator "arm64;x86_64" "$IOS_DEPLOY" ;;
|
||||
device) build_slice ios-arm64 iOS iphoneos "arm64" "$IOS_DEPLOY" ;;
|
||||
macos) build_slice macos Darwin macosx "arm64" "$MAC_DEPLOY" ;;
|
||||
all)
|
||||
build_slice iossim iOS iphonesimulator "arm64;x86_64" "$IOS_DEPLOY"
|
||||
build_slice ios-arm64 iOS iphoneos "arm64" "$IOS_DEPLOY"
|
||||
build_slice macos Darwin macosx "arm64" "$MAC_DEPLOY"
|
||||
pack_xcframework iossim ios-arm64 macos
|
||||
;;
|
||||
pack) shift; pack_xcframework "$@" ;;
|
||||
esac
|
||||
Reference in New Issue
Block a user