38 lines
931 B
Bash
Executable File
38 lines
931 B
Bash
Executable File
#!/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 ! 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"
|