SUMMARY="Concrete functor and monad transformers"
DESCRIPTION="A portable library of functor and monad transformers, inspired \
by the paper \"Functional Programming with Overloading and Higher-Order \
Polymorphism\", by Mark P Jones, in Advanced School of Functional \
Programming, 1995"
HOMEPAGE="https://hackage.haskell.org/package/transformers"
COPYRIGHT="2009-2020, Andy Gill, Ross Paterson"
LICENSE="BSD (3-clause)"
SOURCE_URI="https://hackage.haskell.org/package/transformers-$portVersion/transformers-$portVersion.tar.gz"
CHECKSUM_SHA256="b668795d600297e4c8a7fd55a107b9827b2c52c0bc14c5ea0d65e20e6691c66c"
REVISION="1"

ARCHITECTURES="!x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

ghcversion=8.6.5

PROVIDES="
	transformers$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcharset$secondaryArchSuffix
	lib:libgmp$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libHSbase_4.12.0.0_ghc$ghcversion$secondaryArchSuffix
	lib:libHSghc_prim_0.5.3_ghc$ghcversion$secondaryArchSuffix
	lib:libHSinteger_gmp_1.0.2.0_ghc$ghcversion$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcharset$secondaryArchSuffix
	devel:libgmp$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:sh
	cmd:ghc_$ghcversion
	cmd:gcc$secondaryArchSuffix
	"

BUILD()
{
	# Workaround for haikuporter bug #207
	mkdir -p /system/settings/ghc
	cp -r /system/lib/x86/ghc-*/package.conf.d /system/settings/ghc/

	ghc-pkg check

	ghc --make Setup -o Setup
	./Setup configure --prefix=$prefix --libdir=$libDir
	./Setup -v build
}

INSTALL()
{
	./Setup install
}
