| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2005 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.3 2006/02/16 12:32:53 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 |
| 52 | done |
56 | done |
| 53 | |
57 | |
| 54 | if [[ -n "${CABAL_USE_HADDOCK}" ]]; then |
58 | if [[ -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. |
| 86 | if [[ -z "${CABAL_BOOTSTRAP}" ]]; then |
90 | if [[ -z "${CABAL_BOOTSTRAP}" ]]; then |
| 87 | DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3" |
91 | DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3" |
| 88 | fi |
92 | fi |
| 89 | |
93 | |
|
|
94 | # Libraries require GHC to be installed. |
|
|
95 | if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then |
|
|
96 | RDEPEND="${RDEPEND} virtual/ghc" |
|
|
97 | fi |
| 90 | |
98 | |
| 91 | cabal-bootstrap() { |
99 | cabal-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 |
| … | |
… | |
| 175 | eerror "The package dev-haskell/cabal is not correctly installed for" |
183 | eerror "The package dev-haskell/cabal is not correctly installed for" |
| 176 | eerror "the currently active version of ghc ($(ghc-version)). Please" |
184 | eerror "the currently active version of ghc ($(ghc-version)). Please" |
| 177 | eerror "run ghc-updater or re-emerge dev-haskell/cabal." |
185 | eerror "run ghc-updater or re-emerge dev-haskell/cabal." |
| 178 | die "cabal is not correctly installed" |
186 | die "cabal is not correctly installed" |
| 179 | fi |
187 | fi |
|
|
188 | if [[ -n "${CABAL_UNKNOWN}" ]]; then |
|
|
189 | ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}" |
|
|
190 | fi |
| 180 | } |
191 | } |
| 181 | |
192 | |
| 182 | # exported function: cabal-style bootstrap configure and compile |
193 | # exported function: cabal-style bootstrap configure and compile |
| 183 | cabal_src_compile() { |
194 | cabal_src_compile() { |
| 184 | cabal-bootstrap |
195 | cabal-bootstrap |