/[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.17 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.17 2009/10/28 23:46:16 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;;
191 cabalconf="${cabalconf} --enable-library-profiling" 199 cabalconf="${cabalconf} --enable-library-profiling"
192 fi 200 fi
193 # Building GHCi libs on ppc64 causes "TOC overflow". 201 # Building GHCi libs on ppc64 causes "TOC overflow".
194 if use ppc64; then 202 if use ppc64; then
195 cabalconf="${cabalconf} --disable-library-for-ghci" 203 cabalconf="${cabalconf} --disable-library-for-ghci"
204 fi
205
206 if version_is_at_least "1.4" "$(cabal-version)"; then
207 # disable executable stripping for the executables, as portage will
208 # strip by itself, and pre-stripping gives a QA warning.
209 # cabal versions previous to 1.4 does not strip executables, and does
210 # not accept the flag.
211 # this fixes numerous bugs, amongst them;
212 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
213 cabalconf="${cabalconf} --disable-executable-stripping"
196 fi 214 fi
197 215
198 if version_is_at_least "1.2.0" "$(cabal-version)"; then 216 if version_is_at_least "1.2.0" "$(cabal-version)"; then
199 cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}" 217 cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}"
200 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes 218 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
308 if cabal-is-dummy-lib; then 326 if cabal-is-dummy-lib; then
309 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."
310 fi 328 fi
311} 329}
312 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
313# exported function: cabal-style bootstrap configure and compile 345# exported function: cabal-style bootstrap configure and compile
314cabal_src_compile() { 346cabal_src_compile() {
315 if ! cabal-is-dummy-lib; then 347 if ! cabal-is-dummy-lib; then
316 cabal-bootstrap 348 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
317 cabal-configure
318 cabal-build 349 cabal-build
319 350
320 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 351 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
321 cabal-haddock 352 cabal-haddock
322 fi 353 fi
323 fi 354 fi
324} 355}
325 356
326haskell-cabal_src_compile() { 357haskell-cabal_src_compile() {
358 pushd "${S}" > /dev/null
359
327 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
328} 376}
329 377
330# exported function: cabal-style copy and register 378# exported function: cabal-style copy and register
331cabal_src_install() { 379cabal_src_install() {
332 if cabal-is-dummy-lib; then 380 if cabal-is-dummy-lib; then
342 dohtml -r dist/doc/html/* 390 dohtml -r dist/doc/html/*
343 fi 391 fi
344 fi 392 fi
345 fi 393 fi
346} 394}
395
347haskell-cabal_src_install() { 396haskell-cabal_src_install() {
397 pushd "${S}" > /dev/null
398
348 cabal_src_install 399 cabal_src_install
349}
350 400
351EXPORT_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.17  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20