/[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.14 Revision 1.18
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.14 2007/12/13 04:44:39 dcoutts Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.18 2010/01/26 20:50:40 kolmodin 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#
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 27# bin -- the package installs binaries
28# lib -- the package installs libraries 28# lib -- the package installs libraries
29# nocabaldep -- don't add dependency on cabal.
30# only used for packages that _must_ not pull the dependency
31# on cabal, but still use this eclass (e.g. haskell-updater).
29# 32#
30# Dependencies on other cabal packages have to be specified 33# Dependencies on other cabal packages have to be specified
31# correctly. 34# correctly.
32# 35#
33# Cabal libraries should usually be SLOTted with "${PV}". 36# Cabal libraries should usually be SLOTted with "${PV}".
43inherit ghc-package multilib 46inherit ghc-package multilib
44 47
45 48
46for feature in ${CABAL_FEATURES}; do 49for feature in ${CABAL_FEATURES}; do
47 case ${feature} in 50 case ${feature} in
48 haddock) CABAL_USE_HADDOCK=yes;; 51 haddock) CABAL_USE_HADDOCK=yes;;
49 alex) CABAL_USE_ALEX=yes;; 52 alex) CABAL_USE_ALEX=yes;;
50 happy) CABAL_USE_HAPPY=yes;; 53 happy) CABAL_USE_HAPPY=yes;;
51 c2hs) CABAL_USE_C2HS=yes;; 54 c2hs) CABAL_USE_C2HS=yes;;
52 cpphs) CABAL_USE_CPPHS=yes;; 55 cpphs) CABAL_USE_CPPHS=yes;;
53 profile) CABAL_USE_PROFILE=yes;; 56 profile) CABAL_USE_PROFILE=yes;;
54 bootstrap) CABAL_BOOTSTRAP=yes;; 57 bootstrap) CABAL_BOOTSTRAP=yes;;
55 bin) CABAL_HAS_BINARIES=yes;; 58 bin) CABAL_HAS_BINARIES=yes;;
56 lib) CABAL_HAS_LIBRARIES=yes;; 59 lib) CABAL_HAS_LIBRARIES=yes;;
60 nocabaldep) CABAL_FROM_GHC=yes;;
57 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";; 61 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
58 esac 62 esac
59done 63done
60 64
61if [[ -n "${CABAL_USE_HADDOCK}" ]]; then 65if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
90# We always use a standalone version of Cabal, rather than the one that comes 94# We always use a standalone version of Cabal, rather than the one that comes
91# with GHC. But of course we can't depend on cabal when building cabal itself. 95# with GHC. But of course we can't depend on cabal when building cabal itself.
92if [[ -z ${CABAL_MIN_VERSION} ]]; then 96if [[ -z ${CABAL_MIN_VERSION} ]]; then
93 CABAL_MIN_VERSION=1.1.4 97 CABAL_MIN_VERSION=1.1.4
94fi 98fi
95if [[ -z "${CABAL_BOOTSTRAP}" ]]; then 99if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then
96 DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}" 100 DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
97fi 101fi
98 102
99# Libraries require GHC to be installed. 103# Libraries require GHC to be installed.
100if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then 104if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
107 if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then 111 if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then
108 if [[ "${CABAL_BOOTSTRAP}" ]]; then 112 if [[ "${CABAL_BOOTSTRAP}" ]]; then
109 # We're bootstrapping cabal, so the cabal version is the version 113 # We're bootstrapping cabal, so the cabal version is the version
110 # of this package itself. 114 # of this package itself.
111 _CABAL_VERSION_CACHE="${PV}" 115 _CABAL_VERSION_CACHE="${PV}"
116 elif [[ "${CABAL_FROM_GHC}" ]]; then
117 # We can't assume there's a version of Cabal installed by ebuild as
118 # this might be a first time install of GHC (for packages that
119 # use the shipped Cabal like haskell-updater).
120
121 # The user is likely to only have one version of Cabal, provided
122 # by GHC. Note that dev-haskell/cabal can be a dummy package, only
123 # using the version provided by GHC. If the user has another version
124 # of Cabal too (more recent than the one GHC provides through
125 # dev-haskell/cabal, or possibly older if he used an old
126 # Cabal package) the most recent is used (expected to be the last
127 # one in the ghc-pkg output).
128 _CABAL_VERSION_CACHE="$(ghc-pkg field Cabal version | tail -n 1)"
129
130 # Strip out the "version: " prefix
131 _CABAL_VERSION_CACHE="${_CABAL_VERSION_CACHE#"version: "}"
112 else 132 else
113 # We ask portage, not ghc, so that we only pick up 133 # We ask portage, not ghc, so that we only pick up
114 # portage-installed cabal versions. 134 # portage-installed cabal versions.
115 _CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)" 135 _CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
116 fi 136 fi
171 cabalconf="${cabalconf} --enable-library-profiling" 191 cabalconf="${cabalconf} --enable-library-profiling"
172 fi 192 fi
173 # Building GHCi libs on ppc64 causes "TOC overflow". 193 # Building GHCi libs on ppc64 causes "TOC overflow".
174 if use ppc64; then 194 if use ppc64; then
175 cabalconf="${cabalconf} --disable-library-for-ghci" 195 cabalconf="${cabalconf} --disable-library-for-ghci"
196 fi
197
198 if version_is_at_least "1.4" "$(cabal-version)"; then
199 # disable executable stripping for the executables, as portage will
200 # strip by itself, and pre-stripping gives a QA warning.
201 # cabal versions previous to 1.4 does not strip executables, and does
202 # not accept the flag.
203 # this fixes numerous bugs, amongst them;
204 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
205 cabalconf="${cabalconf} --disable-executable-stripping"
176 fi 206 fi
177 207
178 if version_is_at_least "1.2.0" "$(cabal-version)"; then 208 if version_is_at_least "1.2.0" "$(cabal-version)"; then
179 cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}" 209 cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}"
180 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes 210 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
271 301
272# exported function: check if cabal is correctly installed for 302# exported function: check if cabal is correctly installed for
273# the currently active ghc (we cannot guarantee this with portage) 303# the currently active ghc (we cannot guarantee this with portage)
274haskell-cabal_pkg_setup() { 304haskell-cabal_pkg_setup() {
275 ghc-package_pkg_setup 305 ghc-package_pkg_setup
276 if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then 306 if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
277 eerror "The package dev-haskell/cabal is not correctly installed for" 307 eerror "The package dev-haskell/cabal is not correctly installed for"
278 eerror "the currently active version of ghc ($(ghc-version)). Please" 308 eerror "the currently active version of ghc ($(ghc-version)). Please"
279 eerror "run ghc-updater or re-emerge dev-haskell/cabal." 309 eerror "run ghc-updater or haskell-updater or re-build dev-haskell/cabal."
280 die "cabal is not correctly installed" 310 die "cabal is not correctly installed"
281 fi 311 fi
282 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then 312 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
283 eerror "QA: Neither bin nor lib are in CABAL_FEATURES." 313 eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
284 fi 314 fi
285 if [[ -n "${CABAL_UNKNOWN}" ]]; then 315 if [[ -n "${CABAL_UNKNOWN}" ]]; then
286 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}" 316 ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
287 fi 317 fi
288 if cabal-is-dummy-lib; then 318 if cabal-is-dummy-lib; then
289 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." 319 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
290 fi 320 fi
291} 321}
300 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 330 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
301 cabal-haddock 331 cabal-haddock
302 fi 332 fi
303 fi 333 fi
304} 334}
335
305haskell-cabal_src_compile() { 336haskell-cabal_src_compile() {
306 cabal_src_compile 337 cabal_src_compile
307} 338}
308 339
309# exported function: cabal-style copy and register 340# exported function: cabal-style copy and register

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20