/[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.49 Revision 1.53
1# Copyright 1999-2015 Gentoo Foundation 1# Copyright 1999-2015 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.49 2015/03/15 17:03:27 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.53 2015/08/06 08:20:33 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:
170} 170}
171 171
172cabal-bootstrap() { 172cabal-bootstrap() {
173 local setupmodule 173 local setupmodule
174 local cabalpackage 174 local cabalpackage
175 local setup_bootstrap_args=()
176
175 if [[ -f "${S}/Setup.lhs" ]]; then 177 if [[ -f "${S}/Setup.lhs" ]]; then
176 setupmodule="${S}/Setup.lhs" 178 setupmodule="${S}/Setup.lhs"
177 elif [[ -f "${S}/Setup.hs" ]]; then 179 elif [[ -f "${S}/Setup.hs" ]]; then
178 setupmodule="${S}/Setup.hs" 180 setupmodule="${S}/Setup.hs"
179 else 181 else
190 # We build the setup program using the latest version of 192 # We build the setup program using the latest version of
191 # cabal that we have installed 193 # cabal that we have installed
192 cabalpackage=Cabal-$(cabal-version) 194 cabalpackage=Cabal-$(cabal-version)
193 einfo "Using cabal-$(cabal-version)." 195 einfo "Using cabal-$(cabal-version)."
194 196
197 if $(ghc-supports-threaded-runtime); then
198 # Cabal has a bug that deadlocks non-threaded RTS:
199 # https://bugs.gentoo.org/537500
200 # https://github.com/haskell/cabal/issues/2398
201 setup_bootstrap_args+=(-threaded)
202 fi
203
195 make_setup() { 204 make_setup() {
196 set -- -package "${cabalpackage}" --make "${setupmodule}" \ 205 set -- -package "${cabalpackage}" --make "${setupmodule}" \
206 "${setup_bootstrap_args[@]}" \
197 ${HCFLAGS} \ 207 ${HCFLAGS} \
198 ${GHC_BOOTSTRAP_FLAGS} \ 208 ${GHC_BOOTSTRAP_FLAGS} \
199 "$@" \ 209 "$@" \
200 -o setup 210 -o setup
201 echo $(ghc-getghc) "$@" 211 echo $(ghc-getghc) "$@"
309cabal-configure() { 319cabal-configure() {
310 local cabalconf=() 320 local cabalconf=()
311 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 321 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
312 322
313 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 323 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
324 # We use the bundled with GHC version if exists
325 # Haddock is very picky about index files
326 # it generates for ghc's base and other packages.
327 local p=${EPREFIX}/usr/bin/haddock-ghc-$(ghc-version)
328 if [[ -f $p ]]; then
329 cabalconf+=(--with-haddock="${p}")
330 else
314 cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock) 331 cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock)
332 fi
315 fi 333 fi
316 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then 334 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
317 cabalconf+=(--enable-library-profiling) 335 cabalconf+=(--enable-library-profiling)
318 fi 336 fi
319 if [[ -n "${CABAL_USE_ALEX}" ]]; then 337 if [[ -n "${CABAL_USE_ALEX}" ]]; then
385 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \ 403 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
386 $(ghc-supports-shared-libraries) && \ 404 $(ghc-supports-shared-libraries) && \
387 cabalconf+=(--enable-shared) 405 cabalconf+=(--enable-shared)
388 406
389 if $(ghc-supports-shared-libraries); then 407 if $(ghc-supports-shared-libraries); then
390 # maybe a bit lower 408 # Experimental support for dynamically linked binaries.
391 if $(ghc-supports-dynamic-by-default); then 409 # We are enabling it since 7.10.1_rc3
410 if version_is_at_least "7.10.0.20150316" "$(ghc-version)"; then
411 # we didn't enable it before as it was not stable on all arches
392 cabalconf+=(--enable-shared) 412 cabalconf+=(--enable-shared)
413 # Known to break on ghc-7.8/Cabal-1.18
414 # https://ghc.haskell.org/trac/ghc/ticket/9625
415 cabalconf+=(--enable-executable-dynamic)
393 fi 416 fi
394 fi 417 fi
395 418
396 # --sysconfdir appeared in Cabal-1.18+ 419 # --sysconfdir appeared in Cabal-1.18+
397 if ./setup configure --help | grep -q -- --sysconfdir; then 420 if ./setup configure --help | grep -q -- --sysconfdir; then
462# Those versions are taken as-is from ghc `--numeric-version`. 485# Those versions are taken as-is from ghc `--numeric-version`.
463# Package manager versions are also supported: 486# Package manager versions are also supported:
464# CABAL_CORE_LIB_GHC_PV="7.10.* PM:7.8.4-r1". 487# CABAL_CORE_LIB_GHC_PV="7.10.* PM:7.8.4-r1".
465cabal-is-dummy-lib() { 488cabal-is-dummy-lib() {
466 local bin_ghc_version=$(ghc-version) 489 local bin_ghc_version=$(ghc-version)
467 local pm_ghc_p=$(best_version dev-lang/ghc)
468 local pm_ghc_version version 490 local pm_ghc_version=$(ghc-pm-version)
469 491
470 pm_ghc_version=PM:${pm_ghc_p#dev-lang/ghc-}
471
472 for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do 492 for version in ${CABAL_CORE_LIB_GHC_PV}; do
473 [[ "${bin_ghc_version}" == ${version} ]] && return 0 493 [[ "${bin_ghc_version}" == ${version} ]] && return 0
474 [[ "${pm_ghc_version}" == ${version} ]] && return 0 494 [[ "${pm_ghc_version}" == ${version} ]] && return 0
475 done 495 done
476 496
477 return 1 497 return 1

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20