Wire local TDLib into iOS FFI build
This commit is contained in:
55
scripts/build-ios-ffi-with-local-tdlib.sh
Executable file
55
scripts/build-ios-ffi-with-local-tdlib.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
target="${IOS_RUST_TARGET:-aarch64-apple-ios-sim}"
|
||||
|
||||
case "${target}" in
|
||||
aarch64-apple-ios)
|
||||
tdlib_platform_dir="${TDLIB_IOS_PLATFORM_DIR:-iphoneos}"
|
||||
;;
|
||||
aarch64-apple-ios-sim | x86_64-apple-ios)
|
||||
tdlib_platform_dir="${TDLIB_IOS_PLATFORM_DIR:-iphonesimulator}"
|
||||
;;
|
||||
*)
|
||||
printf 'Unsupported iOS Rust target: %s\n' "${target}" >&2
|
||||
printf 'Supported targets: aarch64-apple-ios, aarch64-apple-ios-sim, x86_64-apple-ios\n' >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
tdlib_root="${LOCAL_TDLIB_PATH:-${repo_root}/.build/tdlib-ios/${tdlib_platform_dir}}"
|
||||
tdlib_version="${TDLIB_VERSION:-1.8.29}"
|
||||
|
||||
if [[ -z "${DEVELOPER_DIR:-}" && -d /Applications/Xcode.app/Contents/Developer ]]; then
|
||||
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
|
||||
fi
|
||||
|
||||
if [[ ! -d "${tdlib_root}/include" ]]; then
|
||||
printf 'TDLib include directory not found: %s\n' "${tdlib_root}/include" >&2
|
||||
printf 'Run scripts/build-tdlib-ios.sh first or set LOCAL_TDLIB_PATH to a TDLib install root.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${tdlib_root}/lib/libtdjson.${tdlib_version}.dylib" ]]; then
|
||||
printf 'TDLib dylib not found: %s\n' "${tdlib_root}/lib/libtdjson.${tdlib_version}.dylib" >&2
|
||||
printf 'tdlib-rs local-tdlib expects the versioned dylib name on macOS-hosted builds.\n' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${repo_root}"
|
||||
|
||||
if ! rustup target list --installed | grep -qx "${target}"; then
|
||||
rustup target add "${target}"
|
||||
fi
|
||||
|
||||
export LOCAL_TDLIB_PATH="${tdlib_root}"
|
||||
|
||||
cargo build \
|
||||
-p tele-ios-ffi \
|
||||
--no-default-features \
|
||||
--features core-session-local-tdlib \
|
||||
--target "${target}" \
|
||||
--release
|
||||
|
||||
printf 'Built tele-ios-ffi for %s with LOCAL_TDLIB_PATH=%s\n' "${target}" "${LOCAL_TDLIB_PATH}"
|
||||
Reference in New Issue
Block a user