summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/ChangeLog7
-rw-r--r--eclass/ghc-package.eclass17
-rw-r--r--eclass/haskell-cabal.eclass28
3 files changed, 46 insertions, 6 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 8ae87def83f0..d0fbf98d382c 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.819 2013/05/11 11:17:58 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.820 2013/05/11 12:46:32 slyfox Exp $
+
+ 11 May 2013; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass,
+ haskell-cabal.eclass:
+ Added 'ghc-supports-smp' and 'ghc-supports-dynamic-by-default' helpers. Added
+ hint for users to run 'haskell-updater' if configure phase failed.
11 May 2013; Alexis Ballier <aballier@gentoo.org> libtool.eclass:
use find to get file permissions instead of chmod --reference which is not
diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass
index feef71e7e6f3..3a9d3956fa19 100644
--- a/eclass/ghc-package.eclass
+++ b/eclass/ghc-package.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.36 2013/01/06 13:06:35 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.37 2013/05/11 12:46:32 slyfox Exp $
# @ECLASS: ghc-package.eclass
# @MAINTAINER:
@@ -102,6 +102,21 @@ ghc-supports-threaded-runtime() {
$(ghc-getghc) --info | grep "RTS ways" | grep -q "thr"
}
+# @FUNCTION: ghc-supports-smp
+# @DESCRIPTION:
+# checks if ghc is built with support for multiple cores runtime
+ghc-supports-smp() {
+ $(ghc-getghc) --info | grep "Support SMP" | grep -q "YES"
+}
+
+# @FUNCTION: ghc-supports-dynamic-by-default
+# @DESCRIPTION:
+# checks if ghc link against shared haskell libraries by default
+ghc-supports-dynamic-by-default() {
+ $(ghc-getghc) --info | grep "Dynamic by default" | 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 19306c8a89f3..b69fd8fd4a0f 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.39 2013/04/28 16:15:33 zmedico Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.40 2013/05/11 12:46:32 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 ghc-package multilib
+inherit eutils ghc-package multilib
# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
# @DESCRIPTION:
@@ -242,6 +242,26 @@ cabal-hscolour-haddock() {
./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed"
}
+cabal-show-brokens() {
+ # pretty-printer
+ $(ghc-getghcpkg) check 2>&1 \
+ | egrep -v '^Warning: haddock-(html|interfaces): ' \
+ | egrep -v '^Warning: include-dirs: '
+
+ set -- $($(ghc-getghcpkg) check --simple-output)
+ [[ "${#@}" == 0 ]] && return 0
+
+ eerror "Detected broken packages: ${@}"
+
+ die "//==-- Please, run 'haskell-updater' to fix broken packages --==//"
+}
+
+cabal-show-brokens-and-die() {
+ cabal-show-brokens
+
+ die "$@"
+}
+
cabal-configure() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
@@ -306,7 +326,7 @@ cabal-configure() {
if $(ghc-supports-shared-libraries); then
# maybe a bit lower
- if version_is_at_least "7.7.20121114" "$(ghc-version)"; then
+ if $(ghc-supports-dynamic-by-default); then
cabalconf="${cabalconf} --enable-shared"
fi
fi
@@ -325,7 +345,7 @@ cabal-configure() {
${CABAL_EXTRA_CONFIGURE_FLAGS} \
"$@"
echo ./setup "$@"
- ./setup "$@" || die "setup configure failed"
+ ./setup "$@" || cabal-show-brokens-and-die "setup configure failed"
}
cabal-build() {