summaryrefslogtreecommitdiff
blob: 856034e1146d845a96999f1941e6061f4ddb8959 (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
84
85
86
87
88
89
90
91
92
93
94
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-haskell/haddock/haddock-0.7.ebuild,v 1.11 2006/03/27 15:28:14 dcoutts Exp $
#
# USE variable summary:
#   doc    - Build extra documenation from DocBook sources,
#               in HTML format.
#   java   - Build the above docs as PostScript as well.


inherit ghc-package multilib
IUSE="doc"
#java use flag disable, bug #107019

DESCRIPTION="A documentation tool for Haskell"
SRC_URI="http://www.haskell.org/haddock/${P}-src.tar.gz"
HOMEPAGE="http://www.haskell.org/haddock"

SLOT="0"
KEYWORDS="~alpha amd64 ~hppa ~ia64 ppc ~ppc64 sparc x86"
LICENSE="as-is"

DEPEND="virtual/ghc
	doc? (  ~app-text/docbook-xml-dtd-4.2
		app-text/docbook-xsl-stylesheets
		>=dev-libs/libxslt-1.1.2
		>=dev-haskell/haddock-0.6-r2 )"
#		java? ( >=dev-java/fop-0.20.5 ) )"
RDEPEND=""

pkg_setup() {
	if ! has_version virtual/ghc; then
		eerror "Due to a bug in the portage dependency resolution, emerge"
		eerror "sometimes tries to merge haddock before a version of ghc"
		eerror "is available on the system. This is usually triggered when"
		eerror "you try to bootstrap ghc on a system with USE=\"doc\" using"
		eerror "the command"
		eerror
		eerror "   emerge ghc"
		eerror
		eerror "To resolve this problem, proceed in two steps. First, emerge"
		eerror "haddock (which should first pull in ghc-bin). Second, emerge"
		eerror "ghc again:"
		eerror
		eerror "   emerge haddock"
		eerror "   emerge ghc"
		die "portage dependency problem"
	fi
}

src_compile() {
	local myconf
	local mydoc

	# initialize build.mk
	echo '# Gentoo changes' > mk/build.mk
	# determine what to do with documentation
	if use doc; then
		mydoc="html"
		#if use java; then
		#	mydoc="${mydoc} ps"
		#fi
	else
		mydoc=""
		# needed to prevent haddock from being called
		echo NO_HADDOCK_DOCS=YES >> mk/build.mk
	fi
	echo XMLDocWays="${mydoc}" >> mk/build.mk

	econf || die "econf failed"

	# using -j1 because -j2 behaved strangely on my machine
	emake -j1 || die "make failed"
}

src_install() {
	local insttarget

	insttarget="install"
	use doc && insttarget="${insttarget} install-docs"

	# the libdir0 setting is needed for amd64, and does not
	# harm for other arches
	emake -j1 ${insttarget} \
		prefix="${D}/usr" \
		datadir="${D}/usr/share/${P}" \
		infodir="${D}/usr/share/info" \
		mandir="${D}/usr/share/man" \
		libdir0="${D}/usr/$(get_libdir)" \
		|| die "make install failed"

	cd ${S}/haddock
	dodoc CHANGES LICENSE README TODO
}