*/*: [QA] Remove redundant `|| die` guards
[gentoo.git] / dev-haskell / alex / alex-3.2.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 # ebuild generated by hackport 0.5.9999
7 #hackport: flags: +small_base
8
9 CABAL_FEATURES="test-suite"
10 inherit autotools haskell-cabal
11
12 DESCRIPTION="Alex is a tool for generating lexical analysers in Haskell"
13 HOMEPAGE="http://www.haskell.org/alex/"
14 SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
15
16 LICENSE="BSD"
17 SLOT="0"
18 KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~ppc64 ~sparc ~x86"
19 IUSE="doc"
20
21 RDEPEND=">=dev-haskell/quickcheck-2:2=
22         >=dev-lang/ghc-7.4.1:=
23 "
24 DEPEND="${RDEPEND}
25         >=dev-haskell/cabal-1.8
26         doc? ( ~app-text/docbook-xml-dtd-4.2
27                 app-text/docbook-xsl-stylesheets
28                 >=dev-libs/libxslt-1.1.2 )
29 "
30
31 RESTRICT=test # fails tests
32
33 src_prepare() {
34         default
35
36         # drop depend on itself and happy, otherwise cabal tries to regenerate it
37         rm src/{Scan.x,Parser.y} || die
38
39         for f in Scan Parser; do
40                 mv "${S}/dist/build/alex/alex-tmp/$f.hs" "${S}"/src/ || die
41         done
42
43         if use doc; then
44                 cd "${S}/doc/"
45                 eautoreconf
46         fi
47 }
48
49 src_configure() {
50         # make sure we don't accidentally use those
51         # installed in system
52         haskell-cabal_src_configure \
53                 --with-alex=false \
54                 --with-happy=false \
55                 --flag=small_base
56
57         if use doc; then
58                 cd "${S}/doc/"
59                 econf
60         fi
61 }
62
63 src_compile() {
64         haskell-cabal_src_compile
65
66         if use doc; then
67                 emake -C "${S}/doc/" -j1
68         fi
69 }
70
71 src_test() {
72         # workaround https://github.com/haskell/cabal/issues/2398
73         emake -k -C tests all
74 }
75
76 src_install() {
77         haskell-cabal_src_install
78
79         if use doc; then
80                 doman "${S}/doc/alex.1"
81                 dohtml -r "${S}/doc/alex/"
82         fi
83 }