# Maintainer: Daniel Isaksen <d@duniel.no>
pkgname=tmate
pkgver=2.2.1
pkgrel=1
pkgdesc="Instant Terminal Sharing"
url="https://tmate.io/"
arch="all"
license="ISC"
depends="ncurses-terminfo"
makedepends="ncurses-dev libevent-dev autoconf automake bsd-compat-headers
	libtool zlib-dev libssh-dev msgpack-c-dev"
install=
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname-io/$pkgname/archive/$pkgver.tar.gz
	0001-Fix-building-with-or-without-backtrace-3.patch
	"

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

build() {
	cd "$builddir"

	./autogen.sh

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -Dm644 example_tmux.conf \
		"$pkgdir"/usr/share/doc/$pkgname/examples/$pkgname.conf
	for file in CHANGES FAQ README TODO; do
		install -m644 "$file" "$pkgdir"/usr/share/doc/$pkgname/
	done
}

sha512sums="3d4ce7510cd8da39bc4fe63f2a64179846a813bb3560ca811d9e1e2a28b06d95a9033047a900d76bda069c249d7ebbe1143daa082b23212c5d32a50bf1819d2d  tmate-2.2.1.tar.gz
e530890d9771af22f99b6903bd37690a6cb58a3df8950dfc2159f383ed286541e12beeedd0d9752e3830799a43d12cf4f742ab64807aeef966c40ef556d9ed87  0001-Fix-building-with-or-without-backtrace-3.patch"
