/[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.1.1.1 Revision 1.8
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.1.1.1 2005/11/30 09:59:22 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.8 2006/10/04 17:49:20 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#
22# happy -- parser generator 22# happy -- parser generator
23# c2hs -- C interface generator 23# c2hs -- C interface generator
24# cpphs -- C preprocessor clone written in Haskell 24# cpphs -- C preprocessor clone written in Haskell
25# profile -- if package supports to build profiling-enabled libraries 25# profile -- if package supports to build profiling-enabled libraries
26# bootstrap -- only used for the cabal package itself 26# bootstrap -- only used for the cabal package itself
27# bin -- the package installs binaries
28# lib -- the package installs libraries
27# 29#
28# Dependencies on other cabal packages have to be specified 30# Dependencies on other cabal packages have to be specified
29# correctly. 31# correctly.
30# 32#
31# Cabal libraries should usually be SLOTted with "${PV}". 33# Cabal libraries should usually be SLOTted with "${PV}".
32# 34#
33# Many Cabal packages require S to be manually set. 35# Many Cabal packages require S to be manually set.
34# 36#
35# Conforming Cabal packages don't require any function definitions 37# Conforming Cabal packages don't require any function definitions
36# in the ebuild. 38# in the ebuild.
39#
40# Special flags to Cabal Configure can now be set by using
41# CABAL_CONFIGURE_FLAGS
37 42
38inherit ghc-package 43inherit ghc-package
39 44
40 45
41for feature in ${CABAL_FEATURES}; do 46for feature in ${CABAL_FEATURES}; do
45 happy) CABAL_USE_HAPPY=yes;; 50 happy) CABAL_USE_HAPPY=yes;;
46 c2hs) CABAL_USE_C2HS=yes;; 51 c2hs) CABAL_USE_C2HS=yes;;
47 cpphs) CABAL_USE_CPPHS=yes;; 52 cpphs) CABAL_USE_CPPHS=yes;;
48 profile) CABAL_USE_PROFILE=yes;; 53 profile) CABAL_USE_PROFILE=yes;;
49 bootstrap) CABAL_BOOTSTRAP=yes;; 54 bootstrap) CABAL_BOOTSTRAP=yes;;
50 *) ewarn "Unknown entry in CABAL_FEATURES: ${feature}";; 55 bin) CABAL_HAS_BINARIES=yes;;
56 lib) CABAL_HAS_LIBRARIES=yes;;
57 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
51 esac 58 esac
52done 59done
53 60
54if [[ -n "${CABAL_USE_HADDOCK}" ]]; then 61if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
55 IUSE="${IUSE} doc" 62 IUSE="${IUSE} doc"
85# 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.
86if [[ -z "${CABAL_BOOTSTRAP}" ]]; then 93if [[ -z "${CABAL_BOOTSTRAP}" ]]; then
87 DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3" 94 DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3"
88fi 95fi
89 96
97# Libraries require GHC to be installed.
98if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
99 RDEPEND="${RDEPEND} virtual/ghc"
100fi
90 101
91cabal-bootstrap() { 102cabal-bootstrap() {
92 local setupmodule 103 local setupmodule
93 local cabalversion 104 local cabalversion
94 if [[ -f "${S}/Setup.lhs" ]]; then 105 if [[ -f "${S}/Setup.lhs" ]]; then
113 ./setup haddock || die "setup haddock failed" 124 ./setup haddock || die "setup haddock failed"
114} 125}
115 126
116cabal-configure() { 127cabal-configure() {
117 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then 128 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
118 cabalconf="${cabalconf} --enable-executable-profiling" 129 cabalconf="${cabalconf} --enable-executable-profiling";
130 cabalconf="${cabalconf} --enable-library-profiling"
131 fi
132 # Building GHCi libs on ppc64 causes "TOC overflow".
133 if use ppc64; then
134 cabalconf="${cabalconf} --disable-library-for-ghci"
119 fi 135 fi
120 136
121 ./setup configure \ 137 ./setup configure \
122 --ghc --prefix=/usr \ 138 --ghc --prefix=/usr \
123 --with-compiler="$(ghc-getghc)" \ 139 --with-compiler="$(ghc-getghc)" \
124 --with-hc-pkg="$(ghc-getghcpkg)" \ 140 --with-hc-pkg="$(ghc-getghcpkg)" \
125 ${cabalconf} \ 141 ${cabalconf} \
142 ${CABAL_CONFIGURE_FLAGS} \
126 "$@" || die "setup configure failed" 143 "$@" || die "setup configure failed"
127} 144}
128 145
129cabal-build() { 146cabal-build() {
130 ./setup build \ 147 ./setup build \
150 167
151cabal-pkg() { 168cabal-pkg() {
152 # This does not actually register since we're using /usr/bin/true instead 169 # This does not actually register since we're using /usr/bin/true instead
153 # 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
154 # register that ourselves (if it exists). 171 # register that ourselves (if it exists).
172 local result
173 local err
174
175 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
155 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config 176 sed -i "s|$(ghc-getghcpkg)|/usr/bin/true|" .setup-config
156 ./setup register || die "setup register failed" 177 ./setup register || die "setup register failed"
157 if [[ -f .installed-pkg-config ]]; then 178 if [[ -f .installed-pkg-config ]]; then
158 ghc-setup-pkg .installed-pkg-config 179 ghc-setup-pkg .installed-pkg-config
159 ghc-install-pkg 180 ghc-install-pkg
181 else
182 die "setup register has not generated a package configuration file"
183 fi
160 fi 184 fi
161} 185}
162 186
163# exported function: check if cabal is correctly installed for 187# exported function: check if cabal is correctly installed for
164# the currently active ghc (we cannot guarantee this with portage) 188# the currently active ghc (we cannot guarantee this with portage)
167 eerror "The package dev-haskell/cabal is not correctly installed for" 191 eerror "The package dev-haskell/cabal is not correctly installed for"
168 eerror "the currently active version of ghc ($(ghc-version)). Please" 192 eerror "the currently active version of ghc ($(ghc-version)). Please"
169 eerror "run ghc-updater or re-emerge dev-haskell/cabal." 193 eerror "run ghc-updater or re-emerge dev-haskell/cabal."
170 die "cabal is not correctly installed" 194 die "cabal is not correctly installed"
171 fi 195 fi
196 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
197 eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
198 fi
199 if [[ -n "${CABAL_UNKNOWN}" ]]; then
200 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}"
201 fi
172} 202}
173 203
174# exported function: cabal-style bootstrap configure and compile 204# exported function: cabal-style bootstrap configure and compile
175cabal_src_compile() { 205cabal_src_compile() {
176 cabal-bootstrap 206 cabal-bootstrap
189cabal_src_install() { 219cabal_src_install() {
190 cabal-copy 220 cabal-copy
191 cabal-pkg 221 cabal-pkg
192 222
193 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 223 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
194 dohtml dist/doc/html/* 224 dohtml -r dist/doc/html/*
195 fi 225 fi
196} 226}
197haskell-cabal_src_install() { 227haskell-cabal_src_install() {
198 cabal_src_install 228 cabal_src_install
199} 229}

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20