summaryrefslogtreecommitdiff
blob: 01e2137666d6cc57a9cc5ff8b9eb7fbbb5e54e50 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-haskell/wash/wash-2.5.6.ebuild,v 1.5 2007/10/31 13:11:16 dcoutts Exp $

inherit base eutils ghc-package check-reqs autotools

# the installation bundle is called WashNGo
MY_PN="WashNGo"
MY_P="${MY_PN}-${PV}"

DESCRIPTION="WASH is a family of embedded domain-specific languages for programming Web applications"
HOMEPAGE="http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/"
SRC_URI="http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/${MY_P}.tgz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~x86 ~amd64 ~sparc"
IUSE="doc postgres"

RDEPEND=">=dev-lang/ghc-6.4.1
		postgres? ( >=dev-db/libpq-7.4.3 )"

DEPEND="${RDEPEND}
		postgres? ( >=dev-haskell/c2hs-0.14.0 )
		doc? ( dev-haskell/haddock )"

S="${WORKDIR}/${MY_P}"

pkg_setup() {
	# There are a couple Wash modules which take forever to compile and
	# cause ghc take loads of memory. We try and limit ghc's heap size
	# but it still takes a lot.
	einfo "Some Wash modules take a lot of RAM and a very long time to compile."
	einfo "Please be patient."
	# We need aproximately this much memory: (does *not* check swap)
	case "${ARCH}" in
		alpha|*64) CHECKREQS_MEMORY="400" ;;
		*)         CHECKREQS_MEMORY="200" ;;
	esac
	check_reqs
}

src_unpack() {
	base_src_unpack

	cd "${S}"
	epatch "${FILESDIR}/${P}-ghc66.patch"
}

src_compile() {
	# We've patched some build files
	eautoreconf

	./configure \
		--prefix="/usr" \
		--libdir="/usr/$(get_libdir)/${P}" \
		$(use_enable postgres dbconnect) \
		$(use_enable doc build-docs) \
		--with-hcflags="+RTS -M${CHECKREQS_MEMORY}m -RTS" \
		--enable-register-package="${S}/$(ghc-localpkgconf)" \
		|| die "configure failed"
	make all || die "make all failed"
}

src_install() {
	ghc-setup-pkg
	make prefix="${D}/usr" \
		 PACKAGELIBDIR="${D}/usr/$(get_libdir)/${P}/ghc-$(ghc-version)" \
		 install \
		|| die "make install failed"
	ghc-install-pkg

	# We really don't need the GenPKG program, it's an internal Wash thing.
	# I see no reason for it to be installed.
	rm -f "${D}/usr/bin/GenPKG"

	dodoc README
	if use doc; then
		cp -r Examples ${D}/usr/share/doc/${PF}
		cd doc
		dohtml -r *
	fi
}