/[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.20 Revision 1.21
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.20 2010/03/30 22:18:37 kolmodin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.21 2010/08/07 12:06:27 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#
16# reflect the tools and features that the package makes 16# reflect the tools and features that the package makes
17# use of. 17# use of.
18# 18#
19# Currently supported features: 19# Currently supported features:
20# haddock -- for documentation generation 20# haddock -- for documentation generation
21# hscolour -- generation of colourised sources
21# alex -- lexer/scanner generator 22# alex -- lexer/scanner generator
22# happy -- parser generator 23# happy -- parser generator
23# c2hs -- C interface generator 24# c2hs -- C interface generator
24# cpphs -- C preprocessor clone written in Haskell 25# cpphs -- C preprocessor clone written in Haskell
25# profile -- if package supports to build profiling-enabled libraries 26# profile -- if package supports to build profiling-enabled libraries
55EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF} 56EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF}
56 57
57for feature in ${CABAL_FEATURES}; do 58for feature in ${CABAL_FEATURES}; do
58 case ${feature} in 59 case ${feature} in
59 haddock) CABAL_USE_HADDOCK=yes;; 60 haddock) CABAL_USE_HADDOCK=yes;;
61 hscolour) CABAL_USE_HSCOLOUR=yes;;
60 alex) CABAL_USE_ALEX=yes;; 62 alex) CABAL_USE_ALEX=yes;;
61 happy) CABAL_USE_HAPPY=yes;; 63 happy) CABAL_USE_HAPPY=yes;;
62 c2hs) CABAL_USE_C2HS=yes;; 64 c2hs) CABAL_USE_C2HS=yes;;
63 cpphs) CABAL_USE_CPPHS=yes;; 65 cpphs) CABAL_USE_CPPHS=yes;;
64 profile) CABAL_USE_PROFILE=yes;; 66 profile) CABAL_USE_PROFILE=yes;;
73if [[ -n "${CABAL_USE_HADDOCK}" ]]; then 75if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
74 IUSE="${IUSE} doc" 76 IUSE="${IUSE} doc"
75 DEPEND="${DEPEND} doc? ( dev-haskell/haddock )" 77 DEPEND="${DEPEND} doc? ( dev-haskell/haddock )"
76fi 78fi
77 79
80if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then
81 IUSE="${IUSE} hscolour"
82 DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
83fi
84
78if [[ -n "${CABAL_USE_ALEX}" ]]; then 85if [[ -n "${CABAL_USE_ALEX}" ]]; then
79 DEPEND="${DEPEND} dev-haskell/alex" 86 DEPEND="${DEPEND} dev-haskell/alex"
80 cabalconf="${cabalconf} --with-alex=/usr/bin/alex" 87 cabalconf="${cabalconf} --with-alex=/usr/bin/alex"
81fi 88fi
82 89
185 192
186 echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \ 193 echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
187 > $setupdir/Setup.hs 194 > $setupdir/Setup.hs
188} 195}
189 196
197cabal-hscolour() {
198 ./setup hscolour || die "setup hscolour failed"
199}
200
190cabal-haddock() { 201cabal-haddock() {
191 ./setup haddock || die "setup haddock failed" 202 ./setup haddock || die "setup haddock failed"
203}
204
205cabal-hscolour-haddock() {
206 # --hyperlink-source implies calling 'setup hscolour'
207 ./setup haddock --hyperlink-source || die "setup haddock failed"
192} 208}
193 209
194cabal-configure() { 210cabal-configure() {
195 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 211 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
196 cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock" 212 cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock"
347 if ! cabal-is-dummy-lib; then 363 if ! cabal-is-dummy-lib; then
348 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@" 364 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
349 cabal-build 365 cabal-build
350 366
351 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 367 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
368 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
369 # hscolour and haddock
370 cabal-hscolour-haddock
371 else
372 # just haddock
352 cabal-haddock 373 cabal-haddock
374 fi
375 else
376 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
377 # just hscolour
378 cabal-hscolour
379 fi
353 fi 380 fi
354 fi 381 fi
355} 382}
356 383
357haskell-cabal_src_compile() { 384haskell-cabal_src_compile() {

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

  ViewVC Help
Powered by ViewVC 1.1.20