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

EAPI=8

# ebuild generated by hackport 0.9.1.0.9999
#hackport: flags: -generators

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

DESCRIPTION="Netlink communication for Haskell"
HOMEPAGE="https://github.com/Ongy/netlink-hs"

LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
IUSE="executable"

PATCHES=(
	"${FILESDIR}/${PN}-1.1.1.0-add-executable-flag.patch"
)

RDEPEND=">=dev-haskell/cereal-0.3:=[profile?]
	>=dev-haskell/monad-loops-0.3:=[profile?]
	dev-haskell/pretty-hex:=[profile?]
	>=dev-lang/ghc-9.0.2:=
"
DEPEND="${RDEPEND}
	>=dev-haskell/cabal-3.4.1.0
"

src_prepare() {
	if use executable; then
		export CABAL_CHBINS=(
			'dump_nl80211' "haskell-${PN}-dump_nl80211"
			'genlinfo' "haskell-${PN}-genlinfo"
			'dump_rtnetlink' "haskell-${PN}-dump_rtnetlink"
		)
	fi

	haskell-cabal_src_prepare
}

src_configure() {
	haskell-cabal_src_configure \
		$(cabal_flag executable executable) \
		--flag=-generators
}