/[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.39 Revision 1.40
1# Copyright 1999-2013 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.39 2013/04/28 16:15:33 zmedico Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.40 2013/05/11 12:46:32 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:
31# nocabaldep -- don't add dependency on cabal. 31# nocabaldep -- don't add dependency on cabal.
32# only used for packages that _must_ not pull the dependency 32# only used for packages that _must_ not pull the dependency
33# on cabal, but still use this eclass (e.g. haskell-updater). 33# on cabal, but still use this eclass (e.g. haskell-updater).
34# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8) 34# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8)
35 35
36inherit ghc-package multilib 36inherit eutils ghc-package multilib
37 37
38# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS 38# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
39# @DESCRIPTION: 39# @DESCRIPTION:
40# User-specified additional parameters passed to 'setup configure'. 40# User-specified additional parameters passed to 'setup configure'.
41# example: /etc/portage/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared 41# example: /etc/portage/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared
240 set -- haddock --hyperlink-source 240 set -- haddock --hyperlink-source
241 echo ./setup "$@" 241 echo ./setup "$@"
242 ./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed" 242 ./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed"
243} 243}
244 244
245cabal-show-brokens() {
246 # pretty-printer
247 $(ghc-getghcpkg) check 2>&1 \
248 | egrep -v '^Warning: haddock-(html|interfaces): ' \
249 | egrep -v '^Warning: include-dirs: '
250
251 set -- $($(ghc-getghcpkg) check --simple-output)
252 [[ "${#@}" == 0 ]] && return 0
253
254 eerror "Detected broken packages: ${@}"
255
256 die "//==-- Please, run 'haskell-updater' to fix broken packages --==//"
257}
258
259cabal-show-brokens-and-die() {
260 cabal-show-brokens
261
262 die "$@"
263}
264
245cabal-configure() { 265cabal-configure() {
246 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 266 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
247 267
248 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 268 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
249 cabalconf="${cabalconf} --with-haddock=${EPREFIX}/usr/bin/haddock" 269 cabalconf="${cabalconf} --with-haddock=${EPREFIX}/usr/bin/haddock"
304 $(ghc-supports-shared-libraries) && \ 324 $(ghc-supports-shared-libraries) && \
305 cabalconf="${cabalconf} --enable-shared" 325 cabalconf="${cabalconf} --enable-shared"
306 326
307 if $(ghc-supports-shared-libraries); then 327 if $(ghc-supports-shared-libraries); then
308 # maybe a bit lower 328 # maybe a bit lower
309 if version_is_at_least "7.7.20121114" "$(ghc-version)"; then 329 if $(ghc-supports-dynamic-by-default); then
310 cabalconf="${cabalconf} --enable-shared" 330 cabalconf="${cabalconf} --enable-shared"
311 fi 331 fi
312 fi 332 fi
313 333
314 set -- configure \ 334 set -- configure \
323 ${cabalconf} \ 343 ${cabalconf} \
324 ${CABAL_CONFIGURE_FLAGS} \ 344 ${CABAL_CONFIGURE_FLAGS} \
325 ${CABAL_EXTRA_CONFIGURE_FLAGS} \ 345 ${CABAL_EXTRA_CONFIGURE_FLAGS} \
326 "$@" 346 "$@"
327 echo ./setup "$@" 347 echo ./setup "$@"
328 ./setup "$@" || die "setup configure failed" 348 ./setup "$@" || cabal-show-brokens-and-die "setup configure failed"
329} 349}
330 350
331cabal-build() { 351cabal-build() {
332 unset LANG LC_ALL LC_MESSAGES 352 unset LANG LC_ALL LC_MESSAGES
333 set -- build ${CABAL_EXTRA_BUILD_FLAGS} "$@" 353 set -- build ${CABAL_EXTRA_BUILD_FLAGS} "$@"

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.20