/[gentoo-x86]/eclass/haskell-cabal.eclass
Gentoo

Diff of /eclass/haskell-cabal.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.5 Revision 1.11
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.5 2006/03/01 12:54:35 dcoutts Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.11 2007/07/25 18:07:02 dcoutts Exp $
4# 4#
5# Original authors: Andres Loeh <kosmikus@gentoo.org> 5# Original authors: Andres Loeh <kosmikus@gentoo.org>
6# Duncan Coutts <dcoutts@gentoo.org> 6# Duncan Coutts <dcoutts@gentoo.org>
7# Maintained by: Haskell herd <haskell@gentoo.org> 7# Maintained by: Haskell herd <haskell@gentoo.org>
8# 8#
34# 34#
35# Many Cabal packages require S to be manually set. 35# Many Cabal packages require S to be manually set.
36# 36#
37# Conforming Cabal packages don't require any function definitions 37# Conforming Cabal packages don't require any function definitions
38# in the ebuild. 38# in the ebuild.
39#
40# Special flags to Cabal Configure can now be set by using
41# CABAL_CONFIGURE_FLAGS
39 42
40inherit ghc-package 43inherit ghc-package multilib
41 44
42 45
43for feature in ${CABAL_FEATURES}; do 46for feature in ${CABAL_FEATURES}; do
44 case ${feature} in 47 case ${feature} in
45 haddock) CABAL_USE_HADDOCK=yes;; 48 haddock) CABAL_USE_HADDOCK=yes;;
85 IUSE="${IUSE} profile" 88 IUSE="${IUSE} profile"
86fi 89fi
87 90
88# We always use a standalone version of Cabal, rather than the one that comes 91# We always use a standalone version of Cabal, rather than the one that comes
89# with GHC. But of course we can't depend on cabal when building cabal itself. 92# with GHC. But of course we can't depend on cabal when building cabal itself.
93CABAL_MIN_VERSION=1.1.4
90if [[ -z "${CABAL_BOOTSTRAP}" ]]; then 94if [[ -z "${CABAL_BOOTSTRAP}" ]]; then
91 DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3" 95 DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
92fi 96fi
93 97
94# Libraries require GHC to be installed. 98# Libraries require GHC to be installed.
95if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then 99if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
96 RDEPEND="${RDEPEND} virtual/ghc" 100 RDEPEND="${RDEPEND} dev-lang/ghc"
97fi 101fi
98 102
99cabal-bootstrap() { 103cabal-bootstrap() {
100 local setupmodule 104 local setupmodule
101 local cabalversion 105 local cabalversion
124cabal-configure() { 128cabal-configure() {
125 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then 129 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
126 cabalconf="${cabalconf} --enable-executable-profiling"; 130 cabalconf="${cabalconf} --enable-executable-profiling";
127 cabalconf="${cabalconf} --enable-library-profiling" 131 cabalconf="${cabalconf} --enable-library-profiling"
128 fi 132 fi
129 # Don't build GHCi libs for arches that do not support GHCi.
130 # Also building GHCi libs on ppc64 causes "TOC overflow". 133 # Building GHCi libs on ppc64 causes "TOC overflow".
131 if use alpha || use ppc64; then 134 if use ppc64; then
132 cabalconf="${cabalconf} --disable-library-for-ghci" 135 cabalconf="${cabalconf} --disable-library-for-ghci"
133 fi 136 fi
137
138 # Note: with Cabal-1.1.6.x we still do not have enough control
139 # to put the docs into the right place. They're currently going
140 # into /usr/share/${P}/ghc-x.y/doc/
141 # rather than /usr/share/doc/${PF}/
142 # Because we can only set the datadir, not the docdir.
134 143
135 ./setup configure \ 144 ./setup configure \
136 --ghc --prefix=/usr \ 145 --ghc --prefix=/usr \
137 --with-compiler="$(ghc-getghc)" \ 146 --with-compiler="$(ghc-getghc)" \
138 --with-hc-pkg="$(ghc-getghcpkg)" \ 147 --with-hc-pkg="$(ghc-getghcpkg)" \
148 --prefix=/usr \
149 --libdir=/usr/$(get_libdir) \
150 --libsubdir=${P}/ghc-$(ghc-version) \
151 --datadir=/usr/share/ \
152 --datasubdir=${P}/ghc-$(ghc-version) \
139 ${cabalconf} \ 153 ${cabalconf} \
154 ${CABAL_CONFIGURE_FLAGS} \
140 "$@" || die "setup configure failed" 155 "$@" || die "setup configure failed"
141} 156}
142 157
143cabal-build() { 158cabal-build() {
144 ./setup build \ 159 ./setup build \
145 || die "setup build failed" 160 || die "setup build failed"
146} 161}
147 162
148cabal-copy() { 163cabal-copy() {
149 ./setup copy \ 164 ./setup copy \
150 --copy-prefix="${D}/usr" \ 165 --destdir="${D}" \
151 || die "setup copy failed" 166 || die "setup copy failed"
152 167
153 # cabal is a bit eager about creating dirs, 168 # cabal is a bit eager about creating dirs,
154 # so remove them if they are empty 169 # so remove them if they are empty
155 rmdir "${D}/usr/bin" 2> /dev/null 170 rmdir "${D}/usr/bin" 2> /dev/null
158 # no workaround. 173 # no workaround.
159 # set the +x permission on executables 174 # set the +x permission on executables
160 if [[ -d "${D}/usr/bin" ]] ; then 175 if [[ -d "${D}/usr/bin" ]] ; then
161 chmod +x "${D}/usr/bin/"* 176 chmod +x "${D}/usr/bin/"*
162 fi 177 fi
178 # TODO: do we still need this?
163} 179}
164 180
165cabal-pkg() { 181cabal-pkg() {
166 # This does not actually register since we're using /usr/bin/true instead 182 # This does not actually register since we're using true instead
167 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can 183 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can
168 # register that ourselves (if it exists). 184 # register that ourselves (if it exists).
169 local result 185 local result
170 local err 186 local err
171 187
172 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then 188 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
173 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config 189 sed -i "s|$(ghc-getghcpkg)|$(which true)|" .setup-config
174 ./setup register || die "setup register failed" 190 ./setup register || die "setup register failed"
175 if [[ -f .installed-pkg-config ]]; then 191 if [[ -f .installed-pkg-config ]]; then
176 ghc-setup-pkg .installed-pkg-config 192 ghc-setup-pkg .installed-pkg-config
177 ghc-install-pkg 193 ghc-install-pkg
178 else 194 else
182} 198}
183 199
184# exported function: check if cabal is correctly installed for 200# exported function: check if cabal is correctly installed for
185# the currently active ghc (we cannot guarantee this with portage) 201# the currently active ghc (we cannot guarantee this with portage)
186haskell-cabal_pkg_setup() { 202haskell-cabal_pkg_setup() {
203 ghc-package_pkg_setup
187 if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "1.1.3"; then 204 if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
188 eerror "The package dev-haskell/cabal is not correctly installed for" 205 eerror "The package dev-haskell/cabal is not correctly installed for"
189 eerror "the currently active version of ghc ($(ghc-version)). Please" 206 eerror "the currently active version of ghc ($(ghc-version)). Please"
190 eerror "run ghc-updater or re-emerge dev-haskell/cabal." 207 eerror "run ghc-updater or re-emerge dev-haskell/cabal."
191 die "cabal is not correctly installed" 208 die "cabal is not correctly installed"
192 fi 209 fi
216cabal_src_install() { 233cabal_src_install() {
217 cabal-copy 234 cabal-copy
218 cabal-pkg 235 cabal-pkg
219 236
220 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 237 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
238 local cabalversion=$(ghc-extractportageversion dev-haskell/cabal)
239 if ! version_is_at_least "1.1.6" "${cabalversion}"; then
221 dohtml dist/doc/html/* 240 dohtml -r dist/doc/html/*
241 fi
222 fi 242 fi
223} 243}
224haskell-cabal_src_install() { 244haskell-cabal_src_install() {
225 cabal_src_install 245 cabal_src_install
226} 246}

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20