diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2014-02-11 19:00:06 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2014-02-11 19:00:06 +0000 |
commit | 8ffa4aa09bc63f56c5e078737710d8458b2ce653 (patch) | |
tree | 8cbda98d74c049d93d47ace786bab708ef15eebf /eclass | |
parent | Stable for HPPA (bug #470680). (diff) | |
download | gentoo-2-8ffa4aa09bc63f56c5e078737710d8458b2ce653.tar.gz gentoo-2-8ffa4aa09bc63f56c5e078737710d8458b2ce653.tar.bz2 gentoo-2-8ffa4aa09bc63f56c5e078737710d8458b2ce653.zip |
Add support for parallel building (ghc-7.8+). Disable dynamic library stripping and respect --sysconfdir (Cabal-1.18+).
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 7 | ||||
-rw-r--r-- | eclass/ghc-package.eclass | 10 | ||||
-rw-r--r-- | eclass/haskell-cabal.eclass | 59 |
3 files changed, 55 insertions, 21 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index b02d325f833d..de707d54188f 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1140 2014/02/09 08:30:23 pacho Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1141 2014/02/11 19:00:06 slyfox Exp $ + + 11 Feb 2014; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass, + haskell-cabal.eclass: + Add support for parallel building (ghc-7.8+). Disable dynamic library + stripping and respect --sysconfdir (Cabal-1.18+). 09 Feb 2014; Pacho Ramos <pacho@gentoo.org> gnome2-utils.eclass: Drop also values of DGSEAL_ENABLE (#500730) diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass index ec6072d54853..970a8cad8b58 100644 --- a/eclass/ghc-package.eclass +++ b/eclass/ghc-package.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.38 2014/01/19 08:23:36 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.39 2014/02/11 19:00:06 slyfox Exp $ # @ECLASS: ghc-package.eclass # @MAINTAINER: @@ -124,6 +124,14 @@ ghc-supports-interpreter() { $(ghc-getghc) --info | grep "Have interpreter" | grep -q "YES" } +# @FUNCTION: ghc-supports-parallel-make +# @DESCRIPTION: +# checks if ghc has support for '--make -j' mode +# The option was introduced in ghc-7.8-rc1. +ghc-supports-parallel-make() { + $(ghc-getghc) --info | grep "Support parallel --make" | grep -q "YES" +} + # @FUNCTION: ghc-extractportageversion # @DESCRIPTION: # extract the version of a portage-installed package diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass index 2b31d7aad15e..b6c4ea4368ca 100644 --- a/eclass/haskell-cabal.eclass +++ b/eclass/haskell-cabal.eclass @@ -1,6 +1,6 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.42 2013/11/20 09:19:19 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.43 2014/02/11 19:00:06 slyfox Exp $ # @ECLASS: haskell-cabal.eclass # @MAINTAINER: @@ -33,7 +33,7 @@ # on cabal, but still use this eclass (e.g. haskell-updater). # test-suite -- add support for cabal test-suites (introduced in Cabal-1.8) -inherit eutils ghc-package multilib +inherit eutils ghc-package multilib multiprocessing # @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS # @DESCRIPTION: @@ -274,47 +274,58 @@ cabal-show-brokens-and-die() { } cabal-configure() { + local cabalconf=() has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then - cabalconf="${cabalconf} --with-haddock=${EPREFIX}/usr/bin/haddock" + cabalconf+=(--with-haddock=${EPREFIX}/usr/bin/haddock) fi if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then - cabalconf="${cabalconf} --enable-library-profiling" + cabalconf+=(--enable-library-profiling) fi if [[ -n "${CABAL_USE_ALEX}" ]]; then - cabalconf="${cabalconf} --with-alex=${EPREFIX}/usr/bin/alex" + cabalconf+=(--with-alex=${EPREFIX}/usr/bin/alex) fi if [[ -n "${CABAL_USE_HAPPY}" ]]; then - cabalconf="${cabalconf} --with-happy=${EPREFIX}/usr/bin/happy" + cabalconf+=(--with-happy=${EPREFIX}/usr/bin/happy) fi if [[ -n "${CABAL_USE_C2HS}" ]]; then - cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs" + cabalconf+=(--with-c2hs=${EPREFIX}/usr/bin/c2hs) fi if [[ -n "${CABAL_USE_CPPHS}" ]]; then - cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs" + cabalconf+=(--with-cpphs=${EPREFIX}/usr/bin/cpphs) fi if [[ -n "${CABAL_TEST_SUITE}" ]]; then - cabalconf="${cabalconf} $(use_enable test tests)" + cabalconf+=($(use_enable test tests)) fi local option for option in ${HCFLAGS} do - cabalconf+=" --ghc-option=$option" + cabalconf+=(--ghc-option="$option") done + # parallel on all available cores + if ghc-supports-parallel-make; then + local max_jobs=$(makeopts_jobs) + + # limit to sort-of-sane value (same as Cabal) + [[ ${max_jobs} -gt 64 ]] && max_jobs=64 + + cabalconf+=(--ghc-option=-j"$max_jobs") + fi + # Building GHCi libs on ppc64 causes "TOC overflow". if use ppc64; then - cabalconf="${cabalconf} --disable-library-for-ghci" + cabalconf+=(--disable-library-for-ghci) fi # currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217) # so translate LDFLAGS to ghc parameters (without filtering) local flag - for flag in $LDFLAGS; do cabalconf="${cabalconf} --ghc-option=-optl$flag"; done + for flag in $LDFLAGS; do cabalconf+=(--ghc-option="-optl$flag"); done # disable executable stripping for the executables, as portage will # strip by itself, and pre-stripping gives a QA warning. @@ -322,26 +333,36 @@ cabal-configure() { # not accept the flag. # this fixes numerous bugs, amongst them; # bug #251881, bug #251882, bug #251884, bug #251886, bug #299494 - cabalconf="${cabalconf} --disable-executable-stripping" + cabalconf+=(--disable-executable-stripping) - cabalconf="${cabalconf} --docdir=${EPREFIX}/usr/share/doc/${PF}" + cabalconf+=(--docdir="${EPREFIX}"/usr/share/doc/${PF}) # As of Cabal 1.2, configure is quite quiet. For diagnostic purposes # it's better if the configure chatter is in the build logs: - cabalconf="${cabalconf} --verbose" + cabalconf+=(--verbose) # We build shared version of our Cabal where ghc ships it's shared # version of it. We will link ./setup as dynamic binary againt Cabal later. [[ ${CATEGORY}/${PN} == "dev-haskell/cabal" ]] && \ $(ghc-supports-shared-libraries) && \ - cabalconf="${cabalconf} --enable-shared" + cabalconf+=(--enable-shared) if $(ghc-supports-shared-libraries); then # maybe a bit lower if $(ghc-supports-dynamic-by-default); then - cabalconf="${cabalconf} --enable-shared" + cabalconf+=(--enable-shared) fi fi + # --sysconfdir appeared in Cabal-1.18+ + if ./setup configure --help | grep -q -- --sysconfdir; then + cabalconf+=(--sysconfdir="${EPREFIX}"/etc) + fi + + # appeared in Cabal-1.18+ (see '--disable-executable-stripping') + if ./setup configure --help | grep -q -- --disable-library-stripping; then + cabalconf+=(--disable-library-stripping) + fi + set -- configure \ --ghc --prefix="${EPREFIX}"/usr \ --with-compiler="$(ghc-getghc)" \ @@ -351,7 +372,7 @@ cabal-configure() { --libsubdir=${P}/ghc-$(ghc-version) \ --datadir="${EPREFIX}"/usr/share/ \ --datasubdir=${P}/ghc-$(ghc-version) \ - ${cabalconf} \ + "${cabalconf[@]}" \ ${CABAL_CONFIGURE_FLAGS} \ ${CABAL_EXTRA_CONFIGURE_FLAGS} \ "$@" |