Add TDLib packaging and release scripts

This commit is contained in:
2026-04-24 14:41:09 +03:00
commit 0717d5cf42
3 changed files with 231 additions and 0 deletions

42
scripts/package-tdlib.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "usage: $0 <tdlib-root> [output-tar.gz]" >&2
exit 1
fi
tdlib_root="$(realpath "$1")"
output_path="${2:-tdlib-linux-x86_64.tar.gz}"
output_path="$(realpath -m "$output_path")"
include_dir="$tdlib_root/include"
lib_dir="$tdlib_root/lib"
if [ ! -f "$include_dir/td/telegram/td_json_client.h" ]; then
echo "missing TDLib header: $include_dir/td/telegram/td_json_client.h" >&2
exit 1
fi
if [ ! -f "$include_dir/td/telegram/tdjson_export.h" ]; then
echo "missing TDLib export header: $include_dir/td/telegram/tdjson_export.h" >&2
exit 1
fi
if ! compgen -G "$lib_dir/libtdjson.so*" >/dev/null; then
echo "missing TDLib shared library under: $lib_dir" >&2
exit 1
fi
workdir="$(mktemp -d)"
trap 'rm -rf "$workdir"' EXIT
mkdir -p "$workdir/tdlib"
cp -a "$include_dir" "$workdir/tdlib/include"
cp -a "$lib_dir" "$workdir/tdlib/lib"
tar -C "$workdir" -czf "$output_path" tdlib
sha256sum "$output_path" > "${output_path}.sha256"
echo "wrote $output_path"
echo "wrote ${output_path}.sha256"