Use https by default
[gentoo.git] / sci-mathematics / agda / agda-2.4.2.2-r1.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.4.9999
8
9 CABAL_FEATURES="bin lib profile haddock hoogle hscolour"
10 inherit haskell-cabal elisp-common
11
12 MY_PN="Agda"
13 MY_P="${MY_PN}-${PV}"
14
15 DESCRIPTION="A dependently typed functional programming language and proof assistant"
16 HOMEPAGE="http://wiki.portal.chalmers.se/agda/"
17 SRC_URI="mirror://hackage/packages/archive/${MY_PN}/${PV}/${MY_P}.tar.gz"
18
19 LICENSE="MIT"
20 SLOT="0/${PV}"
21 KEYWORDS="~amd64 ~x86"
22 IUSE="+cpphs epic +stdlib"
23
24 RDEPEND=">=dev-haskell/binary-0.6:=[profile?] <dev-haskell/binary-0.8:=[profile?]
25         >=dev-haskell/boxes-0.1.3:=[profile?] <dev-haskell/boxes-0.2:=[profile?]
26         ~dev-haskell/data-hash-0.2.0.0:=[profile?]
27         >=dev-haskell/equivalence-0.2.5:=[profile?] <dev-haskell/equivalence-0.3:=[profile?]
28         >=dev-haskell/geniplate-0.6.0.3:=[profile?] <dev-haskell/geniplate-0.7:=[profile?]
29         >=dev-haskell/hashtables-1.0:=[profile?] <dev-haskell/hashtables-1.3:=[profile?]
30         >=dev-haskell/haskeline-0.7:=[profile?] <dev-haskell/haskeline-0.8:=[profile?]
31         >=dev-haskell/haskell-src-exts-1.9.6:=[profile?] <dev-haskell/haskell-src-exts-1.17:=[profile?]
32         <dev-haskell/parallel-3.3:=[profile?]
33         >=dev-haskell/quickcheck-2.7.5:2=[profile?] <dev-haskell/quickcheck-2.8:2=[profile?]
34         >=dev-haskell/stmonadtrans-0.3.2:=[profile?] <dev-haskell/stmonadtrans-0.4:=[profile?]
35         >=dev-haskell/strict-0.3.2:=[profile?] <dev-haskell/strict-0.4:=[profile?]
36         >=dev-haskell/text-0.11:=[profile?] <dev-haskell/text-1.3:=[profile?]
37         >=dev-haskell/unordered-containers-0.2:=[profile?] <dev-haskell/unordered-containers-0.3:=[profile?]
38         >=dev-haskell/xhtml-3000.2:=[profile?] <dev-haskell/xhtml-3000.3:=[profile?]
39         >=dev-haskell/zlib-0.4.0.1:=[profile?] <dev-haskell/zlib-0.6:=[profile?]
40         >=dev-lang/ghc-7.4.1:=
41         || ( ( >=dev-haskell/hashable-1.1.2.3:=[profile?] <dev-haskell/hashable-1.2:=[profile?] )
42                 ( >=dev-haskell/hashable-1.2.1.0:=[profile?] <dev-haskell/hashable-1.3:=[profile?] ) )
43         || ( ( >=dev-haskell/mtl-2.1.1:=[profile?] <=dev-haskell/mtl-2.1.3.1:=[profile?] )
44                 ( >=dev-haskell/mtl-2.2.1:=[profile?] <dev-haskell/mtl-2.3:=[profile?] ) )
45         || ( ( >=dev-haskell/transformers-0.3:=[profile?] <dev-haskell/transformers-0.4:=[profile?] )
46                 ( >=dev-haskell/transformers-0.4.1.0:=[profile?] <dev-haskell/transformers-0.5:=[profile?] ) )
47         epic? ( >=dev-lang/epic-0.1.13:=[profile?] <dev-lang/epic-0.10:=[profile?] )
48 "
49 RDEPEND+="
50                 app-emacs/haskell-mode
51                 virtual/emacs
52 "
53 PDEPEND="stdlib? ( sci-mathematics/agda-stdlib )"
54 DEPEND="${RDEPEND}
55         dev-haskell/alex
56         >=dev-haskell/cabal-1.8
57         dev-haskell/happy
58         cpphs? ( dev-haskell/cpphs )
59 "
60
61 SITEFILE="50${PN}2-gentoo.el"
62 S="${WORKDIR}/${MY_P}"
63
64 src_prepare() {
65         cabal_chdeps \
66                 'hashtables >= 1.0 && < 1.2' 'hashtables >= 1.0 && < 1.3' \
67                 'cpphs >= 1.18.6 && < 1.19' 'cpphs >= 1.18.6 && < 1.20'
68
69         sed -e '/.*emacs-mode.*$/d' \
70                 -i "${S}/${MY_PN}.cabal" \
71                 || die "Could not remove agda-mode from ${MY_PN}.cabal"
72
73         if use epic && use stdlib; then
74                 ewarn "Note that the agda-stdlib README:"
75                 ewarn "http://www.cse.chalmers.se/~nad/listings/lib/README.html"
76                 ewarn 'says: "Currently the library does not support the Epic or JavaScript compiler'
77                 ewarn 'backends." Hence you may wish to remove the epic use flag if you wish to use'
78                 ewarn "the Agda standard library."
79         fi
80         sed -e 's@-Werror@@g' \
81                 -i "${S}/${MY_PN}.cabal" \
82                 || die "sed to remove -Werror failed"
83         sed -e '/, "-Werror"/d' \
84                 -i "${S}/src/full/Agda/Compiler/MAlonzo/Compiler.hs" \
85                 || die "sed to remove -Werror from Compiler.hs failed"
86 }
87
88 src_configure() {
89         haskell-cabal_src_configure \
90                 $(cabal_flag cpphs cpphs) \
91                 $(cabal_flag epic epic)
92 }
93
94 src_compile() {
95         BYTECOMPFLAGS="-L ./src/data/emacs-mode"
96         elisp-compile src/data/emacs-mode/*.el \
97                 || die "Failed to compile emacs mode"
98         haskell-cabal_src_compile
99 }
100
101 src_install() {
102         local add="${ED}"/usr/share/"${P}/ghc-$(ghc-version)"
103
104         haskell-cabal_src_install
105
106         # generate Primitive.agdai, emulate Setup.hs postinst phase
107         Agda_datadir="${add}" \
108                 "${ED}"/usr/bin/agda "${add}"/lib/prim/Agda/Primitive.agda
109
110         rm "${ED}"/usr/bin/agda-mode || die
111         # lives in sci-mathematics/agda-executable
112         rm "${ED}"/usr/bin/agda || die
113
114         elisp-install ${PN} src/data/emacs-mode/*.el \
115                 || die "Failed to install emacs mode"
116         elisp-site-file-install "${FILESDIR}/${SITEFILE}" \
117                 || die "Failed to install elisp site file"
118 }
119
120 pkg_postinst() {
121         ghc-package_pkg_postinst
122         elisp-site-regen
123 }
124
125 pkg_postrm() {
126         ghc-package_pkg_prerm
127         elisp-site-regen
128 }