# Contributor: Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com>
# Maintainer: Kiyoshi Aman <kiyoshi.aman+adelie@gmail.com>
pkgname=irssi
pkgver=1.2.0
pkgrel=0
pkgdesc="Text-based IRC client"
url="https://irssi.org"
arch="all"
license="GPL-2.0+ AND ISC"
makedepends="ncurses-dev glib-dev openssl-dev perl-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-perl"
source="https://github.com/irssi/irssi/releases/download/$pkgver/irssi-$pkgver.tar.xz
	fix-ridiculous-egregious-conformance-error.patch
	"

build() {
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-true-color \
		--with-perl=module \
		--with-perl-lib=vendor
	make
}

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

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

perl() {
	depends="perl"
	pkgdesc="Perl support & scripts for irssi"

	mkdir -p "$subpkgdir"/usr "$subpkgdir"/usr/share/irssi
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr
	mv "$pkgdir"/usr/share/irssi/scripts "$subpkgdir"/usr/share/irssi
}
sha512sums="343530ca63355dd6683e84f31602c9162e1e3158e52ce81e37519d1e42abbdcb621fb710fcb605fcafd7e7ea3f2c30ed62607d4ea91d8c8dc29bf893e54aee40  irssi-1.2.0.tar.xz
88c9fe5593a81b92943d1ca419b39d074f9c52378350007c0896aa95ef056e098201b338d31da31b5ec1492e1577d2862b989e00427dc89edde0bcef46cd8e2a  fix-ridiculous-egregious-conformance-error.patch"