# Template file for 'cabal-install'
pkgname=cabal-install
version=3.6.3.0
revision=2
hostmakedepends="ghc curl tar which"
makedepends="gmp-devel libffi-devel zlib-devel python3"
depends="ghc"
short_desc="Command-line interface for Cabal and Hackage"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause"
homepage="https://hackage.haskell.org/package/cabal-install"
distfiles="https://github.com/haskell/cabal/archive/Cabal-v${version}.tar.gz"
checksum=dea086acad6d9fe5fe22d838b95b4e988022e8519f38d41609119ea32bfb7466
nopie_files="/usr/bin/cabal"
nocross=yes

post_extract() {
	cp "${FILESDIR}/linux-9.0.2.json" bootstrap/
}

post_patch() {
	case "${XBPS_TARGET_MACHINE}" in
	i686*)
		# https://github.com/haskell/cabal/issues/7313
		vsed -i -e 's/+ofd-locking/-ofd-locking/' bootstrap/linux-9.0.2.json ;;
	esac
}

do_build() {
	PREFIX=$PWD bootstrap/bootstrap.py -d bootstrap/linux-9.0.2.json
}
do_install() {
	vbin _build/bin/cabal
	PREFIX=$PWD _build/bin/cabal man --raw > cabal.1
	vman cabal.1
	vlicense LICENSE
}
