diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2015-08-06 08:20:33 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2015-08-06 08:20:33 +0000 |
commit | aae70ff9da28d8bd07656801d34362ba375d98c1 (patch) | |
tree | e2a8493d7148a0358c6a146956b7ff24f936d119 /eclass | |
parent | Fix python implementation deps and urwid-1.3.0 compat (523030, 541936) (diff) | |
download | historical-aae70ff9da28d8bd07656801d34362ba375d98c1.tar.gz historical-aae70ff9da28d8bd07656801d34362ba375d98c1.tar.bz2 historical-aae70ff9da28d8bd07656801d34362ba375d98c1.zip |
Add new helpers: 'ghc-pm-version' to get ghc version as seen by package manager and 'ghc-is-dynamic' to workaround ghc-api bug https://ghc.haskell.org/trac/ghc/ticket/10301 in ebuild.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 8 | ||||
-rw-r--r-- | eclass/ghc-package.eclass | 35 | ||||
-rw-r--r-- | eclass/haskell-cabal.eclass | 11 |
3 files changed, 42 insertions, 12 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 97b7241ad946..77bdc2bf64d5 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for eclass directory # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1746 2015/08/05 19:23:28 williamh Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1747 2015/08/06 08:20:33 slyfox Exp $ + + 06 Aug 2015; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass, + haskell-cabal.eclass: + Add new helpers: 'ghc-pm-version' to get ghc version as seen by package + manager and 'ghc-is-dynamic' to workaround ghc-api bug + https://ghc.haskell.org/trac/ghc/ticket/10301 in ebuild. 05 Aug 2015; William Hubbs <williamh@gentoo.org> golang-vcs-snapshot.eclass: add || die and fix indentation diff --git a/eclass/ghc-package.eclass b/eclass/ghc-package.eclass index 6184a56ffc49..83c8b6ac9432 100644 --- a/eclass/ghc-package.eclass +++ b/eclass/ghc-package.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.41 2015/03/28 13:32:40 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.42 2015/08/06 08:20:33 slyfox Exp $ # @ECLASS: ghc-package.eclass # @MAINTAINER: @@ -64,7 +64,9 @@ ghc-getghcpkgbin() { # @FUNCTION: ghc-version # @DESCRIPTION: -# returns the version of ghc +# returns upstream version of ghc +# as reported by '--numeric-version' +# Examples: "7.10.2", "7.9.20141222" _GHC_VERSION_CACHE="" ghc-version() { if [[ -z "${_GHC_VERSION_CACHE}" ]]; then @@ -73,6 +75,22 @@ ghc-version() { echo "${_GHC_VERSION_CACHE}" } +# @FUNCTION: ghc-pm-version +# @DESCRIPTION: +# returns package manager(PM) version of ghc +# as reported by '$(best_version)' +# Examples: "PM:7.10.2", "PM:7.10.2_rc1", "PM:7.8.4-r4" +_GHC_PM_VERSION_CACHE="" +ghc-pm-version() { + local pm_ghc_p + + if [[ -z "${_GHC_PM_VERSION_CACHE}" ]]; then + pm_ghc_p=$(best_version dev-lang/ghc) + _GHC_PM_VERSION_CACHE="PM:${pm_ghc_p#dev-lang/ghc-}" + fi + echo "${_GHC_PM_VERSION_CACHE}" +} + # @FUNCTION: ghc-cabal-version # @DESCRIPTION: # return version of the Cabal library bundled with ghc @@ -102,6 +120,15 @@ ghc-sanecabal() { done return 1 } +# @FUNCTION: ghc-is-dynamic +# @DESCRIPTION: +# checks if ghc is built against dynamic libraries +# binaries linked against GHC library (and using plugin loading) +# have to be linked the same way: +# https://ghc.haskell.org/trac/ghc/ticket/10301 +ghc-is-dynamic() { + $(ghc-getghc) --info | grep "GHC Dynamic" | grep -q "YES" +} # @FUNCTION: ghc-supports-shared-libraries # @DESCRIPTION: @@ -211,8 +238,8 @@ check-for-collisions() { local collided=`$(ghc-getghcpkgbin) -f ${initial_pkg_db} list --simple-output "${checked_pkg}"` if [[ -n ${collided} ]]; then - eerror "Package ${checked_pkg} is shipped with $(ghc-version)." - eerror "Ebuild author forgot CABAL_CORE_LIB_GHC_PV entry." + eerror "Cabal package '${checked_pkg}' is shipped with '$(ghc-pm-version)' ('$(ghc-version)')." + eerror "Ebuild author forgot an entry in CABAL_CORE_LIB_GHC_PV='${CABAL_CORE_LIB_GHC_PV}'." eerror "Found in ${initial_pkg_db}." die fi diff --git a/eclass/haskell-cabal.eclass b/eclass/haskell-cabal.eclass index 22239bb46eef..e9eceaed0484 100644 --- a/eclass/haskell-cabal.eclass +++ b/eclass/haskell-cabal.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.52 2015/07/20 15:05:49 slyfox Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.53 2015/08/06 08:20:33 slyfox Exp $ # @ECLASS: haskell-cabal.eclass # @MAINTAINER: @@ -203,7 +203,7 @@ cabal-bootstrap() { make_setup() { set -- -package "${cabalpackage}" --make "${setupmodule}" \ - ${setup_bootstrap_args} \ + "${setup_bootstrap_args[@]}" \ ${HCFLAGS} \ ${GHC_BOOTSTRAP_FLAGS} \ "$@" \ @@ -487,12 +487,9 @@ cabal-pkg() { # CABAL_CORE_LIB_GHC_PV="7.10.* PM:7.8.4-r1". cabal-is-dummy-lib() { local bin_ghc_version=$(ghc-version) - local pm_ghc_p=$(best_version dev-lang/ghc) - local pm_ghc_version version + local pm_ghc_version=$(ghc-pm-version) - pm_ghc_version=PM:${pm_ghc_p#dev-lang/ghc-} - - for version in ${CABAL_CORE_LIB_GHC_PV[*]}; do + for version in ${CABAL_CORE_LIB_GHC_PV}; do [[ "${bin_ghc_version}" == ${version} ]] && return 0 [[ "${pm_ghc_version}" == ${version} ]] && return 0 done |