f6f2d94710e4f9eec2517b61c05dced594573167
[gentoo.git] / dev-haskell / haddock / haddock-2.16.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 # ebuild generated by hackport 0.4.4.9999
7
8 CABAL_FEATURES="bin test-suite"
9 CABAL_FEATURES+=" nocabaldep"
10 inherit haskell-cabal pax-utils
11
12 DESCRIPTION="A documentation-generation tool for Haskell libraries"
13 HOMEPAGE="http://www.haskell.org/haddock/"
14 SRC_URI="https://hackage.haskell.org/package/${P}/${P}.tar.gz"
15
16 LICENSE="BSD"
17 SLOT="0"
18 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
19 IUSE=""
20
21 RESTRICT=test # tests are outdated
22
23 RDEPEND=""
24 DEPEND="${RDEPEND}
25         >=dev-haskell/cabal-1.10
26         >=dev-lang/ghc-7.4.1
27         ~dev-haskell/haddock-api-2.16.1
28 "
29
30 src_prepare() {
31         if [[ ! -e "${S}/html" ]]; then
32                 ln -s resources/html "${S}/html" || die "Could not create symbolic link ${S}/html"
33         fi
34 }
35
36 src_configure() {
37         # create a fake haddock executable. it'll set the right version to cabal
38         # configure, but will eventually get overwritten in src_compile by
39         # the real executable.
40         local exe="${S}/dist/build/haddock/haddock"
41         mkdir -p $(dirname "${exe}")
42         echo -e "#!/bin/sh\necho Haddock version ${PV}" > "${exe}"
43         chmod +x "${exe}"
44
45         # we use 'nocabaldep' to use ghc's bundled Cabal
46         # as external one is likely to break our haddock
47         # (known to work on 1.16.0 and breaks on 1.16.0.1!)
48         haskell-cabal_src_configure \
49                 --flags=-in-ghc-tree \
50                 --ghc-options=-rtsopts \
51                 --with-haddock="${exe}" \
52                 --constraint="Cabal == $(cabal-version)"
53
54 }
55
56 src_compile() {
57         # when building the (recursive..) haddock docs, change the datadir to the
58         # current directory, as we're using haddock inplace even if it's built to be
59         # installed into the system first.
60         haddock_datadir="${S}" haskell-cabal_src_compile
61         pax-mark -m "${S}/dist/build/haddock"
62 }
63
64 src_install() {
65         cabal_src_install
66         # haddock uses GHC-api to process TH source.
67         # TH requires GHCi which needs mmap('rwx') (bug #299709)
68         pax-mark -m "${D}/usr/bin/${PN}"
69 }