# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=hexchat
pkgver=2.14.1
pkgrel=0
pkgdesc="Graphical IRC client based on XChat"
url="https://hexchat.github.io"
arch="all !armhf"
license="GPL-2.0-or-later"
depends=""
makedepends="dbus-glib-dev gtk+2.0-dev iso-codes libnotify-dev libproxy-dev
	libressl-dev libsexy-dev libxml2-dev lua5.3-dev meson python3-dev"
install=""
subpackages="$pkgname-doc $pkgname-lang $pkgname-python:_python"
source="https://dl.hexchat.net/$pkgname/$pkgname-$pkgver.tar.xz"
builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	meson --prefix=/usr \
		-Dwith-perl=false \
		-Dwith-lua=lua5.3 \
		-Dwith-sysinfo=false \
		-Dwith-libcanberra=false \
		build_dir/
	ninja -C build_dir/
}

package() {
	cd "$builddir"
	DESTDIR="$pkgdir" ninja -C build_dir/ install
	
	# not worth a -dev pkg
	rm -fr "$pkgdir"/usr/include
	rm -fr "$pkgdir"/usr/lib/pkgconfig
}

_python() {
	pkgdesc="Python plugin for hexchat"
	mkdir -p "$subpkgdir"/usr/lib/hexchat/plugins
	mv "$pkgdir"/usr/lib/hexchat/plugins/python.so \
		"$subpkgdir"/usr/lib/hexchat/plugins
}

sha512sums="2728d6f084530c1a65ddb7960db6574fef2bca77e726a2155c8b5724256f37b47421e990b1bf7c9fad7987027b2f6de4534a8df28a98cb3d28da726e16ac32dd  hexchat-2.14.1.tar.xz"
