| 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.34 2012/09/27 16:35:41 axs 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 |
| … | |
… | |
| 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)" \ |