Use manual TDLib bundle for app releases
Some checks failed
Release App / release-app (push) Has been cancelled
Some checks failed
Release App / release-app (push) Has been cancelled
This commit is contained in:
@@ -16,6 +16,7 @@ jobs:
|
|||||||
RELEASE_TAG: latest
|
RELEASE_TAG: latest
|
||||||
ARCHIVE_NAME: shinoa-linux-x86_64.tar.gz
|
ARCHIVE_NAME: shinoa-linux-x86_64.tar.gz
|
||||||
CHECKSUM_NAME: shinoa-linux-x86_64.tar.gz.sha256
|
CHECKSUM_NAME: shinoa-linux-x86_64.tar.gz.sha256
|
||||||
|
TDLIB_ARCHIVE_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/releases/download/tdlib/tdlib-linux-x86_64.tar.gz
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
@@ -44,19 +45,27 @@ jobs:
|
|||||||
pkg-config \
|
pkg-config \
|
||||||
zlib1g-dev
|
zlib1g-dev
|
||||||
|
|
||||||
|
- name: Download prebuilt TDLib
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
curl --fail-with-body -L "$TDLIB_ARCHIVE_URL" -o tdlib-linux-x86_64.tar.gz
|
||||||
|
tar -xzf tdlib-linux-x86_64.tar.gz
|
||||||
|
test -f tdlib/include/td/telegram/td_json_client.h
|
||||||
|
test -f tdlib/lib/libtdjson.so
|
||||||
|
|
||||||
- name: Build release bundle
|
- name: Build release bundle
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
rm -rf build dist
|
rm -rf build dist
|
||||||
|
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
cmake -S . -B build \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DTELEGRAM_TUI_TDLIB_ROOT="$PWD/tdlib"
|
||||||
cmake --build build -j"$(nproc)"
|
cmake --build build -j"$(nproc)"
|
||||||
|
|
||||||
install -dm755 dist/usr/bin dist/usr/lib dist/usr/share/doc/shinoa
|
install -dm755 dist/usr/bin dist/usr/lib dist/usr/share/doc/shinoa
|
||||||
install -m755 build/shinoa dist/usr/bin/shinoa
|
install -m755 build/shinoa dist/usr/bin/shinoa
|
||||||
install -m755 build/_deps/tdlib-build/libtdjson.so.1.8.63 \
|
cp -a tdlib/lib/libtdjson.so* dist/usr/lib/
|
||||||
dist/usr/lib/libtdjson.so.1.8.63
|
|
||||||
ln -sf libtdjson.so.1.8.63 dist/usr/lib/libtdjson.so
|
|
||||||
install -m644 README.md dist/usr/share/doc/shinoa/README.md
|
install -m644 README.md dist/usr/share/doc/shinoa/README.md
|
||||||
|
|
||||||
patchelf --remove-rpath dist/usr/bin/shinoa
|
patchelf --remove-rpath dist/usr/bin/shinoa
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ find_program(CLANG_FORMAT_BIN clang-format)
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
option(TELEGRAM_TUI_USE_SYSTEM_TDLIB "Use an installed TDLib package instead of fetching it." OFF)
|
option(TELEGRAM_TUI_USE_SYSTEM_TDLIB "Use an installed TDLib package instead of fetching it." OFF)
|
||||||
|
set(TELEGRAM_TUI_TDLIB_ROOT ""
|
||||||
|
CACHE PATH "Path to a prebuilt TDLib root containing include/ and lib/ directories.")
|
||||||
|
|
||||||
set(CURSES_NEED_WIDE TRUE)
|
set(CURSES_NEED_WIDE TRUE)
|
||||||
find_package(Curses REQUIRED)
|
find_package(Curses REQUIRED)
|
||||||
@@ -46,7 +48,27 @@ configure_file(
|
|||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TELEGRAM_TUI_USE_SYSTEM_TDLIB)
|
if(TELEGRAM_TUI_TDLIB_ROOT)
|
||||||
|
find_path(TELEGRAM_TUI_TDLIB_INCLUDE_DIR
|
||||||
|
NAMES td/telegram/td_json_client.h
|
||||||
|
PATHS "${TELEGRAM_TUI_TDLIB_ROOT}/include"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
REQUIRED
|
||||||
|
)
|
||||||
|
find_library(TELEGRAM_TUI_TDLIB_LIBRARY
|
||||||
|
NAMES tdjson libtdjson.so
|
||||||
|
PATHS "${TELEGRAM_TUI_TDLIB_ROOT}/lib"
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
REQUIRED
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(TdJsonPrebuilt SHARED IMPORTED GLOBAL)
|
||||||
|
set_target_properties(TdJsonPrebuilt PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${TELEGRAM_TUI_TDLIB_LIBRARY}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${TELEGRAM_TUI_TDLIB_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
add_library(Td::TdJson ALIAS TdJsonPrebuilt)
|
||||||
|
elseif(TELEGRAM_TUI_USE_SYSTEM_TDLIB)
|
||||||
find_package(Td REQUIRED)
|
find_package(Td REQUIRED)
|
||||||
else()
|
else()
|
||||||
set(TD_ENABLE_JNI OFF CACHE BOOL "" FORCE)
|
set(TD_ENABLE_JNI OFF CACHE BOOL "" FORCE)
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -18,6 +18,8 @@ A minimal Telegram terminal client built with `ncurses` and TDLib.
|
|||||||
- TDLib build dependencies (`gperf`, `openssl`, `zlib`, `git`)
|
- TDLib build dependencies (`gperf`, `openssl`, `zlib`, `git`)
|
||||||
|
|
||||||
The project vendors TDLib automatically by default. If you already have TDLib installed with CMake package metadata, configure with `-DTELEGRAM_TUI_USE_SYSTEM_TDLIB=ON`.
|
The project vendors TDLib automatically by default. If you already have TDLib installed with CMake package metadata, configure with `-DTELEGRAM_TUI_USE_SYSTEM_TDLIB=ON`.
|
||||||
|
If you have a prebuilt TDLib bundle with `include/` and `lib/`, configure with
|
||||||
|
`-DTELEGRAM_TUI_TDLIB_ROOT=/path/to/tdlib`.
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
@@ -62,8 +64,22 @@ archive plus checksum to the Gitea Generic Package Registry under the `tdlib` pa
|
|||||||
It also refreshes a `latest/tdlib-latest.json` manifest with the newest published version.
|
It also refreshes a `latest/tdlib-latest.json` manifest with the newest published version.
|
||||||
|
|
||||||
The repository also includes [`.gitea/workflows/release-app.yaml`](.gitea/workflows/release-app.yaml),
|
The repository also includes [`.gitea/workflows/release-app.yaml`](.gitea/workflows/release-app.yaml),
|
||||||
which builds a rolling `latest` release asset containing `usr/bin/shinoa` and the bundled
|
which downloads a prebuilt TDLib bundle from this repository's `tdlib` release tag, builds a
|
||||||
`usr/lib/libtdjson.so*`. The root `PKGBUILD` installs that prebuilt release as `shinoa-bin`.
|
rolling `latest` app release, and publishes an archive containing `usr/bin/shinoa` plus the
|
||||||
|
bundled `usr/lib/libtdjson.so*`. The root `PKGBUILD` installs that prebuilt release as
|
||||||
|
`shinoa-bin`.
|
||||||
|
|
||||||
|
To prepare the TDLib bundle on your own machine:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cmake -S td -B td-build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$PWD/td-install"
|
||||||
|
cmake --build td-build -j"$(nproc)"
|
||||||
|
cmake --install td-build
|
||||||
|
./scripts/package-tdlib.sh td-install tdlib-linux-x86_64.tar.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
Upload `tdlib-linux-x86_64.tar.gz` to a release tagged `tdlib` in this repository. After that,
|
||||||
|
the `Release App` workflow can consume it and publish the app bundle.
|
||||||
|
|
||||||
## Keys
|
## Keys
|
||||||
|
|
||||||
|
|||||||
37
scripts/package-tdlib.sh
Executable file
37
scripts/package-tdlib.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/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"
|
||||||
Reference in New Issue
Block a user