Drop $Id$ per council decision in bug #611234.
[gentoo.git] / dev-haskell / alex / alex-3.1.7.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 # ebuild generated by hackport 0.4.6.9999
7 #hackport: flags: +small_base
8
9 CABAL_FEATURES="bin test-suite"
10 inherit autotools eutils 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="mirror://hackage/packages/archive/${PN}/${PV}/${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 src_prepare() {
32         # drop depend on itself and happy, otherwise cabal tries to regenerate it
33         rm src/{Scan.x,Parser.y} || die
34
35         for f in Scan Parser; do
36                 mv "${S}/dist/build/alex/alex-tmp/$f.hs" "${S}"/src/ || die
37         done
38
39         if use doc; then
40                 cd "${S}/doc/"
41                 eautoreconf
42         fi
43 }
44
45 src_configure() {
46         # make sure we don't accidentally use those
47         # installed in system
48         haskell-cabal_src_configure \
49                 --with-alex=false \
50                 --with-happy=false \
51                 --flag=small_base
52
53         if use doc; then
54                 cd "${S}/doc/"
55                 econf
56         fi
57 }
58
59 src_compile() {
60         cabal_src_compile
61
62         if use doc; then
63                 emake -C "${S}/doc/" -j1
64         fi
65 }
66
67 src_test() {
68         # workaround https://github.com/haskell/cabal/issues/2398
69         emake -k -C tests all || die
70 }
71
72 src_install() {
73         cabal_src_install
74
75         if use doc; then
76                 doman "${S}/doc/alex.1"
77                 dohtml -r "${S}/doc/alex/"
78         fi
79         dodoc README
80 }