# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# ebuild generated by hackport 0.9.0.0.9999
#hackport: flags: -werror

CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal

DESCRIPTION="DB migration library for beam, targeting Postgres"
HOMEPAGE="https://hackage.haskell.org/package/beam-automigrate"

LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64"
IUSE="examples ghcipretty"

CABAL_CHDEPS=(
	'aeson                 >=1.4.4    && <2.2' 'aeson >= 1.4.4'
	'bytestring            >=0.10.8.2 && <0.12.0.0' 'bytestring >= 0.10.8.2'
	'postgresql-simple     >=0.5.4    && <0.7.0.0' 'postgresql-simple >= 0.5.4'
	'text                  >=1.2.0.0  && <1.3.0.0' 'text >= 1.2.0.0'
	'vector                >=0.12.0.3 && <0.13.0.0' 'vector >= 0.12.0.3'
	)

PATCHES=(
	"${FILESDIR}/${PN}-0.1.3.0-add-examples-flag.patch"
	"${FILESDIR}/${PN}-0.1.3.0-disable-test-exes.patch"
	"${FILESDIR}"/${P}-control-monad.patch
)

RDEPEND=">=dev-haskell/aeson-1.4.4:=[profile?]
	>=dev-haskell/beam-core-0.9:=[profile?] <dev-haskell/beam-core-0.11:=[profile?]
	>=dev-haskell/beam-postgres-0.5:=[profile?] <dev-haskell/beam-postgres-0.6:=[profile?]
	>=dev-haskell/dlist-0.8.0:=[profile?] <dev-haskell/dlist-1.1:=[profile?]
	dev-haskell/gargoyle-postgresql-connect:=[profile?]
	>=dev-haskell/microlens-0.4.10:=[profile?] <dev-haskell/microlens-0.6:=[profile?]
	>=dev-haskell/postgresql-simple-0.5.4:=[profile?] <dev-haskell/postgresql-simple-0.8.0.0:=[profile?]
	>=dev-haskell/postgresql-syntax-0.3:=[profile?] <dev-haskell/postgresql-syntax-0.5:=[profile?]
	>=dev-haskell/pretty-simple-2.2.0:=[profile?] <dev-haskell/pretty-simple-4.2:=[profile?]
	>=dev-haskell/quickcheck-2.13:=[profile?] <dev-haskell/quickcheck-2.15:=[profile?]
	>=dev-haskell/quickcheck-instances-0.3:=[profile?] <dev-haskell/quickcheck-instances-0.4:=[profile?]
	dev-haskell/resource-pool:=[profile?]
	>=dev-haskell/scientific-0.3.6:=[profile?] <dev-haskell/scientific-0.5:=[profile?]
	>=dev-haskell/splitmix-0.0.3:=[profile?] <dev-haskell/splitmix-0.2:=[profile?]
	>=dev-haskell/string-conv-0.1.2:=[profile?] <dev-haskell/string-conv-0.3:=[profile?]
	dev-haskell/syb:=[profile?]
	dev-haskell/tasty:=[profile?]
	dev-haskell/tasty-quickcheck:=[profile?]
	>=dev-haskell/text-1.2.0.0:=[profile?]
	>=dev-haskell/uuid-1.3:=[profile?] <dev-haskell/uuid-1.4:=[profile?]
	>=dev-haskell/vector-0.12.0.3:=[profile?]
	>=dev-lang/ghc-9.0.2:=
"
DEPEND="${RDEPEND}
	>=dev-haskell/cabal-3.4.1.0
"

src_configure() {
	haskell-cabal_src_configure \
		$(cabal_flag examples examples) \
		$(cabal_flag ghcipretty ghcipretty) \
		--flag=-werror
}