/[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.18 Revision 1.20
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.18 2010/01/26 20:50:40 kolmodin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.20 2010/03/30 22:18:37 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#
43# Special flags to Cabal Configure can now be set by using 43# Special flags to Cabal Configure can now be set by using
44# CABAL_CONFIGURE_FLAGS 44# CABAL_CONFIGURE_FLAGS
45 45
46inherit ghc-package multilib 46inherit ghc-package multilib
47 47
48HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install"
49
50case "${EAPI:-0}" in
51 2|3|4) HASKELL_CABAL_EXPF+=" src_configure" ;;
52 *) ;;
53esac
54
55EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF}
48 56
49for feature in ${CABAL_FEATURES}; do 57for feature in ${CABAL_FEATURES}; do
50 case ${feature} in 58 case ${feature} in
51 haddock) CABAL_USE_HADDOCK=yes;; 59 haddock) CABAL_USE_HADDOCK=yes;;
52 alex) CABAL_USE_ALEX=yes;; 60 alex) CABAL_USE_ALEX=yes;;
318 if cabal-is-dummy-lib; then 326 if cabal-is-dummy-lib; then
319 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install." 327 einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
320 fi 328 fi
321} 329}
322 330
331haskell-cabal_src_configure() {
332 pushd "${S}" > /dev/null
333
334 cabal-bootstrap
335 cabal-configure "$@"
336
337 popd > /dev/null
338}
339
340# exported function: nice alias
341cabal_src_configure() {
342 haskell-cabal_src_configure "$@"
343}
344
323# exported function: cabal-style bootstrap configure and compile 345# exported function: cabal-style bootstrap configure and compile
324cabal_src_compile() { 346cabal_src_compile() {
325 if ! cabal-is-dummy-lib; then 347 if ! cabal-is-dummy-lib; then
326 cabal-bootstrap 348 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
327 cabal-configure
328 cabal-build 349 cabal-build
329 350
330 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 351 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
331 cabal-haddock 352 cabal-haddock
332 fi 353 fi
333 fi 354 fi
334} 355}
335 356
336haskell-cabal_src_compile() { 357haskell-cabal_src_compile() {
358 pushd "${S}" > /dev/null
359
337 cabal_src_compile 360 cabal_src_compile "$@"
361
362 popd > /dev/null
363}
364
365haskell-cabal_src_test() {
366 pushd "${S}" > /dev/null
367
368 if cabal-is-dummy-lib; then
369 einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}"
370 else
371 einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
372 ./setup test || die "cabal test failed"
373 fi
374
375 popd > /dev/null
338} 376}
339 377
340# exported function: cabal-style copy and register 378# exported function: cabal-style copy and register
341cabal_src_install() { 379cabal_src_install() {
342 if cabal-is-dummy-lib; then 380 if cabal-is-dummy-lib; then
352 dohtml -r dist/doc/html/* 390 dohtml -r dist/doc/html/*
353 fi 391 fi
354 fi 392 fi
355 fi 393 fi
356} 394}
395
357haskell-cabal_src_install() { 396haskell-cabal_src_install() {
397 pushd "${S}" > /dev/null
398
358 cabal_src_install 399 cabal_src_install
359}
360 400
361EXPORT_FUNCTIONS pkg_setup src_compile src_install 401 popd > /dev/null
402}
403
404# ebuild.sh:use_enable() taken as base
405#
406# Usage examples:
407#
408# CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
409# leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')
410#
411# CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
412# also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')
413#
414cabal_flag() {
415 if [[ -z "$1" ]]; then
416 echo "!!! cabal_flag() called without a parameter." >&2
417 echo "!!! cabal_flag() <USEFLAG> [<cabal_flagname>]" >&2
418 return 1
419 fi
420
421 local UWORD=${2:-$1}
422
423 if use "$1"; then
424 echo "--flags=${UWORD}"
425 else
426 echo "--flags=-${UWORD}"
427 fi
428
429 return 0
430}

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20