| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2013 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.37 2012/11/19 21:27:56 slyfox Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.38 2013/01/06 13:06:35 slyfox Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: haskell-cabal.eclass |
5 | # @ECLASS: haskell-cabal.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Haskell herd <haskell@gentoo.org> |
7 | # Haskell herd <haskell@gentoo.org> |
| 8 | # @AUTHOR: |
8 | # @AUTHOR: |
| … | |
… | |
| 130 | if [[ -z ${CABAL_MIN_VERSION} ]]; then |
130 | if [[ -z ${CABAL_MIN_VERSION} ]]; then |
| 131 | CABAL_MIN_VERSION=1.1.4 |
131 | CABAL_MIN_VERSION=1.1.4 |
| 132 | fi |
132 | fi |
| 133 | if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then |
133 | if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then |
| 134 | DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}" |
134 | DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}" |
| 135 | fi |
|
|
| 136 | |
|
|
| 137 | # Libraries require GHC to be installed. |
|
|
| 138 | if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then |
|
|
| 139 | RDEPEND="${RDEPEND} dev-lang/ghc" |
|
|
| 140 | fi |
135 | fi |
| 141 | |
136 | |
| 142 | # returns the version of cabal currently in use |
137 | # returns the version of cabal currently in use |
| 143 | _CABAL_VERSION_CACHE="" |
138 | _CABAL_VERSION_CACHE="" |
| 144 | cabal-version() { |
139 | cabal-version() { |
| … | |
… | |
| 382 | } |
377 | } |
| 383 | |
378 | |
| 384 | # exported function: check if cabal is correctly installed for |
379 | # exported function: check if cabal is correctly installed for |
| 385 | # the currently active ghc (we cannot guarantee this with portage) |
380 | # the currently active ghc (we cannot guarantee this with portage) |
| 386 | haskell-cabal_pkg_setup() { |
381 | haskell-cabal_pkg_setup() { |
|
|
382 | if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then |
|
|
383 | [[ ${RDEPEND} == *dev-lang/ghc* ]] || eqawarn "QA Notice: A library does not have runtime dependency on dev-lang/ghc." |
|
|
384 | fi |
| 387 | if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then |
385 | if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then |
| 388 | eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES." |
386 | eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES." |
| 389 | fi |
387 | fi |
| 390 | if [[ -n "${CABAL_UNKNOWN}" ]]; then |
388 | if [[ -n "${CABAL_UNKNOWN}" ]]; then |
| 391 | eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}" |
389 | eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}" |
| … | |
… | |
| 512 | cabal_src_install |
510 | cabal_src_install |
| 513 | |
511 | |
| 514 | popd > /dev/null |
512 | popd > /dev/null |
| 515 | } |
513 | } |
| 516 | |
514 | |
|
|
515 | # @FUNCTION: cabal_flag |
|
|
516 | # @DESCRIPTION: |
| 517 | # ebuild.sh:use_enable() taken as base |
517 | # ebuild.sh:use_enable() taken as base |
| 518 | # |
518 | # |
| 519 | # Usage examples: |
519 | # Usage examples: |
| 520 | # |
520 | # |
| 521 | # CABAL_CONFIGURE_FLAGS=$(cabal_flag gui) |
521 | # CABAL_CONFIGURE_FLAGS=$(cabal_flag gui) |