*/*: Specify EAPI=0 explicitly, to ease greps
[gentoo.git] / dev-lang / helium / helium-1.6.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=0
5
6 inherit autotools eutils
7
8 DESCRIPTION="Helium (for learning Haskell)"
9 HOMEPAGE="http://www.cs.uu.nl/helium"
10 SRC_URI="http://www.cs.uu.nl/helium/distr/${P}-src.tar.gz
11         mirror://gentoo/${P}-ghc.patch.bz2"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 # compilation breaks on amd64, suspect lvm doesn't work properly
16 KEYWORDS="-amd64 ~x86"
17 IUSE="readline"
18
19 DEPEND=">=dev-lang/ghc-6.8
20         dev-haskell/mtl
21         dev-haskell/parsec
22         readline? ( dev-haskell/readline )"
23 RDEPEND="dev-libs/gmp
24         readline? ( sys-libs/readline )"
25
26 src_unpack() {
27         unpack ${A}
28         epatch "${P}-ghc.patch"
29         epatch "${FILESDIR}/helium-1.6-respect-cflags-ldflags-nostrip.patch"
30
31         # split base only
32         sed -e 's/^GHCFLAGS =.*$/& -package containers/' \
33             -i "${S}/helium/src/Makefile.in"
34
35         # file has non-ASCII syms and it's pulled to ghc for dependency generaton
36         # ghc w/UTF-8 dislikes it:
37         sed -e 's/\xCA//g' \
38             -i "${S}/helium/src/Makefile.in"
39
40         # mangle evil 'rec' to 'rec_'. It's not very accurate, but less,
41         # than manually patching ~250 occurences. (ghc-6.10+ has rec as reserved word)
42         local bad_file
43
44         for bad_file in Top/src/Top/Types/Unification.hs \
45                         Top/src/Top/Types/Quantification.hs \
46                         Top/src/Top/Types/Primitive.hs \
47                         Top/src/Top/Solver/PartitionCombinator.hs \
48                         Top/src/Top/Repair/Repair.hs \
49                         Top/src/Top/Ordering/Tree.hs \
50                         Top/src/Top/Implementation/TypeGraph/Standard.hs \
51                         Top/src/Top/Implementation/TypeGraph/Path.hs \
52                         Top/src/Top/Implementation/TypeGraph/EquivalenceGroup.hs \
53                         Top/src/Top/Implementation/TypeGraph/Basics.hs \
54                         Top/src/Top/Implementation/TypeGraph/ApplyHeuristics.hs \
55                         lvm/src/lib/lvm/LvmRead.hs \
56                         lvm/src/lib/core/CoreNoShadow.hs \
57                         helium/src/utils/LoggerEnabled.hs \
58                         helium/src/staticanalysis/miscellaneous/TypesToAlignedDocs.hs \
59                         helium/src/staticanalysis/miscellaneous/TypeConversion.hs \
60                         helium/src/staticanalysis/inferencers/TypeInferencing.hs \
61                         helium/src/staticanalysis/heuristics/RepairSystem.hs \
62                         helium/src/staticanalysis/heuristics/RepairHeuristics.hs \
63                         helium/src/staticanalysis/heuristics/ListOfHeuristics.hs \
64                         helium/src/staticanalysis/directives/TS_PatternMatching.ag
65         do
66                 # take all symbols from exactly this source. This set is not universal,
67                 # but it aims to catch (same) lexeme separators on the left and on the right
68                 sed -e 's/\([^a-zA-Z_0-9"]\|^\)rec\([^a-zA-Z_0-9"]\|$\)/\1rec_\2/g' \
69             -i "${S}/$bad_file"
70         done
71
72         # cabal is their friend (oneOf became polymorphic and breaks the test)
73         sed -e 's/Text.ParserCombinators.Parsec/&.Pos/g' \
74             -e 's/oneOf/newPos/g' \
75             -i "${S}/helium/configure.in"
76
77         cd "${S}/helium"
78         eautoreconf
79 }
80
81 src_compile() {
82         # helium consists of two components that have to be set up separately,
83         # lvm and the main compiler. both build systems are slightly strange.
84         # lvm uses a completely non-standard build system:
85         # the ./configure of lvm is not the usual autotools configure
86
87         cd "${S}/lvm/src" && ./configure || die "lvm configure failed"
88         echo "STRIP=echo" >> config/makefile || die "lvm postconfigure failed"
89         myconf="$(use_enable readline) --without-strip --without-upx --without-ag"
90         cd "${S}/helium" && econf --prefix="/usr/lib" ${myconf} || die "econf failed"
91         cd "${S}/helium/src" && make depend || die "make depend failed"
92
93         emake -j1 || die "make failed"
94 }
95
96 src_install() {
97         cd helium/src || die "cannot cd to helium/src"
98         make install bindir="/usr/lib/helium/bin" DESTDIR="${D}" || die "make install failed"
99
100         # create wrappers
101         newbin "${FILESDIR}/helium-wrapper-${PV}" helium-wrapper
102
103         dosym /usr/bin/helium-wrapper /usr/bin/texthint
104         dosym /usr/bin/helium-wrapper /usr/bin/helium
105         dosym /usr/bin/helium-wrapper /usr/bin/lvmrun
106 }