summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fbac6ef630bb7a9a0fef2d2c8fc6442fcd2b33f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Maintainer: Mike Kazantsev <mk.fraggod@gmail.com>

pkgname=telegram-tdlib-purple-git
pkgver=0.8.1.r523.d220fa8
pkgrel=1
pkgdesc='libpurple/pidgin Telegram plugin implemented using official tdlib client library'
arch=(x86_64 aarch64)
url='https://github.com/BenWiederhake/tdlib-purple/'
license=(GPL2 LGPL2.1 custom:FTL custom:PIX custom:RPD custom:SKIA custom:STB)
depends=(libtgvoip libpng libpurple libwebp)
makedepends=(cmake git gperf)
conflicts=(telegram-tdlib-purple)
provides=(telegram-tdlib-purple="${pkgver}")
source=(
	"$pkgname"::git+"$url"
	td::git+https://github.com/tdlib/td.git )
sha256sums=( SKIP SKIP )

pkgver() {
	cd $pkgname
	ver=$(awk '/^\s*set\(VERSION / {sub(")","",$2); print $2}' CMakeLists.txt)
	[[ -n "$ver" ]] || { echo >&2 "ERROR: Failed to parse version from CMakeLists.txt"; exit 1; }
	printf "%s.r%s.%s" "$ver" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd $pkgname
	git submodule init
	git config submodule.td.url "$srcdir/td"
	git -c protocol.file.allow=always submodule update
}

build() {
	cd $pkgname

	# Build specific tdlib version - can be long, use "makepkg -e" to avoid rebuilding from scratch
	pushd td
		mkdir -p build && pushd build
			cmake -DCMAKE_BUILD_TYPE=Release ..
			make
			make install DESTDIR=destdir
	popd; popd

	# Build and statically link libtelegram-tdlib.so against tdlib above
	mkdir -p build && pushd build
	cmake \
		-DTd_DIR="$(realpath ../td)"/build/destdir/usr/local/lib/cmake/Td/ \
		-Dtgvoip_INCLUDE_DIRS=/usr/include/tgvoip ..
	make
	popd
}

package() {
	cd $pkgname
	install -Dm755 -t "$pkgdir$(pkg-config --variable plugindir purple)" build/libtelegram-tdlib.so
	install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" rlottie/licenses/*
}