summaryrefslogtreecommitdiff
blob: 95bcf980ebb650b9dd4bce163e5d1bbf21a9439b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

# ebuild generated by hackport 0.7.3.0
#hackport: flags: build-example:examples

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

DESCRIPTION="Golden tests support for tasty"
HOMEPAGE="https://github.com/UnkindPartition/tasty-golden"

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

PATCHES=(
	"${FILESDIR}/${PN}-2.3.5-fix-tests.patch"
)

CABAL_CHDEPS=(
	'executable example' "executable ${PN}-example"
)

CABAL_TEST_REQUIRED_BINS=(
	"${PN}-example"
)

RDEPEND="
	dev-haskell/async:=[profile?]
	>=dev-haskell/optparse-applicative-0.3.1:=[profile?]
	dev-haskell/tagged:=[profile?]
	>=dev-haskell/tasty-1.3:=[profile?]
	dev-haskell/temporary:=[profile?]
	dev-haskell/typed-process:=[profile?]
	>=dev-lang/ghc-8.4.3:=
"
DEPEND="${RDEPEND}
	>=dev-haskell/cabal-2.2.0.1
	test? (
		dev-haskell/tasty-hunit
	)
"

src_configure() {
	if use examples || use test; then
		local example_flag=build-example
	else
		local example_flag=-build-example
	fi

	haskell-cabal_src_configure \
		--flag="${example_flag}"
}

src_install() {
	local components=(
		"lib:${PN}"
	)

	if use examples; then
		components+=(
			"exe:${PN}-example"
		)
	fi

	haskell-cabal_src_install "${components[@]}"
}

pkg_postinst() {
	if use examples; then
		elog "The example executable installed with this package (normally named 'example')"
		elog "has been renamed to '${PN}-example' to help prevent name collisions."
	fi

	haskell-cabal_pkg_postinst
}