summaryrefslogtreecommitdiff
blob: 160b89c4bdaa2c67c80346356683977304ac6466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-haskell/hmake/hmake-3.11.ebuild,v 1.12 2007/12/13 18:03:54 dcoutts Exp $

inherit base eutils fixheadtails ghc-package

DESCRIPTION="A make tool for Haskell programs"
HOMEPAGE="http://www.haskell.org/hmake/"
SRC_URI="http://www.haskell.org/hmake/${P}.tar.gz"

LICENSE="nhc98"
SLOT="0"
KEYWORDS="~amd64 ~ppc ppc64 sparc x86"
IUSE=""

DEPEND="dev-lang/ghc
		sys-libs/readline
		>=sys-apps/sandbox-1.2.12"
RDEPEND="dev-lang/ghc
		sys-libs/readline"

# sandbox dependency due to bug #97441, #101433

# if using readline, hmake depends also on ncurses; but
# readline already has this dependency

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}/${P}-ghc66.patch"

	# Fix the way hmake discovers the ghc version
	sed -i -e '/echo __GLASGOW_HASKELL__/,+2 c \
		touch ghcsym.hs; \
		$1 -E -cpp -optP-dM ghcsym.hs -o ghcsym.out; \
		grep __GLASGOW_HASKELL__ ghcsym.out | cut -d" " -f 3 > $2;' \
		"${S}/script/confhc"

	# fix all head/tail declarations
	sed -i 's/tail -1/tail  -n 1/' src/hmake/MkConfig.hs
	# the line above prevents current fixheadtails.eclass from doing nonsense;
	# double space before -n is significant
	ht_fix_all
}

src_compile() {
	# package uses non-standard configure, therefore econf does
	# not work ...
	READLINE='-package readline' ./configure \
		--prefix=/usr \
		--mandir=/usr/share/man/man1 \
		--buildwith="$(ghc-getghc)" \
		|| die "./configure failed"

	# emake tested; parallel make does not work
	emake -j1 || die "make failed"
}

src_install() {
	make DESTDIR="${D}" install || die "make install failed"
	dohtml docs/hmake/*
}