/[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.2 Revision 1.6
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.2 2005/12/05 12:24:53 dcoutts Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.6 2006/03/13 09:57:10 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
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";
119 cabalconf="${cabalconf} --enable-library-profiling" 127 cabalconf="${cabalconf} --enable-library-profiling"
120 fi 128 fi
129 # Building GHCi libs on ppc64 causes "TOC overflow".
130 if use ppc64; then
131 cabalconf="${cabalconf} --disable-library-for-ghci"
132 fi
121 133
122 ./setup configure \ 134 ./setup configure \
123 --ghc --prefix=/usr \ 135 --ghc --prefix=/usr \
124 --with-compiler="$(ghc-getghc)" \ 136 --with-compiler="$(ghc-getghc)" \
125 --with-hc-pkg="$(ghc-getghcpkg)" \ 137 --with-hc-pkg="$(ghc-getghcpkg)" \
154 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can 166 # of ghc-pkg. So it just leaves the .installed-pkg-config and we can
155 # register that ourselves (if it exists). 167 # register that ourselves (if it exists).
156 local result 168 local result
157 local err 169 local err
158 170
171 if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
159 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config 172 sed -i 's:ghc-pkg:/usr/bin/true:' .setup-config
160 result="$(./setup register 2>&1)" 173 ./setup register || die "setup register failed"
161 err="$?"
162 if ! echo ${result} | grep -q "no library to register"; then
163 $(exit "${err}") || die "setup register failed"
164 fi
165 if [[ -f .installed-pkg-config ]]; then 174 if [[ -f .installed-pkg-config ]]; then
166 ghc-setup-pkg .installed-pkg-config 175 ghc-setup-pkg .installed-pkg-config
167 ghc-install-pkg 176 ghc-install-pkg
177 else
178 die "setup register has not generated a package configuration file"
179 fi
168 fi 180 fi
169} 181}
170 182
171# exported function: check if cabal is correctly installed for 183# exported function: check if cabal is correctly installed for
172# the currently active ghc (we cannot guarantee this with portage) 184# the currently active ghc (we cannot guarantee this with portage)
175 eerror "The package dev-haskell/cabal is not correctly installed for" 187 eerror "The package dev-haskell/cabal is not correctly installed for"
176 eerror "the currently active version of ghc ($(ghc-version)). Please" 188 eerror "the currently active version of ghc ($(ghc-version)). Please"
177 eerror "run ghc-updater or re-emerge dev-haskell/cabal." 189 eerror "run ghc-updater or re-emerge dev-haskell/cabal."
178 die "cabal is not correctly installed" 190 die "cabal is not correctly installed"
179 fi 191 fi
192 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
193 eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
194 fi
195 if [[ -n "${CABAL_UNKNOWN}" ]]; then
196 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}"
197 fi
180} 198}
181 199
182# exported function: cabal-style bootstrap configure and compile 200# exported function: cabal-style bootstrap configure and compile
183cabal_src_compile() { 201cabal_src_compile() {
184 cabal-bootstrap 202 cabal-bootstrap

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20