/[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.30 Revision 1.33
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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.30 2012/04/14 19:30:53 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.33 2012/07/08 19:16:46 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:
28# bin -- the package installs binaries 28# bin -- the package installs binaries
29# lib -- the package installs libraries 29# lib -- the package installs libraries
30# nocabaldep -- don't add dependency on cabal. 30# nocabaldep -- don't add dependency on cabal.
31# only used for packages that _must_ not pull the dependency 31# only used for packages that _must_ not pull the dependency
32# on cabal, but still use this eclass (e.g. haskell-updater). 32# on cabal, but still use this eclass (e.g. haskell-updater).
33# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8)
33 34
34inherit ghc-package multilib 35inherit ghc-package multilib
35 36
36# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS 37# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
37# @DESCRIPTION: 38# @DESCRIPTION:
74 profile) CABAL_USE_PROFILE=yes;; 75 profile) CABAL_USE_PROFILE=yes;;
75 bootstrap) CABAL_BOOTSTRAP=yes;; 76 bootstrap) CABAL_BOOTSTRAP=yes;;
76 bin) CABAL_HAS_BINARIES=yes;; 77 bin) CABAL_HAS_BINARIES=yes;;
77 lib) CABAL_HAS_LIBRARIES=yes;; 78 lib) CABAL_HAS_LIBRARIES=yes;;
78 nocabaldep) CABAL_FROM_GHC=yes;; 79 nocabaldep) CABAL_FROM_GHC=yes;;
80 test-suite) CABAL_TEST_SUITE=yes;;
79 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";; 81 *) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
80 esac 82 esac
81done 83done
82 84
83if [[ -n "${CABAL_USE_HADDOCK}" ]]; then 85if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
108 DEPEND="${DEPEND} dev-haskell/cpphs" 110 DEPEND="${DEPEND} dev-haskell/cpphs"
109fi 111fi
110 112
111if [[ -n "${CABAL_USE_PROFILE}" ]]; then 113if [[ -n "${CABAL_USE_PROFILE}" ]]; then
112 IUSE="${IUSE} profile" 114 IUSE="${IUSE} profile"
115fi
116
117if [[ -n "${CABAL_TEST_SUITE}" ]]; then
118 IUSE="${IUSE} test"
113fi 119fi
114 120
115# We always use a standalone version of Cabal, rather than the one that comes 121# We always use a standalone version of Cabal, rather than the one that comes
116# with GHC. But of course we can't depend on cabal when building cabal itself. 122# with GHC. But of course we can't depend on cabal when building cabal itself.
117if [[ -z ${CABAL_MIN_VERSION} ]]; then 123if [[ -z ${CABAL_MIN_VERSION} ]]; then
156 setupmodule="${S}/Setup.hs" 162 setupmodule="${S}/Setup.hs"
157 else 163 else
158 die "No Setup.lhs or Setup.hs found" 164 die "No Setup.lhs or Setup.hs found"
159 fi 165 fi
160 166
167 if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
168 eerror "The package dev-haskell/cabal is not correctly installed for"
169 eerror "the currently active version of ghc ($(ghc-version)). Please"
170 eerror "run haskell-updater or re-build dev-haskell/cabal."
171 die "cabal is not correctly installed"
172 fi
173
161 # We build the setup program using the latest version of 174 # We build the setup program using the latest version of
162 # cabal that we have installed 175 # cabal that we have installed
163 cabalpackage=Cabal-$(cabal-version) 176 cabalpackage=Cabal-$(cabal-version)
164 einfo "Using cabal-$(cabal-version)." 177 einfo "Using cabal-$(cabal-version)."
165 178
238 cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" 251 cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs"
239 fi 252 fi
240 if [[ -n "${CABAL_USE_CPPHS}" ]]; then 253 if [[ -n "${CABAL_USE_CPPHS}" ]]; then
241 cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" 254 cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs"
242 fi 255 fi
256 if [[ -n "${CABAL_TEST_SUITE}" ]]; then
257 cabalconf="${cabalconf} $(use_enable test tests)"
258 fi
243 259
244 local option 260 local option
245 for option in ${HCFLAGS} 261 for option in ${HCFLAGS}
246 do 262 do
247 cabalconf+=" --ghc-option=$option" 263 cabalconf+=" --ghc-option=$option"
334# However portage still records the dependency and we can upgrade the package 350# However portage still records the dependency and we can upgrade the package
335# to a later one that's not included with ghc. 351# to a later one that's not included with ghc.
336# You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1". 352# You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1".
337cabal-is-dummy-lib() { 353cabal-is-dummy-lib() {
338 for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do 354 for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do
339 [[ "$(ghc-version)" == "$version" ]] && return 0 355 [[ "$(ghc-version)" == ${version} ]] && return 0
340 done 356 done
341 return 1 357 return 1
342} 358}
343 359
344# exported function: check if cabal is correctly installed for 360# exported function: check if cabal is correctly installed for
345# the currently active ghc (we cannot guarantee this with portage) 361# the currently active ghc (we cannot guarantee this with portage)
346haskell-cabal_pkg_setup() { 362haskell-cabal_pkg_setup() {
347 if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
348 eerror "The package dev-haskell/cabal is not correctly installed for"
349 eerror "the currently active version of ghc ($(ghc-version)). Please"
350 eerror "run haskell-updater or re-build dev-haskell/cabal."
351 die "cabal is not correctly installed"
352 fi
353 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then 363 if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
354 eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES." 364 eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES."
355 fi 365 fi
356 if [[ -n "${CABAL_UNKNOWN}" ]]; then 366 if [[ -n "${CABAL_UNKNOWN}" ]]; then
357 eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}" 367 eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
449 local ghc_confdir_with_prefix="$(ghc-confdir)" 459 local ghc_confdir_with_prefix="$(ghc-confdir)"
450 # remove EPREFIX 460 # remove EPREFIX
451 dodir ${ghc_confdir_with_prefix#${EPREFIX}} 461 dodir ${ghc_confdir_with_prefix#${EPREFIX}}
452 local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)" 462 local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
453 [[ -e $conf_file ]] || echo '[]' > "$conf_file" || die 463 [[ -e $conf_file ]] || echo '[]' > "$conf_file" || die
464
465 # make sure installed packages do not destroy ghc's
466 # bundled packages
467 local initial_pkg_db=${ROOT}/$(ghc-libdir)/package.conf.d.initial
468 if [[ -e ${initial_pkg_db} ]]; then
469 local checked_pkg
470 for checked_pkg in $(ghc-listpkg "${conf_file}")
471 do
472 local initial_pkg
473 for initial_pkg in $(ghc-listpkg "${initial_pkg_db}"); do
474 if [[ ${checked_pkg} = ${initial_pkg} ]]; then
475 eerror "Package ${checked_pkg} is shipped with $(ghc-version)."
476 eerror "Ebuild author forgot CABAL_CORE_LIB_GHC_PV entry."
477 eerror "Found in ${initial_pkg_db}."
478 die
479 fi
480 done
481 done
482 fi
454} 483}
455 484
456haskell-cabal_src_install() { 485haskell-cabal_src_install() {
457 pushd "${S}" > /dev/null 486 pushd "${S}" > /dev/null
458 487

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.20