/[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.42 Revision 1.43
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2014 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.42 2013/11/20 09:19:19 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.43 2014/02/11 19:00:06 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:
31# nocabaldep -- don't add dependency on cabal. 31# nocabaldep -- don't add dependency on cabal.
32# only used for packages that _must_ not pull the dependency 32# only used for packages that _must_ not pull the dependency
33# on cabal, but still use this eclass (e.g. haskell-updater). 33# on cabal, but still use this eclass (e.g. haskell-updater).
34# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8) 34# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8)
35 35
36inherit eutils ghc-package multilib 36inherit eutils ghc-package multilib multiprocessing
37 37
38# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS 38# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
39# @DESCRIPTION: 39# @DESCRIPTION:
40# User-specified additional parameters passed to 'setup configure'. 40# User-specified additional parameters passed to 'setup configure'.
41# example: /etc/portage/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared 41# example: /etc/portage/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared
272 272
273 die "$@" 273 die "$@"
274} 274}
275 275
276cabal-configure() { 276cabal-configure() {
277 local cabalconf=()
277 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 278 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
278 279
279 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then 280 if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
280 cabalconf="${cabalconf} --with-haddock=${EPREFIX}/usr/bin/haddock" 281 cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock)
281 fi 282 fi
282 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then 283 if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
283 cabalconf="${cabalconf} --enable-library-profiling" 284 cabalconf+=(--enable-library-profiling)
284 fi 285 fi
285 if [[ -n "${CABAL_USE_ALEX}" ]]; then 286 if [[ -n "${CABAL_USE_ALEX}" ]]; then
286 cabalconf="${cabalconf} --with-alex=${EPREFIX}/usr/bin/alex" 287 cabalconf+=(--with-alex=${EPREFIX}/usr/bin/alex)
287 fi 288 fi
288 289
289 if [[ -n "${CABAL_USE_HAPPY}" ]]; then 290 if [[ -n "${CABAL_USE_HAPPY}" ]]; then
290 cabalconf="${cabalconf} --with-happy=${EPREFIX}/usr/bin/happy" 291 cabalconf+=(--with-happy=${EPREFIX}/usr/bin/happy)
291 fi 292 fi
292 293
293 if [[ -n "${CABAL_USE_C2HS}" ]]; then 294 if [[ -n "${CABAL_USE_C2HS}" ]]; then
294 cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" 295 cabalconf+=(--with-c2hs=${EPREFIX}/usr/bin/c2hs)
295 fi 296 fi
296 if [[ -n "${CABAL_USE_CPPHS}" ]]; then 297 if [[ -n "${CABAL_USE_CPPHS}" ]]; then
297 cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" 298 cabalconf+=(--with-cpphs=${EPREFIX}/usr/bin/cpphs)
298 fi 299 fi
299 if [[ -n "${CABAL_TEST_SUITE}" ]]; then 300 if [[ -n "${CABAL_TEST_SUITE}" ]]; then
300 cabalconf="${cabalconf} $(use_enable test tests)" 301 cabalconf+=($(use_enable test tests))
301 fi 302 fi
302 303
303 local option 304 local option
304 for option in ${HCFLAGS} 305 for option in ${HCFLAGS}
305 do 306 do
306 cabalconf+=" --ghc-option=$option" 307 cabalconf+=(--ghc-option="$option")
307 done 308 done
309
310 # parallel on all available cores
311 if ghc-supports-parallel-make; then
312 local max_jobs=$(makeopts_jobs)
313
314 # limit to sort-of-sane value (same as Cabal)
315 [[ ${max_jobs} -gt 64 ]] && max_jobs=64
316
317 cabalconf+=(--ghc-option=-j"$max_jobs")
318 fi
308 319
309 # Building GHCi libs on ppc64 causes "TOC overflow". 320 # Building GHCi libs on ppc64 causes "TOC overflow".
310 if use ppc64; then 321 if use ppc64; then
311 cabalconf="${cabalconf} --disable-library-for-ghci" 322 cabalconf+=(--disable-library-for-ghci)
312 fi 323 fi
313 324
314 # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217) 325 # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
315 # so translate LDFLAGS to ghc parameters (without filtering) 326 # so translate LDFLAGS to ghc parameters (without filtering)
316 local flag 327 local flag
317 for flag in $LDFLAGS; do cabalconf="${cabalconf} --ghc-option=-optl$flag"; done 328 for flag in $LDFLAGS; do cabalconf+=(--ghc-option="-optl$flag"); done
318 329
319 # disable executable stripping for the executables, as portage will 330 # disable executable stripping for the executables, as portage will
320 # strip by itself, and pre-stripping gives a QA warning. 331 # strip by itself, and pre-stripping gives a QA warning.
321 # cabal versions previous to 1.4 does not strip executables, and does 332 # cabal versions previous to 1.4 does not strip executables, and does
322 # not accept the flag. 333 # not accept the flag.
323 # this fixes numerous bugs, amongst them; 334 # this fixes numerous bugs, amongst them;
324 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494 335 # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494
325 cabalconf="${cabalconf} --disable-executable-stripping" 336 cabalconf+=(--disable-executable-stripping)
326 337
327 cabalconf="${cabalconf} --docdir=${EPREFIX}/usr/share/doc/${PF}" 338 cabalconf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF})
328 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes 339 # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes
329 # it's better if the configure chatter is in the build logs: 340 # it's better if the configure chatter is in the build logs:
330 cabalconf="${cabalconf} --verbose" 341 cabalconf+=(--verbose)
331 342
332 # We build shared version of our Cabal where ghc ships it's shared 343 # We build shared version of our Cabal where ghc ships it's shared
333 # version of it. We will link ./setup as dynamic binary againt Cabal later. 344 # version of it. We will link ./setup as dynamic binary againt Cabal later.
334 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \ 345 [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \
335 $(ghc-supports-shared-libraries) && \ 346 $(ghc-supports-shared-libraries) && \
336 cabalconf="${cabalconf} --enable-shared" 347 cabalconf+=(--enable-shared)
337 348
338 if $(ghc-supports-shared-libraries); then 349 if $(ghc-supports-shared-libraries); then
339 # maybe a bit lower 350 # maybe a bit lower
340 if $(ghc-supports-dynamic-by-default); then 351 if $(ghc-supports-dynamic-by-default); then
341 cabalconf="${cabalconf} --enable-shared" 352 cabalconf+=(--enable-shared)
342 fi 353 fi
354 fi
355
356 # --sysconfdir appeared in Cabal-1.18+
357 if ./setup configure --help | grep -q -- --sysconfdir; then
358 cabalconf+=(--sysconfdir="${EPREFIX}"/etc)
359 fi
360
361 # appeared in Cabal-1.18+ (see '--disable-executable-stripping')
362 if ./setup configure --help | grep -q -- --disable-library-stripping; then
363 cabalconf+=(--disable-library-stripping)
343 fi 364 fi
344 365
345 set -- configure \ 366 set -- configure \
346 --ghc --prefix="${EPREFIX}"/usr \ 367 --ghc --prefix="${EPREFIX}"/usr \
347 --with-compiler="$(ghc-getghc)" \ 368 --with-compiler="$(ghc-getghc)" \
349 --prefix="${EPREFIX}"/usr \ 370 --prefix="${EPREFIX}"/usr \
350 --libdir="${EPREFIX}"/usr/$(get_libdir) \ 371 --libdir="${EPREFIX}"/usr/$(get_libdir) \
351 --libsubdir=${P}/ghc-$(ghc-version) \ 372 --libsubdir=${P}/ghc-$(ghc-version) \
352 --datadir="${EPREFIX}"/usr/share/ \ 373 --datadir="${EPREFIX}"/usr/share/ \
353 --datasubdir=${P}/ghc-$(ghc-version) \ 374 --datasubdir=${P}/ghc-$(ghc-version) \
354 ${cabalconf} \ 375 "${cabalconf[@]}" \
355 ${CABAL_CONFIGURE_FLAGS} \ 376 ${CABAL_CONFIGURE_FLAGS} \
356 ${CABAL_EXTRA_CONFIGURE_FLAGS} \ 377 ${CABAL_EXTRA_CONFIGURE_FLAGS} \
357 "$@" 378 "$@"
358 echo ./setup "$@" 379 echo ./setup "$@"
359 ./setup "$@" || cabal-show-brokens-and-die "setup configure failed" 380 ./setup "$@" || cabal-show-brokens-and-die "setup configure failed"

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.20