# Template file for 'glirc'
pkgname=glirc
version=2.39.0.1
revision=1
hostmakedepends="cabal-install"
makedepends="ncurses-devel openssl-devel"
short_desc="Console IRC client written in Haskell"
maintainer="Subhaditya Nath <sn03.general@gmail.com>"
license="ISC"
homepage="https://github.com/glguy/irc-core"
distfiles="https://github.com/glguy/irc-core/archive/refs/tags/v${version}.tar.gz"
checksum=16bfe9c8df273fb074ce1da91964131318934a6d568be5271c350548eeb1a6af
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
	makedepends+=" libatomic-devel"
	_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
}
