/[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.22
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.22 2010/09/12 07:37:09 slyfox 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"
330 346
331haskell-cabal_src_configure() { 347haskell-cabal_src_configure() {
332 pushd "${S}" > /dev/null 348 pushd "${S}" > /dev/null
333 349
334 cabal-bootstrap 350 cabal-bootstrap
351
352 ghc_flags=""
353 # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
354 # so translate LDFLAGS to ghc parameters (without filtering)
355 for flag in $LDFLAGS; do ghc_flags="${ghc_flags} --ghc-option=-optl$flag"; done
356
335 cabal-configure "$@" 357 cabal-configure $ghc_flags "$@"
336 358
337 popd > /dev/null 359 popd > /dev/null
338} 360}
339 361
340# exported function: nice alias 362# exported function: nice alias
347 if ! cabal-is-dummy-lib; then 369 if ! cabal-is-dummy-lib; then
348 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@" 370 has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
349 cabal-build 371 cabal-build
350 372
351 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 373 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
374 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
375 # hscolour and haddock
376 cabal-hscolour-haddock
377 else
378 # just haddock
352 cabal-haddock 379 cabal-haddock
380 fi
381 else
382 if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
383 # just hscolour
384 cabal-hscolour
385 fi
353 fi 386 fi
354 fi 387 fi
355} 388}
356 389
357haskell-cabal_src_compile() { 390haskell-cabal_src_compile() {

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

  ViewVC Help
Powered by ViewVC 1.1.20