| 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.12 2007/07/27 09:09:20 kolmodin Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.13 2007/08/05 18:49:58 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 | # |
| … | |
… | |
| 194 | die "setup register has not generated a package configuration file" |
194 | die "setup register has not generated a package configuration file" |
| 195 | fi |
195 | fi |
| 196 | fi |
196 | fi |
| 197 | } |
197 | } |
| 198 | |
198 | |
|
|
199 | # Some cabal libs are bundled along with some versions of ghc |
|
|
200 | # eg filepath-1.0 comes with ghc-6.6.1 |
|
|
201 | # by putting CABAL_CORE_LIB_GHC_PV="6.6.1" in an ebuild we are declaring that |
|
|
202 | # when building with this version of ghc, the ebuild is a dummy that is it will |
|
|
203 | # install no files since the package is already included with ghc. |
|
|
204 | # However portage still records the dependency and we can upgrade the package |
|
|
205 | # to a later one that's not included with ghc. |
|
|
206 | # You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1". |
|
|
207 | cabal-is-dummy-lib() { |
|
|
208 | for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do |
|
|
209 | [[ "$(ghc-version)" == "$version" ]] && return 0 |
|
|
210 | done |
|
|
211 | return 1 |
|
|
212 | } |
|
|
213 | |
| 199 | # exported function: check if cabal is correctly installed for |
214 | # exported function: check if cabal is correctly installed for |
| 200 | # the currently active ghc (we cannot guarantee this with portage) |
215 | # the currently active ghc (we cannot guarantee this with portage) |
| 201 | haskell-cabal_pkg_setup() { |
216 | haskell-cabal_pkg_setup() { |
| 202 | ghc-package_pkg_setup |
217 | ghc-package_pkg_setup |
| 203 | if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then |
218 | if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then |
| … | |
… | |
| 210 | eerror "QA: Neither bin nor lib are in CABAL_FEATURES." |
225 | eerror "QA: Neither bin nor lib are in CABAL_FEATURES." |
| 211 | fi |
226 | fi |
| 212 | if [[ -n "${CABAL_UNKNOWN}" ]]; then |
227 | if [[ -n "${CABAL_UNKNOWN}" ]]; then |
| 213 | ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}" |
228 | ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}" |
| 214 | fi |
229 | fi |
|
|
230 | if cabal-is-dummy-lib; then |
|
|
231 | einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." |
|
|
232 | fi |
| 215 | } |
233 | } |
| 216 | |
234 | |
| 217 | # exported function: cabal-style bootstrap configure and compile |
235 | # exported function: cabal-style bootstrap configure and compile |
| 218 | cabal_src_compile() { |
236 | cabal_src_compile() { |
|
|
237 | if ! cabal-is-dummy-lib; then |
| 219 | cabal-bootstrap |
238 | cabal-bootstrap |
| 220 | cabal-configure |
239 | cabal-configure |
| 221 | cabal-build |
240 | cabal-build |
| 222 | |
241 | |
| 223 | if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then |
242 | if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then |
| 224 | cabal-haddock |
243 | cabal-haddock |
|
|
244 | fi |
| 225 | fi |
245 | fi |
| 226 | } |
246 | } |
| 227 | haskell-cabal_src_compile() { |
247 | haskell-cabal_src_compile() { |
| 228 | cabal_src_compile |
248 | cabal_src_compile |
| 229 | } |
249 | } |
| 230 | |
250 | |
| 231 | # exported function: cabal-style copy and register |
251 | # exported function: cabal-style copy and register |
| 232 | cabal_src_install() { |
252 | cabal_src_install() { |
|
|
253 | if cabal-is-dummy-lib; then |
|
|
254 | # create a dummy local package conf file for the sake of ghc-updater |
|
|
255 | dodir "$(ghc-confdir)" |
|
|
256 | echo '[]' > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)" |
|
|
257 | else |
| 233 | cabal-copy |
258 | cabal-copy |
| 234 | cabal-pkg |
259 | cabal-pkg |
| 235 | |
260 | |
| 236 | if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then |
261 | if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then |
| 237 | local cabalversion=$(ghc-extractportageversion dev-haskell/cabal) |
262 | local cabalversion=$(ghc-extractportageversion dev-haskell/cabal) |
| 238 | if ! version_is_at_least "1.1.6" "${cabalversion}"; then |
263 | if ! version_is_at_least "1.1.6" "${cabalversion}"; then |
| 239 | dohtml -r dist/doc/html/* |
264 | dohtml -r dist/doc/html/* |
|
|
265 | fi |
| 240 | fi |
266 | fi |
| 241 | fi |
267 | fi |
| 242 | } |
268 | } |
| 243 | haskell-cabal_src_install() { |
269 | haskell-cabal_src_install() { |
| 244 | cabal_src_install |
270 | cabal_src_install |