# Maintainer: Maria Lisina <sekoohaka.sarisan@gmail.com>
pkgname=telegram-bot-api
pkgver=8.0
pkgrel=0
# they don't tag releases
_gitrev=53e15345b04fcea73b415897f10d7543005044ce
_td_gitrev=66c4751742d2ca810033b289fc57ab4f83cfc833
pkgdesc="Telegram Bot API server"
url="https://core.telegram.org/bots"
arch="all !s390x" # td fails to build on big-endian
license="BSL-1.0"
makedepends="cmake gperf linux-headers openssl-dev samurai zlib-dev"
source="$pkgname-$_gitrev.tar.gz::https://github.com/tdlib/telegram-bot-api/archive/$_gitrev.tar.gz
	td-$_td_gitrev.tar.gz::https://github.com/tdlib/td/archive/$_td_gitrev.tar.gz
	"
options="!check" # package doesn't have a testsuite

builddir="$srcdir/$pkgname-$_gitrev"

prepare() {
	default_prepare

	rm -fr "$builddir/td"
	ln -sf "$srcdir/td-$_td_gitrev" "$builddir/td"
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
3eced3006d339c187baf5358e91db90c25aece82152b5fc9ed064c3d65f000b3a0c1885b499612bc4a9afe58b13d6ce4e5579429fa747a844b9f133a2735237c  telegram-bot-api-53e15345b04fcea73b415897f10d7543005044ce.tar.gz
b4eacc2f3550091fb74ccc1e1dec66df03858d6010a152831ceb11e80c978fe9e636f5162f7dbb4118ce974b2c68c9e581033d68cd1843ad66f1f22664ed6395  td-66c4751742d2ca810033b289fc57ab4f83cfc833.tar.gz
"
