# Template file for 'stack'
pkgname=stack
version=1.0.2
revision=1
_stackage="lts-5.0"
hostmakedepends="cabal-install"
makedepends="zlib-devel pcre-devel"
depends="git iana-etc"
short_desc="Cross-platform program for developing Haskell projects"
maintainer="Christian Neukirchen <chneukirchen@gmail.com>"
license="BSD-3"
homepage="http://haskellstack.org"
distfiles="https://github.com/commercialhaskell/stack/archive/v${version}.tar.gz
 https://www.stackage.org/${_stackage}/cabal.config>cabal.config-${_stackage}"
skip_extraction="cabal.config-${_stackage}"
checksum="611e96aab0df2a2ad717cfbfe6018e67a90ecb1fb478c9e3c6d90478125986f0
 06dbb17fc55beeb432f4f16b43505c7a285b69b43f6bc732da2049250726a139"
nocross=yes
nopie=yes  # network-2.6.2.1 build fails with a relocation

do_build() {
	cabal sandbox init
	cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/cabal.config-${_stackage} cabal.config
	cabal update
	cabal install ${makejobs} --only-dependencies
	cabal install ${makejobs} cpphs
	cabal configure -v --prefix=/usr --libsubdir='$pkg' \
		--datasubdir='$pkg' --docdir='$datadir/doc/$pkg'
	cabal build ${makejobs}
}

do_install() {
	vbin dist/build/stack/stack
	vlicense LICENSE
}
