/[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 Revision 1.5
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 2005/09/13 12:53:34 kosmikus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.5 2006/03/01 12:54:35 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#
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}".
45 happy) CABAL_USE_HAPPY=yes;; 47 happy) CABAL_USE_HAPPY=yes;;
46 c2hs) CABAL_USE_C2HS=yes;; 48 c2hs) CABAL_USE_C2HS=yes;;
47 cpphs) CABAL_USE_CPPHS=yes;; 49 cpphs) CABAL_USE_CPPHS=yes;;
48 profile) CABAL_USE_PROFILE=yes;; 50 profile) CABAL_USE_PROFILE=yes;;
49 bootstrap) CABAL_BOOTSTRAP=yes;; 51 bootstrap) CABAL_BOOTSTRAP=yes;;
50 *) ewarn "Unknown entry in CABAL_FEATURES: ${feature}";; 52 bin) CABAL_HAS_BINARIES=yes;;
53 lib) CABAL_HAS_LIBRARIES=yes;;
54 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
51 esac 55 esac
52done 56done
53 57
54if [[ -n "${CABAL_USE_HADDOCK}" ]]; then 58if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
55 IUSE="${IUSE} doc" 59 IUSE="${IUSE} doc"
85# with GHC. But of course we can't depend on cabal when building cabal itself. 89# with GHC. But of course we can't depend on cabal when building cabal itself.
86if [[ -z "${CABAL_BOOTSTRAP}" ]]; then 90if [[ -z "${CABAL_BOOTSTRAP}" ]]; then
87 DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3" 91 DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3"
88fi 92fi
89 93
94# Libraries require GHC to be installed.
95if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
96 RDEPEND="${RDEPEND} virtual/ghc"
97fi
90 98
91cabal-bootstrap() { 99cabal-bootstrap() {
92 local setupmodule 100 local setupmodule
93 local cabalversion 101 local cabalversion
94 if [[ -f "${S}/Setup.lhs" ]]; then 102 if [[ -f "${S}/Setup.lhs" ]]; then
113 ./setup haddock || die "setup haddock failed" 121 ./setup haddock || die "setup haddock failed"
114} 122}
115 123
116cabal-configure() { 124cabal-configure() {
117 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then 125 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
118 cabalconf="${cabalconf} --enable-executable-profiling" 126 cabalconf="${cabalconf} --enable-executable-profiling";
127 cabalconf="${cabalconf} --enable-library-profiling"
128 fi
129 # Don't build GHCi libs for arches that do not support GHCi.
130 # Also building GHCi libs on ppc64 causes "TOC overflow".
131 if use alpha || use ppc64; then
132 cabalconf="${cabalconf} --disable-library-for-ghci"
119 fi 133 fi
120 134
121 ./setup configure \ 135 ./setup configure \
122 --ghc --prefix=/usr \ 136 --ghc --prefix=/usr \
123 --with-compiler="$(ghc-getghc)" \ 137 --with-compiler="$(ghc-getghc)" \
150 164
151cabal-pkg() { 165cabal-pkg() {
152 # This does not actually register since we're using /usr/bin/true instead 166 # 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 167 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can
154 # register that ourselves (if it exists). 168 # register that ourselves (if it exists).
169 local result
170 local err
171
172 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
155 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config 173 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config
156 ./setup register || die "setup register failed" 174 ./setup register || die "setup register failed"
157 if [[ -f .installed-pkg-config ]]; then 175 if [[ -f .installed-pkg-config ]]; then
158 ghc-setup-pkg .installed-pkg-config 176 ghc-setup-pkg .installed-pkg-config
159 ghc-install-pkg 177 ghc-install-pkg
178 else
179 die "setup register has not generated a package configuration file"
180 fi
160 fi 181 fi
161} 182}
162 183
163# exported function: check if cabal is correctly installed for 184# exported function: check if cabal is correctly installed for
164# the currently active ghc (we cannot guarantee this with portage) 185# the currently active ghc (we cannot guarantee this with portage)
167 eerror "The package dev-haskell/cabal is not correctly installed for" 188 eerror "The package dev-haskell/cabal is not correctly installed for"
168 eerror "the currently active version of ghc ($(ghc-version)). Please" 189 eerror "the currently active version of ghc ($(ghc-version)). Please"
169 eerror "run ghc-updater or re-emerge dev-haskell/cabal." 190 eerror "run ghc-updater or re-emerge dev-haskell/cabal."
170 die "cabal is not correctly installed" 191 die "cabal is not correctly installed"
171 fi 192 fi
193 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
194 eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
195 fi
196 if [[ -n "${CABAL_UNKNOWN}" ]]; then
197 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}"
198 fi
172} 199}
173 200
174# exported function: cabal-style bootstrap configure and compile 201# exported function: cabal-style bootstrap configure and compile
175cabal_src_compile() { 202cabal_src_compile() {
176 cabal-bootstrap 203 cabal-bootstrap

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

  ViewVC Help
Powered by ViewVC 1.1.20