/[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.19
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.19 2010/03/27 09:10:46 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 einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
369 ./setup test || die "cabal test failed"
370
371 popd > /dev/null
338} 372}
339 373
340# exported function: cabal-style copy and register 374# exported function: cabal-style copy and register
341cabal_src_install() { 375cabal_src_install() {
342 if cabal-is-dummy-lib; then 376 if cabal-is-dummy-lib; then
352 dohtml -r dist/doc/html/* 386 dohtml -r dist/doc/html/*
353 fi 387 fi
354 fi 388 fi
355 fi 389 fi
356} 390}
391
357haskell-cabal_src_install() { 392haskell-cabal_src_install() {
393 pushd "${S}" > /dev/null
394
358 cabal_src_install 395 cabal_src_install
359}
360 396
361EXPORT_FUNCTIONS pkg_setup src_compile src_install 397 popd > /dev/null
398}
399
400# ebuild.sh:use_enable() taken as base
401#
402# Usage examples:
403#
404# CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
405# leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')
406#
407# CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
408# also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')
409#
410cabal_flag() {
411 if [[ -z "$1" ]]; then
412 echo "!!! cabal_flag() called without a parameter." >&2
413 echo "!!! cabal_flag() <USEFLAG> [<cabal_flagname>]" >&2
414 return 1
415 fi
416
417 local UWORD=${2:-$1}
418
419 if use "$1"; then
420 echo "--flags=${UWORD}"
421 else
422 echo "--flags=-${UWORD}"
423 fi
424
425 return 0
426}

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

  ViewVC Help
Powered by ViewVC 1.1.20