/[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.3 Revision 1.10
1# Copyright 1999-2005 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.3 2006/02/16 12:32:53 dcoutts Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.10 2007/03/13 12:02:04 kosmikus 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
41 44
42 45
43for feature in ${CABAL_FEATURES}; do 46for feature in ${CABAL_FEATURES}; do
124cabal-configure() { 127cabal-configure() {
125 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then 128 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
126 cabalconf="${cabalconf} --enable-executable-profiling"; 129 cabalconf="${cabalconf} --enable-executable-profiling";
127 cabalconf="${cabalconf} --enable-library-profiling" 130 cabalconf="${cabalconf} --enable-library-profiling"
128 fi 131 fi
132 # Building GHCi libs on ppc64 causes "TOC overflow".
133 if use ppc64; then
134 cabalconf="${cabalconf} --disable-library-for-ghci"
135 fi
129 136
130 ./setup configure \ 137 ./setup configure \
131 --ghc --prefix=/usr \ 138 --ghc --prefix=/usr \
132 --with-compiler="$(ghc-getghc)" \ 139 --with-compiler="$(ghc-getghc)" \
133 --with-hc-pkg="$(ghc-getghcpkg)" \ 140 --with-hc-pkg="$(ghc-getghcpkg)" \
134 ${cabalconf} \ 141 ${cabalconf} \
142 ${CABAL_CONFIGURE_FLAGS} \
135 "$@" || die "setup configure failed" 143 "$@" || die "setup configure failed"
136} 144}
137 145
138cabal-build() { 146cabal-build() {
139 ./setup build \ 147 ./setup build \
156 chmod +x "${D}/usr/bin/"* 164 chmod +x "${D}/usr/bin/"*
157 fi 165 fi
158} 166}
159 167
160cabal-pkg() { 168cabal-pkg() {
161 # This does not actually register since we're using /usr/bin/true instead 169 # This does not actually register since we're using true instead
162 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can 170 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can
163 # register that ourselves (if it exists). 171 # register that ourselves (if it exists).
164 local result 172 local result
165 local err 173 local err
166 174
167 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config 175 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
168 result="$(./setup register 2>&1)" 176 sed -i "s|$(ghc-getghcpkg)|$(type -P true)|" .setup-config
169 err="$?" 177 ./setup register || die "setup register failed"
170 if ! echo ${result} | grep -q "no library to register"; then
171 $(exit "${err}") || die "setup register failed"
172 fi
173 if [[ -f .installed-pkg-config ]]; then 178 if [[ -f .installed-pkg-config ]]; then
174 ghc-setup-pkg .installed-pkg-config 179 ghc-setup-pkg .installed-pkg-config
175 ghc-install-pkg 180 ghc-install-pkg
181 else
182 die "setup register has not generated a package configuration file"
183 fi
176 fi 184 fi
177} 185}
178 186
179# exported function: check if cabal is correctly installed for 187# exported function: check if cabal is correctly installed for
180# the currently active ghc (we cannot guarantee this with portage) 188# the currently active ghc (we cannot guarantee this with portage)
181haskell-cabal_pkg_setup() { 189haskell-cabal_pkg_setup() {
190 ghc-package_pkg_setup
182 if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "1.1.3"; then 191 if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "1.1.3"; then
183 eerror "The package dev-haskell/cabal is not correctly installed for" 192 eerror "The package dev-haskell/cabal is not correctly installed for"
184 eerror "the currently active version of ghc ($(ghc-version)). Please" 193 eerror "the currently active version of ghc ($(ghc-version)). Please"
185 eerror "run ghc-updater or re-emerge dev-haskell/cabal." 194 eerror "run ghc-updater or re-emerge dev-haskell/cabal."
186 die "cabal is not correctly installed" 195 die "cabal is not correctly installed"
187 fi 196 fi
197 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
198 eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
199 fi
188 if [[ -n "${CABAL_UNKNOWN}" ]]; then 200 if [[ -n "${CABAL_UNKNOWN}" ]]; then
189 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}" 201 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}"
190 fi 202 fi
191} 203}
192 204
208cabal_src_install() { 220cabal_src_install() {
209 cabal-copy 221 cabal-copy
210 cabal-pkg 222 cabal-pkg
211 223
212 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 224 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
213 dohtml dist/doc/html/* 225 dohtml -r dist/doc/html/*
214 fi 226 fi
215} 227}
216haskell-cabal_src_install() { 228haskell-cabal_src_install() {
217 cabal_src_install 229 cabal_src_install
218} 230}

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20