slyfox      15/08/06 08:20:33

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  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.

Revision  Changes    Path
1.1747               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1747&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1747&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1746&r2=1.1747

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1746
retrieving revision 1.1747
diff -u -r1.1746 -r1.1747
--- ChangeLog   5 Aug 2015 19:23:28 -0000       1.1746
+++ ChangeLog   6 Aug 2015 08:20:33 -0000       1.1747
@@ -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 <[email protected]> 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 <[email protected]> golang-vcs-snapshot.eclass:
   add || die and fix indentation



1.42                 eclass/ghc-package.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.42&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.42&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?r1=1.41&r2=1.42

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- ghc-package.eclass  28 Mar 2015 13:32:40 -0000      1.41
+++ ghc-package.eclass  6 Aug 2015 08:20:33 -0000       1.42
@@ -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 @@
 
 # @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 @@
        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 @@
        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 @@
                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



1.53                 eclass/haskell-cabal.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.53&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.53&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.52&r2=1.53

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- haskell-cabal.eclass        20 Jul 2015 15:05:49 -0000      1.52
+++ haskell-cabal.eclass        6 Aug 2015 08:20:33 -0000       1.53
@@ -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 @@
 
        make_setup() {
                set -- -package "${cabalpackage}" --make "${setupmodule}" \
-                       ${setup_bootstrap_args} \
+                       "${setup_bootstrap_args[@]}" \
                        ${HCFLAGS} \
                        ${GHC_BOOTSTRAP_FLAGS} \
                        "$@" \
@@ -487,12 +487,9 @@
 #     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




Reply via email to