summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorDuncan Coutts <dcoutts@gentoo.org>2007-07-25 18:07:02 +0000
committerDuncan Coutts <dcoutts@gentoo.org>2007-07-25 18:07:02 +0000
commit445e07158a6c5a9f348f30f941519d5d9bf1ea65 (patch)
treeac095ffeaf28376932746fbdbe406d3d4d073a74 /eclass
parentalpha stable (diff)
downloadhistorical-445e07158a6c5a9f348f30f941519d5d9bf1ea65.tar.gz
historical-445e07158a6c5a9f348f30f941519d5d9bf1ea65.tar.bz2
historical-445e07158a6c5a9f348f30f941519d5d9bf1ea65.zip
Updates to ghc and cabal eclasses to go with ghc-6.6.x upgrade.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ghc-package.eclass50
-rw-r--r--eclass/haskell-cabal.eclass34
2 files changed, 67 insertions, 17 deletions
diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass
index cdc3da120cc6..31fe7459a8da 100644
--- a/eclass/ghc-package.eclass
+++ b/eclass/ghc-package.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.22 2007/03/13 12:02:04 kosmikus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.23 2007/07/25 18:07:02 dcoutts Exp $
#
# Author: Andres Loeh <kosmikus@gentoo.org>
# Maintained by: Haskell herd <haskell@gentoo.org>
@@ -58,15 +58,11 @@ ghc-cabal() {
# return the best version of the Cabal library that is available
ghc-bestcabalversion() {
- local cabalpackage
local cabalversion
if ghc-cabal; then
# We ask portage, not ghc, so that we only pick up
# portage-installed cabal versions.
- cabalpackage="$(best_version dev-haskell/cabal)"
- cabalversion="${cabalpackage#dev-haskell/cabal-}"
- cabalversion="${cabalversion%-r*}"
- cabalversion="${cabalversion%_pre*}"
+ cabalversion="$(ghc-extractportageversion dev-haskell/cabal)"
echo "Cabal-${cabalversion}"
else
# older ghc's don't support package versioning
@@ -87,6 +83,36 @@ ghc-sanecabal() {
return 1
}
+# checks if ghc and ghc-bin are installed in the same version
+# (if they're both installed); if this is not the case, we
+# unfortunately cannot trust portage's dependency resolution
+ghc-saneghc() {
+ local ghcversion
+ local ghcbinversion
+ if [[ "${PN}" == "ghc" || "${PN}" == "ghc-bin" ]]; then
+ return
+ fi
+ if has_version dev-lang/ghc && has_version dev-lang/ghc-bin; then
+ ghcversion="$(ghc-extractportageversion dev-lang/ghc)"
+ ghcbinversion="$(ghc-extractportageversion dev-lang/ghc-bin)"
+ if [[ "${ghcversion}" != "${ghcbinversion}" ]]; then
+ return 1
+ fi
+ fi
+ return
+}
+
+# extract the version of a portage-installed package
+ghc-extractportageversion() {
+ local pkg
+ local version
+ pkg="$(best_version $1)"
+ version="${pkg#$1-}"
+ version="${version%-r*}"
+ version="${version%_pre*}"
+ echo "${version}"
+}
+
# returns the library directory
_GHC_LIBDIR_CACHE=""
ghc-libdir() {
@@ -252,8 +278,16 @@ ghc-listpkg() {
# exported function: check if we have a consistent ghc installation
ghc-package_pkg_setup() {
- #place holder for sanity check of ghc vs ghc-bin version issues
- return
+ if ! ghc-saneghc; then
+ eerror "You have inconsistent versions of dev-lang/ghc and dev-lang/ghc-bin"
+ eerror "installed. Portage currently cannot work correctly with this setup."
+ eerror "There are several possibilities to work around this problem:"
+ eerror "(1) Up/downgrade ghc-bin to the same version as ghc."
+ eerror "(2) Unmerge ghc-bin."
+ eerror "(3) Unmerge ghc."
+ eerror "You probably want option 1 or 2."
+ die "Inconsistent versions of ghc and ghc-bin."
+ fi
}
# exported function: registers the package-specific package
diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass
index 8826a03bffca..7909461f1210 100644
--- a/eclass/haskell-cabal.eclass
+++ b/eclass/haskell-cabal.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.10 2007/03/13 12:02:04 kosmikus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.11 2007/07/25 18:07:02 dcoutts Exp $
#
# Original authors: Andres Loeh <kosmikus@gentoo.org>
# Duncan Coutts <dcoutts@gentoo.org>
@@ -40,7 +40,7 @@
# Special flags to Cabal Configure can now be set by using
# CABAL_CONFIGURE_FLAGS
-inherit ghc-package
+inherit ghc-package multilib
for feature in ${CABAL_FEATURES}; do
@@ -90,13 +90,14 @@ fi
# We always use a standalone version of Cabal, rather than the one that comes
# with GHC. But of course we can't depend on cabal when building cabal itself.
+CABAL_MIN_VERSION=1.1.4
if [[ -z "${CABAL_BOOTSTRAP}" ]]; then
- DEPEND="${DEPEND} >=dev-haskell/cabal-1.1.3"
+ DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
fi
# Libraries require GHC to be installed.
if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
- RDEPEND="${RDEPEND} virtual/ghc"
+ RDEPEND="${RDEPEND} dev-lang/ghc"
fi
cabal-bootstrap() {
@@ -134,10 +135,21 @@ cabal-configure() {
cabalconf="${cabalconf} --disable-library-for-ghci"
fi
+ # Note: with Cabal-1.1.6.x we still do not have enough control
+ # to put the docs into the right place. They're currently going
+ # into /usr/share/${P}/ghc-x.y/doc/
+ # rather than /usr/share/doc/${PF}/
+ # Because we can only set the datadir, not the docdir.
+
./setup configure \
--ghc --prefix=/usr \
--with-compiler="$(ghc-getghc)" \
--with-hc-pkg="$(ghc-getghcpkg)" \
+ --prefix=/usr \
+ --libdir=/usr/$(get_libdir) \
+ --libsubdir=${P}/ghc-$(ghc-version) \
+ --datadir=/usr/share/ \
+ --datasubdir=${P}/ghc-$(ghc-version) \
${cabalconf} \
${CABAL_CONFIGURE_FLAGS} \
"$@" || die "setup configure failed"
@@ -150,7 +162,7 @@ cabal-build() {
cabal-copy() {
./setup copy \
- --copy-prefix="${D}/usr" \
+ --destdir="${D}" \
|| die "setup copy failed"
# cabal is a bit eager about creating dirs,
@@ -163,6 +175,7 @@ cabal-copy() {
if [[ -d "${D}/usr/bin" ]] ; then
chmod +x "${D}/usr/bin/"*
fi
+ # TODO: do we still need this?
}
cabal-pkg() {
@@ -173,7 +186,7 @@ cabal-pkg() {
local err
if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
- sed -i "s|$(ghc-getghcpkg)|$(type -P true)|" .setup-config
+ sed -i "s|$(ghc-getghcpkg)|$(which true)|" .setup-config
./setup register || die "setup register failed"
if [[ -f .installed-pkg-config ]]; then
ghc-setup-pkg .installed-pkg-config
@@ -187,8 +200,8 @@ cabal-pkg() {
# exported function: check if cabal is correctly installed for
# the currently active ghc (we cannot guarantee this with portage)
haskell-cabal_pkg_setup() {
- ghc-package_pkg_setup
- if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "1.1.3"; then
+ ghc-package_pkg_setup
+ if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
eerror "The package dev-haskell/cabal is not correctly installed for"
eerror "the currently active version of ghc ($(ghc-version)). Please"
eerror "run ghc-updater or re-emerge dev-haskell/cabal."
@@ -222,7 +235,10 @@ cabal_src_install() {
cabal-pkg
if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
- dohtml -r dist/doc/html/*
+ local cabalversion=$(ghc-extractportageversion dev-haskell/cabal)
+ if ! version_is_at_least "1.1.6" "${cabalversion}"; then
+ dohtml -r dist/doc/html/*
+ fi
fi
}
haskell-cabal_src_install() {