macOS shares the Linux transport: TlsChannel.h now dispatches __APPLE__ to the OpenSSL implementation, so handshake, pinned trust anchor, reload and removal all come from client/TlsChannelLinux.cpp. Only the platform glue is new: ConfigDir() follows initConfigPaths (HOME, then getpwuid(), then /tmp; no XDG) so the anchor sits next to config.conf, and ExeDir() uses _NSGetExecutablePath. First connect stays plaintext. The operator turns TLS on from the online list: COMMAND_TLS_ENABLE carries the anchor PEM, COMMAND_TLS_DISABLE removes it. macos/main.mm saves the anchor, calls TlsReload() and only reconnects when the transport actually changed, so re-saving the same anchor does not drop a live session. RES_TLS is filled from TlsEnabled() and refreshed on every reconnect; fillLoginInfo clears szReserved first now, because AddReserved appends and it runs twice on a group change. CMake builds arm64 only (deployment target 11.0) and links Homebrew openssl@3 statically when libcrypto.a is present, so the binary carries no Homebrew path dependency. Not built or run on a Mac yet: the Apple branch was syntax-checked under WSL and the login refresh probe-tested; macos/README.txt has the build and verify steps. Co-Authored-By: deepseek-flash
53 lines
1.2 KiB
Bash
53 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
# macOS Ghost Client Build Script
|
|
# Usage: ./build.sh
|
|
|
|
set -e
|
|
|
|
echo "=== macOS Ghost Client Build ==="
|
|
echo ""
|
|
|
|
# Check for Xcode Command Line Tools
|
|
if ! command -v clang &> /dev/null; then
|
|
echo "Error: Xcode Command Line Tools not installed"
|
|
echo "Run: xcode-select --install"
|
|
exit 1
|
|
fi
|
|
|
|
# Check for CMake
|
|
if ! command -v cmake &> /dev/null; then
|
|
echo "Error: CMake not installed"
|
|
echo "Install with: brew install cmake"
|
|
exit 1
|
|
fi
|
|
|
|
# Create build directory
|
|
mkdir -p build
|
|
cd build
|
|
|
|
# Configure
|
|
# 架构与最低系统版本显式传:两者都是 CMake 的 cache 变量,旧 build 目录里可能还存着
|
|
# universal / 10.13 的旧值,只改 CMakeLists.txt 不会生效(arm64 + Homebrew OpenSSL
|
|
# 是单架构组合,留着 x86_64 slice 会链接失败)。
|
|
echo "Configuring..."
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_OSX_ARCHITECTURES=arm64 \
|
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0
|
|
|
|
# Build
|
|
echo ""
|
|
echo "Building..."
|
|
cmake --build . --config Release -j$(sysctl -n hw.ncpu)
|
|
|
|
# Done
|
|
echo ""
|
|
echo "=== Build Complete ==="
|
|
echo "Executable: build/bin/ghost"
|
|
echo ""
|
|
echo "To run:"
|
|
echo " ./bin/ghost [server_ip] [port]"
|
|
echo ""
|
|
echo "Example:"
|
|
echo " ./bin/ghost 192.168.0.55 6543"
|