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