# Template file for 'glirc'
pkgname=glirc
version=2.41
revision=1
hostmakedepends="cabal-install"
makedepends="ncurses-devel openssl-devel"
short_desc="Console IRC client written in Haskell"
maintainer="Orphaned <orphan@voidlinux.org>"
license="ISC"
homepage="https://github.com/glguy/irc-core"
distfiles="https://github.com/glguy/irc-core/archive/refs/tags/v${version}.tar.gz"
checksum=fbb5bd030ddce70158c4d5654c8fda93093e68b9fb85df4d6cb91ab72a67a6a6
nocross="cabal does not support cross compilation"
nopie=yes	# ghc is currently built without PIE support

_cabal_opts="-g"

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	_cabal_opts+=" --ghc-option -latomic"
fi

if [ "$XBPS_MAKEJOBS" ]; then
	_cabal_opts+=" --jobs=$XBPS_MAKEJOBS"
fi

do_build() {
	cabal update $_cabal_opts
	cabal build  $_cabal_opts
	mv dist-newstyle/build/*/*/glirc-${version}/build/glirc/glirc glirc
}

do_install() {
	vbin glirc
	vman glirc.1
	vlicense LICENSE
}
