/[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.32 Revision 1.35
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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.32 2012/04/19 17:33:19 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.35 2012/11/16 15:47:17 slyfox Exp $
4 4
5# @ECLASS: haskell-cabal.eclass 5# @ECLASS: haskell-cabal.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Haskell herd <haskell@gentoo.org> 7# Haskell herd <haskell@gentoo.org>
8# @AUTHOR: 8# @AUTHOR:
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# hscolour -- generation of colourised sources
22# hoogle -- generation of documentation search index
22# alex -- lexer/scanner generator 23# alex -- lexer/scanner generator
23# happy -- parser generator 24# happy -- parser generator
24# c2hs -- C interface generator 25# c2hs -- C interface generator
25# cpphs -- C preprocessor clone written in Haskell 26# cpphs -- C preprocessor clone written in Haskell
26# profile -- if package supports to build profiling-enabled libraries 27# profile -- if package supports to build profiling-enabled libraries
55: ${GHC_BOOTSTRAP_FLAGS:=} 56: ${GHC_BOOTSTRAP_FLAGS:=}
56 57
57HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install" 58HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install"
58 59
59case "${EAPI:-0}" in 60case "${EAPI:-0}" in
60 2|3|4) HASKELL_CABAL_EXPF+=" src_configure" ;; 61 2|3|4|5) HASKELL_CABAL_EXPF+=" src_configure" ;;
61 *) ;; 62 *) ;;
62esac 63esac
63 64
64EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF} 65EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF}
65 66
185 $(ghc-getghc) "$@" 186 $(ghc-getghc) "$@"
186 } 187 }
187 if $(ghc-supports-shared-libraries); then 188 if $(ghc-supports-shared-libraries); then
188 # # some custom build systems might use external libraries, 189 # # some custom build systems might use external libraries,
189 # # for which we don't have shared libs, so keep static fallback 190 # # for which we don't have shared libs, so keep static fallback
190 # Disabled '-dynamic' as ghc does not embed RPATH to used extra-libraries:
191 # bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3 191 # bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3
192 # make_setup -dynamic "$@" || 192 # http://hackage.haskell.org/trac/ghc/ticket/7062
193 # http://hackage.haskell.org/trac/ghc/ticket/3072
194 # ghc does not set RPATH for extralibs, thus we do it ourselves by hands
195 einfo "Prepending $(ghc-libdir) to LD_LIBRARY_PATH"
196 if [[ ${CHOST} != *-darwin* ]]; then
197 LD_LIBRARY_PATH="$(ghc-libdir)${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
198 export LD_LIBRARY_PATH
199 else
200 DYLD_LIBRARY_PATH="$(ghc-libdir)${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
201 export DYLD_LIBRARY_PATH
202 fi
203 { make_setup -dynamic "$@" && ./setup --help >/dev/null; } ||
193 make_setup "$@" || die "compiling ${setupmodule} failed" 204 make_setup "$@" || die "compiling ${setupmodule} failed"
194 else 205 else
195 make_setup "$@" || die "compiling ${setupmodule} failed" 206 make_setup "$@" || die "compiling ${setupmodule} failed"
196 fi 207 fi
197} 208}
289 # We build shared version of our Cabal where ghc ships it's shared 300 # We build shared version of our Cabal where ghc ships it's shared
290 # version of it. We will link ./setup as dynamic binary againt Cabal later. 301 # version of it. We will link ./setup as dynamic binary againt Cabal later.
291 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \ 302 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
292 $(ghc-supports-shared-libraries) && \ 303 $(ghc-supports-shared-libraries) && \
293 cabalconf="${cabalconf} --enable-shared" 304 cabalconf="${cabalconf} --enable-shared"
305
306 if $(ghc-supports-shared-libraries); then
307 # maybe a bit lower
308 if version_is_at_least "7.7.20121114" "$(ghc-version)"; then
309 cabalconf="${cabalconf} --enable-shared"
310 fi
311 fi
294 312
295 set -- configure \ 313 set -- configure \
296 --ghc --prefix="${EPREFIX}"/usr \ 314 --ghc --prefix="${EPREFIX}"/usr \
297 --with-compiler="$(ghc-getghc)" \ 315 --with-compiler="$(ghc-getghc)" \
298 --with-hc-pkg="$(ghc-getghcpkg)" \ 316 --with-hc-pkg="$(ghc-getghcpkg)" \
350# However portage still records the dependency and we can upgrade the package 368# However portage still records the dependency and we can upgrade the package
351# to a later one that's not included with ghc. 369# to a later one that's not included with ghc.
352# You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1". 370# You can also put a space separated list, eg CABAL_CORE_LIB_GHC_PV="6.6 6.6.1".
353cabal-is-dummy-lib() { 371cabal-is-dummy-lib() {
354 for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do 372 for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do
355 [[ "$(ghc-version)" == "$version" ]] && return 0 373 [[ "$(ghc-version)" == ${version} ]] && return 0
356 done 374 done
357 return 1 375 return 1
358} 376}
359 377
360# exported function: check if cabal is correctly installed for 378# exported function: check if cabal is correctly installed for
459 local ghc_confdir_with_prefix="$(ghc-confdir)" 477 local ghc_confdir_with_prefix="$(ghc-confdir)"
460 # remove EPREFIX 478 # remove EPREFIX
461 dodir ${ghc_confdir_with_prefix#${EPREFIX}} 479 dodir ${ghc_confdir_with_prefix#${EPREFIX}}
462 local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)" 480 local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
463 [[ -e $conf_file ]] || echo '[]' > "$conf_file" || die 481 [[ -e $conf_file ]] || echo '[]' > "$conf_file" || die
482
483 # make sure installed packages do not destroy ghc's
484 # bundled packages
485 local initial_pkg_db=${ROOT}/$(ghc-libdir)/package.conf.d.initial
486 if [[ -e ${initial_pkg_db} ]]; then
487 local checked_pkg
488 for checked_pkg in $(ghc-listpkg "${conf_file}")
489 do
490 local initial_pkg
491 for initial_pkg in $(ghc-listpkg "${initial_pkg_db}"); do
492 if [[ ${checked_pkg} = ${initial_pkg} ]]; then
493 eerror "Package ${checked_pkg} is shipped with $(ghc-version)."
494 eerror "Ebuild author forgot CABAL_CORE_LIB_GHC_PV entry."
495 eerror "Found in ${initial_pkg_db}."
496 die
497 fi
498 done
499 done
500 fi
464} 501}
465 502
466haskell-cabal_src_install() { 503haskell-cabal_src_install() {
467 pushd "${S}" > /dev/null 504 pushd "${S}" > /dev/null
468 505

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.20