public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2012-04-09 18:08 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2012-04-09 18:08 UTC (permalink / raw
  To: gentoo-commits

slyfox      12/04/09 18:08:45

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Remove outdated bits for <ghc-6.10 and <cabal-1.8. Switch from 'eerror' to 'eqawarn' as suggested by Paweł Hajdan, Jr. (http://www.gossamer-threads.com/lists/gentoo/dev/251259). Install empty '.conf' files for binaries to help 'haskell-updater' pick binaries built with onder haskell toolchain on ghc upgrade.

Revision  Changes    Path
1.208                eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -r1.207 -r1.208
--- ChangeLog	8 Apr 2012 02:29:44 -0000	1.207
+++ ChangeLog	9 Apr 2012 18:08:45 -0000	1.208
@@ -1,6 +1,14 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.207 2012/04/08 02:29:44 tetromino Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.208 2012/04/09 18:08:45 slyfox Exp $
+
+  09 Apr 2012; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass,
+  haskell-cabal.eclass:
+  Remove outdated bits for <ghc-6.10 and <cabal-1.8. Switch from 'eerror' to
+  'eqawarn' as suggested by Paweł Hajdan, Jr.
+  (http://www.gossamer-threads.com/lists/gentoo/dev/251259). Install empty
+  '.conf' files for binaries to help 'haskell-updater' pick binaries built with
+  onder haskell toolchain on ghc upgrade.
 
   08 Apr 2012; Alexandre Rostovtsev <tetromino@gentoo.org> gnome2-utils.eclass:
   Punt stale icon-theme.cache files and empty icon theme directories after



1.33                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- ghc-package.eclass	24 Nov 2011 00:04:13 -0000	1.32
+++ ghc-package.eclass	9 Apr 2012 18:08:45 -0000	1.33
@@ -1,6 +1,6 @@
-# Copyright 1999-2011 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.32 2011/11/24 00:04:13 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.33 2012/04/09 18:08:45 slyfox Exp $
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
@@ -36,17 +36,10 @@
 # because for some reason the global package file
 # must be specified
 ghc-getghcpkgbin() {
-	if version_is_at_least "6.10" "$(ghc-version)"; then
-		# the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
-		# the wrapper script with the static flags
-		echo '[]' > "${T}/empty.conf"
-		echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf"
-	elif ghc-cabal; then
-		echo '[]' > "${T}/empty.conf"
-		echo "$(ghc-libdir)/ghc-pkg.bin" "--global-conf=${T}/empty.conf"
-	else
-		echo "$(ghc-libdir)/ghc-pkg.bin"
-	fi
+	# the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
+	# the wrapper script with the static flags
+	echo '[]' > "${T}/empty.conf"
+	echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf"
 }
 
 # @FUNCTION: ghc-version
@@ -60,30 +53,14 @@
 	echo "${_GHC_VERSION_CACHE}"
 }
 
-# @FUNCTION: ghc-cabal
-# @DESCRIPTION:
-# this function can be used to determine if ghc itself
-# uses the Cabal package format; it has nothing to do
-# with the Cabal libraries ... ghc uses the Cabal package
-# format since version 6.4
-ghc-cabal() {
-	version_is_at_least "6.4" "$(ghc-version)"
-}
-
 # @FUNCTION: ghc-bestcabalversion
 # @DESCRIPTION:
 # return the best version of the Cabal library that is available
 ghc-bestcabalversion() {
-	local cabalversion
-	if ghc-cabal; then
-		# We ask portage, not ghc, so that we only pick up
-		# portage-installed cabal versions.
-		cabalversion="$(ghc-extractportageversion dev-haskell/cabal)"
-		echo "Cabal-${cabalversion}"
-	else
-		# older ghc's don't support package versioning
-		echo Cabal
-	fi
+	# We ask portage, not ghc, so that we only pick up
+	# portage-installed cabal versions.
+	local cabalversion="$(ghc-extractportageversion dev-haskell/cabal)"
+	echo "Cabal-${cabalversion}"
 }
 
 # @FUNCTION: ghc-sanecabal
@@ -101,27 +78,6 @@
 	return 1
 }
 
-# @FUNCTION: ghc-saneghc
-# @DESCRIPTION:
-# 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
-}
-
 # @FUNCTION: ghc-supports-shared-libraries
 # @DESCRIPTION:
 # checks if ghc is built with support for building
@@ -182,14 +138,7 @@
 # @DESCRIPTION:
 # tests if a ghc package exists
 ghc-package-exists() {
-	local describe_flag
-	if version_is_at_least "6.4" "$(ghc-version)"; then
-		describe_flag="describe"
-	else
-		describe_flag="--show-package"
-	fi
-
-	$(ghc-getghcpkg) "${describe_flag}" "$1" > /dev/null 2>&1
+	$(ghc-getghcpkg) describe "$1" > /dev/null 2>&1
 }
 
 # @FUNCTION: ghc-setup-pkg
@@ -201,17 +150,11 @@
 # no arguments are given, the resulting file is
 # empty
 ghc-setup-pkg() {
-	local localpkgconf
-	localpkgconf="${S}/$(ghc-localpkgconf)"
+	local localpkgconf="${S}/$(ghc-localpkgconf)"
 	echo '[]' > "${localpkgconf}"
-	local update_flag
-	if version_is_at_least "6.4" "$(ghc-version)"; then
-		update_flag="update -"
-	else
-		update_flag="--update-package"
-	fi
+
 	for pkg in $*; do
-		$(ghc-getghcpkgbin) -f "${localpkgconf}" ${update_flag} --force \
+		$(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \
 			< "${pkg}" || die "failed to register ${pkg}"
 	done
 }
@@ -242,22 +185,13 @@
 # registers all packages in the local (package-specific)
 # package configuration file
 ghc-register-pkg() {
-	local localpkgconf
-	localpkgconf="$(ghc-confdir)/$1"
-	local update_flag
-	local describe_flag
-	if version_is_at_least "6.4" "$(ghc-version)"; then
-		update_flag="update -"
-		describe_flag="describe"
-	else
-		update_flag="--update-package"
-		describe_flag="--show-package"
-	fi
+	local localpkgconf="$(ghc-confdir)/$1"
+
 	if [[ -f "${localpkgconf}" ]]; then
 		for pkg in $(ghc-listpkg "${localpkgconf}"); do
 			ebegin "Registering ${pkg} "
-			$(ghc-getghcpkgbin) -f "${localpkgconf}" "${describe_flag}" "${pkg}" \
-				| $(ghc-getghcpkg) ${update_flag} --force > /dev/null
+			$(ghc-getghcpkgbin) -f "${localpkgconf}" describe "${pkg}" \
+				| $(ghc-getghcpkg) update - --force > /dev/null
 			eend $?
 		done
 	fi
@@ -286,17 +220,9 @@
 # protected are all packages that are still contained in
 # another package configuration file
 ghc-unregister-pkg() {
-	local localpkgconf
+	local localpkgconf="$(ghc-confdir)/$1"
 	local i
 	local pkg
-	local unregister_flag
-	localpkgconf="$(ghc-confdir)/$1"
-
-	if version_is_at_least "6.4" "$(ghc-version)"; then
-		unregister_flag="unregister"
-	else
-		unregister_flag="--remove-package"
-	fi
 
 	if [[ -f "${localpkgconf}" ]]; then
 		for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
@@ -304,7 +230,7 @@
 			einfo "Package ${pkg} is not installed for ghc-$(ghc-version)."
 		  else
 			ebegin "Unregistering ${pkg} "
-			$(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null
+			$(ghc-getghcpkg) unregister "${pkg}" --force > /dev/null
 			eend $?
 		  fi
 		done
@@ -345,36 +271,14 @@
 		extra_flags="${extra_flags} -v0"
 	fi
 	for i in $*; do
-		if ghc-cabal; then
-			echo $($(ghc-getghcpkg) list ${extra_flags} -f "${i}") \
-				| sed \
-					-e "s|^.*${i}:\([^:]*\).*$|\1|" \
-					-e "s|/.*$||" \
-					-e "s|,| |g" -e "s|[(){}]||g"
-		else
-			echo $($(ghc-getghcpkgbin) -l -f "${i}") \
-				| cut -f2 -d':' \
-				| sed 's:,: :g'
-		fi
+		echo $($(ghc-getghcpkg) list ${extra_flags} -f "${i}") \
+			| sed \
+				-e "s|^.*${i}:\([^:]*\).*$|\1|" \
+				-e "s|/.*$||" \
+				-e "s|,| |g" -e "s|[(){}]||g"
 	done
 }
 
-# @FUNCTION: ghc-package_pkg_setup
-# @DESCRIPTION:
-# exported function: check if we have a consistent ghc installation
-ghc-package_pkg_setup() {
-	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
-}
-
 # @FUNCTION: ghc-package_pkg_postinst
 # @DESCRIPTION:
 # exported function: registers the package-specific package
@@ -393,4 +297,4 @@
 	ghc-unregister-pkg "$(ghc-localpkgconf)"
 }
 
-EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm
+EXPORT_FUNCTIONS pkg_postinst pkg_prerm



1.29                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- haskell-cabal.eclass	9 Mar 2012 22:01:11 -0000	1.28
+++ haskell-cabal.eclass	9 Apr 2012 18:08:45 -0000	1.29
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.28 2012/03/09 22:01:11 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.29 2012/04/09 18:08:45 slyfox Exp $
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
@@ -30,19 +30,6 @@
 #   nocabaldep --  don't add dependency on cabal.
 #                  only used for packages that _must_ not pull the dependency
 #                  on cabal, but still use this eclass (e.g. haskell-updater).
-#
-# Dependencies on other cabal packages have to be specified
-# correctly.
-#
-# Cabal libraries should usually be SLOTted with "${PV}".
-#
-# Many Cabal packages require S to be manually set.
-#
-# Conforming Cabal packages don't require any function definitions
-# in the ebuild.
-#
-# Special flags to Cabal Configure can now be set by using
-# CABAL_CONFIGURE_FLAGS
 
 inherit ghc-package multilib
 
@@ -165,22 +152,15 @@
 	local cabalpackage
 	if [[ -f "${S}/Setup.lhs" ]]; then
 		setupmodule="${S}/Setup.lhs"
+	elif [[ -f "${S}/Setup.hs" ]]; then
+		setupmodule="${S}/Setup.hs"
 	else
-		if [[ -f "${S}/Setup.hs" ]]; then
-			setupmodule="${S}/Setup.hs"
-		else
-			die "No Setup.lhs or Setup.hs found"
-		fi
+		die "No Setup.lhs or Setup.hs found"
 	fi
 
 	# We build the setup program using the latest version of
 	# cabal that we have installed
-	if version_is_at_least "6.4" "$(ghc-version)"; then
-		cabalpackage=Cabal-$(cabal-version)
-	else
-		# older ghc's don't support package versioning
-		cabalpackage=Cabal
-	fi
+	cabalpackage=Cabal-$(cabal-version)
 	einfo "Using cabal-$(cabal-version)."
 
 	make_setup() {
@@ -212,7 +192,7 @@
 	rm -f "${setupdir}"/Setup.{lhs,hs}
 
 	echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
-		> $setupdir/Setup.hs
+		> $setupdir/Setup.hs || die "failed to create default Setup.hs"
 }
 
 cabal-hscolour() {
@@ -274,27 +254,18 @@
 	local flag
 	for flag in $LDFLAGS; do cabalconf="${cabalconf} --ghc-option=-optl$flag"; done
 
-	if version_is_at_least "1.4" "$(cabal-version)"; then
-		# disable executable stripping for the executables, as portage will
-		# strip by itself, and pre-stripping gives a QA warning.
-		# cabal versions previous to 1.4 does not strip executables, and does
-		# 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"
-	fi
-
-	if version_is_at_least "1.2.0" "$(cabal-version)"; then
-		cabalconf="${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"
-	fi
-	# Note: with Cabal-1.1.6.x we 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.
+	# disable executable stripping for the executables, as portage will
+	# strip by itself, and pre-stripping gives a QA warning.
+	# cabal versions previous to 1.4 does not strip executables, and does
+	# 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="${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"
 
 	# 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.
@@ -337,42 +308,18 @@
 	# cabal is a bit eager about creating dirs,
 	# so remove them if they are empty
 	rmdir "${ED}/usr/bin" 2> /dev/null
-
-	# GHC 6.4 has a bug in get/setPermission and Cabal 1.1.1 has
-	# no workaround.
-	# set the +x permission on executables
-	if [[ -d "${ED}/usr/bin" ]] ; then
-		chmod +x "${ED}/usr/bin/"*
-	fi
-	# TODO: do we still need this?
 }
 
 cabal-pkg() {
 	# This does not actually register since we're using true instead
-	# of ghc-pkg. So it just leaves the .installed-pkg-config and we can
+	# of ghc-pkg. So it just leaves the .conf file and we can
 	# register that ourselves (if it exists).
-	local result
-	local err
 
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
-		if version_is_at_least "1.2.0" "$(cabal-version)"; then
-			# Newer cabal can generate a package conf for us:
-			./setup register --gen-pkg-config="${T}/${P}.conf"
-			ghc-setup-pkg "${T}/${P}.conf"
-			ghc-install-pkg
-		else
-			# With older cabal we have to hack it by replacing its ghc-pkg
-			# with true and then just picking up the .installed-pkg-config
-			# file and registering that ourselves (if it exists).
-			sed -i "s|$(ghc-getghcpkg)|$(type -P true)|" .setup-config
-			./setup register || die "setup register failed"
-			if [[ -f .installed-pkg-config ]]; then
-				ghc-setup-pkg .installed-pkg-config
-				ghc-install-pkg
-			else
-				die "setup register has not generated a package configuration file"
-			fi
-		fi
+		# Newer cabal can generate a package conf for us:
+		./setup register --gen-pkg-config="${T}/${P}.conf"
+		ghc-setup-pkg "${T}/${P}.conf"
+		ghc-install-pkg
 	fi
 }
 
@@ -394,18 +341,17 @@
 # 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}" && -z "${CABAL_FROM_GHC}" ]] && ! 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 haskell-updater or re-build dev-haskell/cabal."
+		eerror "run haskell-updater or re-build dev-haskell/cabal."
 		die "cabal is not correctly installed"
 	fi
 	if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
-		eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
+		eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES."
 	fi
 	if [[ -n "${CABAL_UNKNOWN}" ]]; then
-		ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
+		eqawarn "QA Notice: Unknown entry in CABAL_FEATURES: ${CABAL_UNKNOWN}"
 	fi
 	if cabal-is-dummy-lib; then
 		einfo "${P} is included in ghc-${CABAL_CORE_LIB_GHC_PV}, nothing to install."
@@ -413,15 +359,15 @@
 }
 
 haskell-cabal_src_configure() {
-	if ! cabal-is-dummy-lib; then
-		pushd "${S}" > /dev/null
+	cabal-is-dummy-lib && return
 
-		cabal-bootstrap
+	pushd "${S}" > /dev/null
 
-		cabal-configure "$@"
+	cabal-bootstrap
 
-		popd > /dev/null
-	fi
+	cabal-configure "$@"
+
+	popd > /dev/null
 }
 
 # exported function: nice alias
@@ -438,27 +384,27 @@
 		local passed_flag
 		for passed_flag in "$@"; do
 			[[ ${passed_flag} == --flags=* ]] && \
-				eqawarn "Cabal option '${passed_flag}' has effect only in src_configure()"
+				eqawarn "QA Notice: Cabal option '${passed_flag}' has effect only in src_configure()"
 		done
 	fi
 
-	if ! cabal-is-dummy-lib; then
-		has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
-		cabal-build
+	cabal-is-dummy-lib && return
 
-		if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
-			if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
-				# hscolour and haddock
-				cabal-hscolour-haddock
-			else
-				# just haddock
-				cabal-haddock
-			fi
+	has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
+	cabal-build
+
+	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
+		if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
+			# hscolour and haddock
+			cabal-hscolour-haddock
 		else
-			if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
-				# just hscolour
-				cabal-hscolour
-			fi
+			# just haddock
+			cabal-haddock
+		fi
+	else
+		if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
+			# just hscolour
+			cabal-hscolour
 		fi
 	fi
 }
@@ -490,22 +436,18 @@
 cabal_src_install() {
 	has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
 
-	if cabal-is-dummy-lib; then
-		# create a dummy local package conf file for the sake of ghc-updater
-		local ghc_confdir_with_prefix="$(ghc-confdir)"
-		# remove EPREFIX
-		dodir ${ghc_confdir_with_prefix#${EPREFIX}}
-		echo '[]' > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
-	else
+	if ! cabal-is-dummy-lib; then
 		cabal-copy
 		cabal-pkg
-
-		if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
-			if ! version_is_at_least "1.1.6" "$(cabal-version)"; then
-				dohtml -r dist/doc/html/*
-			fi
-		fi
 	fi
+
+	# create a dummy local package conf file for haskell-updater
+	# if it does not exist (dummy libraries and binaries w/o libraries)
+	local ghc_confdir_with_prefix="$(ghc-confdir)"
+	# remove EPREFIX
+	dodir ${ghc_confdir_with_prefix#${EPREFIX}}
+	local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
+	[[ -e $conf_file ]] || echo '[]' > "$conf_file" || die
 }
 
 haskell-cabal_src_install() {






^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2012-11-16 15:47 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2012-11-16 15:47 UTC (permalink / raw
  To: gentoo-commits

slyfox      12/11/16 15:47:17

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Restore dynamic linking of Cabal's ./setup and add building of shared libraries for ghc-7.7+.

Revision  Changes    Path
1.508                eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.507
retrieving revision 1.508
diff -u -r1.507 -r1.508
--- ChangeLog	15 Nov 2012 20:06:34 -0000	1.507
+++ ChangeLog	16 Nov 2012 15:47:17 -0000	1.508
@@ -1,6 +1,11 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.507 2012/11/15 20:06:34 scarabeus Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.508 2012/11/16 15:47:17 slyfox Exp $
+
+  16 Nov 2012; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass,
+  haskell-cabal.eclass:
+  Restore dynamic linking of Cabal's ./setup and add building of shared
+  libraries for ghc-7.7+.
 
   15 Nov 2012; Tomáš Chvátal <scarabeus@gentoo.org> obs-service.eclass:
   Depend on suse-build as most services require it.



1.35                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ghc-package.eclass	14 Sep 2012 02:51:23 -0000	1.34
+++ ghc-package.eclass	16 Nov 2012 15:47:17 -0000	1.35
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.34 2012/09/14 02:51:23 gienah Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.35 2012/11/16 15:47:17 slyfox Exp $
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
@@ -39,7 +39,11 @@
 	# the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
 	# the wrapper script with the static flags
 	echo '[]' > "${T}/empty.conf"
-	if version_is_at_least "7.5.20120516" "$(ghc-version)"; then
+	if version_is_at_least "7.7.20121101" "$(ghc-version)"; then
+		# was moved to bin/ subtree by:
+		# http://www.haskell.org/pipermail/cvs-ghc/2012-September/076546.html
+		echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${T}/empty.conf"
+	elif version_is_at_least "7.5.20120516" "$(ghc-version)"; then
 		echo "$(ghc-libdir)/ghc-pkg" "--global-package-db=${T}/empty.conf"
 	else
 		echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf"



1.35                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- haskell-cabal.eclass	27 Sep 2012 16:35:41 -0000	1.34
+++ haskell-cabal.eclass	16 Nov 2012 15:47:17 -0000	1.35
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.34 2012/09/27 16:35:41 axs Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.35 2012/11/16 15:47:17 slyfox Exp $
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
@@ -19,6 +19,7 @@
 # Currently supported features:
 #   haddock    --  for documentation generation
 #   hscolour   --  generation of colourised sources
+#   hoogle     --  generation of documentation search index
 #   alex       --  lexer/scanner generator
 #   happy      --  parser generator
 #   c2hs       --  C interface generator
@@ -187,9 +188,19 @@
 	if $(ghc-supports-shared-libraries); then
 		# # some custom build systems might use external libraries,
 		# # for which we don't have shared libs, so keep static fallback
-		# Disabled '-dynamic' as ghc does not embed RPATH to used extra-libraries:
 		# bug #411789, http://hackage.haskell.org/trac/ghc/ticket/5743#comment:3
-		# make_setup -dynamic "$@" ||
+		# http://hackage.haskell.org/trac/ghc/ticket/7062
+		# http://hackage.haskell.org/trac/ghc/ticket/3072
+		# ghc does not set RPATH for extralibs, thus we do it ourselves by hands
+		einfo "Prepending $(ghc-libdir) to LD_LIBRARY_PATH"
+		if [[ ${CHOST} != *-darwin* ]]; then
+			LD_LIBRARY_PATH="$(ghc-libdir)${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
+			export LD_LIBRARY_PATH
+		else
+			DYLD_LIBRARY_PATH="$(ghc-libdir)${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
+			export DYLD_LIBRARY_PATH
+		fi
+		{ make_setup -dynamic "$@" && ./setup --help >/dev/null; } ||
 		make_setup "$@" || die "compiling ${setupmodule} failed"
 	else
 		make_setup "$@" || die "compiling ${setupmodule} failed"
@@ -292,6 +303,13 @@
 		$(ghc-supports-shared-libraries) && \
 			cabalconf="${cabalconf} --enable-shared"
 
+	if $(ghc-supports-shared-libraries); then
+		# maybe a bit lower
+		if version_is_at_least "7.7.20121114" "$(ghc-version)"; then
+			cabalconf="${cabalconf} --enable-shared"
+		fi
+	fi
+
 	set -- configure \
 		--ghc --prefix="${EPREFIX}"/usr \
 		--with-compiler="$(ghc-getghc)" \





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2013-01-06 13:06 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2013-01-06 13:06 UTC (permalink / raw
  To: gentoo-commits

slyfox      13/01/06 13:06:35

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Added 'ghc-supports-threaded-runtime' function. Removed implicit RDEPEND on 'ghc'.

Revision  Changes    Path
1.602                eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.601
retrieving revision 1.602
diff -u -r1.601 -r1.602
--- ChangeLog	5 Jan 2013 10:02:44 -0000	1.601
+++ ChangeLog	6 Jan 2013 13:06:35 -0000	1.602
@@ -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.601 2013/01/05 10:02:44 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.602 2013/01/06 13:06:35 slyfox Exp $
+
+  06 Jan 2013; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass,
+  haskell-cabal.eclass:
+  Added 'ghc-supports-threaded-runtime' function. Removed implicit RDEPEND on
+  'ghc'.
 
   05 Jan 2013; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
   Support overriding job-count for parallel build.



1.36                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- ghc-package.eclass	16 Nov 2012 15:47:17 -0000	1.35
+++ ghc-package.eclass	6 Jan 2013 13:06:35 -0000	1.36
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# 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.35 2012/11/16 15:47:17 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.36 2013/01/06 13:06:35 slyfox Exp $
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
@@ -94,6 +94,14 @@
 	$(ghc-getghc) --info | grep "RTS ways" | grep -q "dyn"
 }
 
+# @FUNCTION: ghc-supports-threaded-runtime
+# @DESCRIPTION:
+# checks if ghc is built with support for threaded
+# runtime (aka '-threaded' option)
+ghc-supports-threaded-runtime() {
+	$(ghc-getghc) --info | grep "RTS ways" | grep -q "thr"
+}
+
 # @FUNCTION: ghc-extractportageversion
 # @DESCRIPTION:
 # extract the version of a portage-installed package



1.38                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- haskell-cabal.eclass	19 Nov 2012 21:27:56 -0000	1.37
+++ haskell-cabal.eclass	6 Jan 2013 13:06:35 -0000	1.38
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# 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.37 2012/11/19 21:27:56 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.38 2013/01/06 13:06:35 slyfox Exp $
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
@@ -134,11 +134,6 @@
 	DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
 fi
 
-# Libraries require GHC to be installed.
-if [[ -n "${CABAL_HAS_LIBRARIES}" ]]; then
-	RDEPEND="${RDEPEND} dev-lang/ghc"
-fi
-
 # returns the version of cabal currently in use
 _CABAL_VERSION_CACHE=""
 cabal-version() {
@@ -384,6 +379,9 @@
 # exported function: check if cabal is correctly installed for
 # the currently active ghc (we cannot guarantee this with portage)
 haskell-cabal_pkg_setup() {
+	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
+		[[ ${RDEPEND} == *dev-lang/ghc* ]] || eqawarn "QA Notice: A library does not have runtime dependency on dev-lang/ghc."
+	fi
 	if [[ -z "${CABAL_HAS_BINARIES}" ]] && [[ -z "${CABAL_HAS_LIBRARIES}" ]]; then
 		eqawarn "QA Notice: Neither bin nor lib are in CABAL_FEATURES."
 	fi
@@ -514,6 +512,8 @@
 	popd > /dev/null
 }
 
+# @FUNCTION: cabal_flag
+# @DESCRIPTION:
 # ebuild.sh:use_enable() taken as base
 #
 # Usage examples:





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2013-05-11 12:46 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2013-05-11 12:46 UTC (permalink / raw
  To: gentoo-commits

slyfox      13/05/11 12:46:32

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Added 'ghc-supports-smp' and 'ghc-supports-dynamic-by-default' helpers. Added hint for users to run 'haskell-updater' if configure phase failed.

Revision  Changes    Path
1.820                eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.819
retrieving revision 1.820
diff -u -r1.819 -r1.820
--- ChangeLog	11 May 2013 11:17:58 -0000	1.819
+++ ChangeLog	11 May 2013 12:46:32 -0000	1.820
@@ -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



1.37                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- ghc-package.eclass	6 Jan 2013 13:06:35 -0000	1.36
+++ ghc-package.eclass	11 May 2013 12:46:32 -0000	1.37
@@ -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-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



1.40                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- haskell-cabal.eclass	28 Apr 2013 16:15:33 -0000	1.39
+++ haskell-cabal.eclass	11 May 2013 12:46:32 -0000	1.40
@@ -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 @@
 	./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 @@
 
 	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_EXTRA_CONFIGURE_FLAGS} \
 		"$@"
 	echo ./setup "$@"
-	./setup "$@" || die "setup configure failed"
+	./setup "$@" || cabal-show-brokens-and-die "setup configure failed"
 }
 
 cabal-build() {





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2014-02-11 19:00 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2014-02-11 19:00 UTC (permalink / raw
  To: gentoo-commits

slyfox      14/02/11 19:00:07

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Add support for parallel building (ghc-7.8+). Disable dynamic library stripping and respect --sysconfdir (Cabal-1.18+).

Revision  Changes    Path
1.1141               eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1140
retrieving revision 1.1141
diff -u -r1.1140 -r1.1141
--- ChangeLog	9 Feb 2014 08:30:23 -0000	1.1140
+++ ChangeLog	11 Feb 2014 19:00:06 -0000	1.1141
@@ -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)



1.39                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- ghc-package.eclass	19 Jan 2014 08:23:36 -0000	1.38
+++ ghc-package.eclass	11 Feb 2014 19:00:06 -0000	1.39
@@ -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-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



1.43                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- haskell-cabal.eclass	20 Nov 2013 09:19:19 -0000	1.42
+++ haskell-cabal.eclass	11 Feb 2014 19:00:06 -0000	1.43
@@ -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-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 @@
 	# 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 @@
 		--libsubdir=${P}/ghc-$(ghc-version) \
 		--datadir="${EPREFIX}"/usr/share/ \
 		--datasubdir=${P}/ghc-$(ghc-version) \
-		${cabalconf} \
+		"${cabalconf[@]}" \
 		${CABAL_CONFIGURE_FLAGS} \
 		${CABAL_EXTRA_CONFIGURE_FLAGS} \
 		"$@"





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2015-01-01 21:23 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2015-01-01 21:23 UTC (permalink / raw
  To: gentoo-commits

slyfox      15/01/01 21:23:03

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Add support for ghc-7.10 registration. User visible changes: ghc-package stopped exporting pkg_* phases and now they are reexported by haskell-cabal. pkg_* phases do not install any additional files anymore.

Revision  Changes    Path
1.1492               eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1491
retrieving revision 1.1492
diff -u -r1.1491 -r1.1492
--- ChangeLog	1 Jan 2015 21:09:28 -0000	1.1491
+++ ChangeLog	1 Jan 2015 21:23:03 -0000	1.1492
@@ -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.1491 2015/01/01 21:09:28 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1492 2015/01/01 21:23:03 slyfox Exp $
+
+  01 Jan 2015; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass,
+  haskell-cabal.eclass:
+  Add support for ghc-7.10 registration. User visible changes: ghc-package
+  stopped exporting pkg_* phases and now they are reexported by haskell-cabal.
+  pkg_* phases do not install any additional files anymore.
 
   01 Jan 2015; Sergei Trofimovich <slyfox@gentoo.org> darcs.eclass:
   Fix patch count on first clone (by vikraman).



1.40                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- ghc-package.eclass	11 Feb 2014 19:00:06 -0000	1.39
+++ ghc-package.eclass	1 Jan 2015 21:23:03 -0000	1.40
@@ -1,6 +1,6 @@
-# Copyright 1999-2014 Gentoo Foundation
+# 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.39 2014/02/11 19:00:06 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.40 2015/01/01 21:23:03 slyfox Exp $
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
@@ -36,16 +36,28 @@
 # because for some reason the global package file
 # must be specified
 ghc-getghcpkgbin() {
-	# the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
-	# the wrapper script with the static flags
-	echo '[]' > "${T}/empty.conf"
-	if version_is_at_least "7.7.20121101" "$(ghc-version)"; then
+	if version_is_at_least "7.9.20141222" "$(ghc-version)"; then
+		# ghc-7.10 stopped supporting single-file database
+		local empty_db="${T}/empty.conf.d" ghc_pkg="$(ghc-libdir)/bin/ghc-pkg"
+		if [[ ! -d ${empty_db} ]]; then
+			"${ghc_pkg}" init "${empty_db}" || die "Failed to initialize empty global db"
+		fi
+		echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${empty_db}"
+
+	elif version_is_at_least "7.7.20121101" "$(ghc-version)"; then
+		# the ghc-pkg executable changed name in ghc 6.10, as it no longer needs
+		# the wrapper script with the static flags
 		# was moved to bin/ subtree by:
 		# http://www.haskell.org/pipermail/cvs-ghc/2012-September/076546.html
+		echo '[]' > "${T}/empty.conf"
 		echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${T}/empty.conf"
+
 	elif version_is_at_least "7.5.20120516" "$(ghc-version)"; then
+		echo '[]' > "${T}/empty.conf"
 		echo "$(ghc-libdir)/ghc-pkg" "--global-package-db=${T}/empty.conf"
+
 	else
+		echo '[]' > "${T}/empty.conf"
 		echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf"
 	fi
 }
@@ -61,14 +73,19 @@
 	echo "${_GHC_VERSION_CACHE}"
 }
 
-# @FUNCTION: ghc-bestcabalversion
+# @FUNCTION: ghc-cabal-version
 # @DESCRIPTION:
-# return the best version of the Cabal library that is available
-ghc-bestcabalversion() {
-	# We ask portage, not ghc, so that we only pick up
-	# portage-installed cabal versions.
-	local cabalversion="$(ghc-extractportageversion dev-haskell/cabal)"
-	echo "Cabal-${cabalversion}"
+# return version of the Cabal library bundled with ghc
+ghc-cabal-version() {
+	if version_is_at_least "7.9.20141222" "$(ghc-version)"; then
+		# outputs in format: 'version: 1.18.1.5'
+		set -- `$(ghc-getghcpkg) --package-db=$(ghc-libdir)/package.conf.d.initial field Cabal version`
+		echo "$2"
+	else
+		local cabal_package=`echo "$(ghc-libdir)"/Cabal-*`
+		# /path/to/ghc/Cabal-${VER} -> ${VER}
+		echo "${cabal_package/*Cabal-/}"
+	fi
 }
 
 # @FUNCTION: ghc-sanecabal
@@ -158,26 +175,26 @@
 
 # @FUNCTION: ghc-confdir
 # @DESCRIPTION:
-# returns the (Gentoo) library configuration directory
+# returns the (Gentoo) library configuration directory, we
+# store here a hint for 'haskell-updater' about packages
+# installed for old ghc versions and current ones.
 ghc-confdir() {
 	echo "$(ghc-libdir)/gentoo"
 }
 
-# @FUNCTION: ghc-localpkgconf
+# @FUNCTION: ghc-package-db
 # @DESCRIPTION:
-# returns the name of the local (package-specific)
-# package configuration file
-ghc-localpkgconf() {
-	echo "${PF}.conf"
+# returns the global package database directory
+ghc-package-db() {
+	echo "$(ghc-libdir)/package.conf.d"
 }
 
-# @FUNCTION: ghc-makeghcilib
+# @FUNCTION: ghc-localpkgconfd
 # @DESCRIPTION:
-# make a ghci foo.o file from a libfoo.a file
-ghc-makeghcilib() {
-	local outfile
-	outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')"
-	ld --relocatable --discard-all --output="${outfile}" --whole-archive "$1"
+# returns the name of the local (package-specific)
+# package configuration file
+ghc-localpkgconfd() {
+	echo "${PF}.conf.d"
 }
 
 # @FUNCTION: ghc-package-exists
@@ -187,43 +204,61 @@
 	$(ghc-getghcpkg) describe "$1" > /dev/null 2>&1
 }
 
-# @FUNCTION: ghc-setup-pkg
-# @DESCRIPTION:
-# creates a local (package-specific) package
-# configuration file; the arguments should be
-# uninstalled package description files, each
-# containing a single package description; if
-# no arguments are given, the resulting file is
-# empty
-ghc-setup-pkg() {
-	local localpkgconf="${S}/$(ghc-localpkgconf)"
-	echo '[]' > "${localpkgconf}"
-
-	for pkg in $*; do
-		$(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \
-			< "${pkg}" || die "failed to register ${pkg}"
+# @FUNCTION: check-for-collisions
+# @DESCRIPTION: makes sure no packages
+# have the same version as initial package setup
+check-for-collisions() {
+	local localpkgconf=$1
+	local checked_pkg
+	local initial_pkg_db="$(ghc-libdir)/package.conf.d.initial"
+
+	for checked_pkg in `$(ghc-getghcpkgbin) -f "${localpkgconf}" list --simple-output`
+	do
+		# should return empty output
+		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 "Found in ${initial_pkg_db}."
+			die
+		fi
 	done
 }
 
-# @FUNCTION: ghc-fixlibpath
-# @DESCRIPTION:
-# fixes the library and import directories path
-# of the package configuration file
-ghc-fixlibpath() {
-	sed -i "s|$1|$(ghc-libdir)|g" "${S}/$(ghc-localpkgconf)"
-	if [[ -n "$2" ]]; then
-		sed -i "s|$2|$(ghc-libdir)/imports|g" "${S}/$(ghc-localpkgconf)"
-	fi
-}
-
 # @FUNCTION: ghc-install-pkg
 # @DESCRIPTION:
 # moves the local (package-specific) package configuration
 # file to its final destination
 ghc-install-pkg() {
-	mkdir -p "${D}/$(ghc-confdir)"
-	cat "${S}/$(ghc-localpkgconf)" | sed "s|${D}||g" \
-		> "${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
+	local pkg_config_file=$1
+	local localpkgconf="${T}/$(ghc-localpkgconfd)"
+	local pkg_path pkg pkg_db="${D}/$(ghc-package-db)" hint_db="${D}/$(ghc-confdir)"
+
+	$(ghc-getghcpkgbin) init "${localpkgconf}" || die "Failed to initialize empty local db"
+	$(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \
+		< "${pkg_config_file}" || die "failed to register ${pkg}"
+
+	check-for-collisions "${localpkgconf}"
+
+	mkdir -p "${pkg_db}" || die
+	for pkg_path in "${localpkgconf}"/*.conf; do
+		pkg=$(basename "${pkg_path}")
+		cp "${pkg_path}" "${pkg_db}/${pkg}" || die
+	done
+
+	mkdir -p "${hint_db}" || die
+	cp "${pkg_config_file}" "${hint_db}/${PF}.conf" || die
+	chmod 0644 "${hint_db}/${PF}.conf" || die
+}
+
+# @FUNCTION: ghc-recache-db
+# @DESCRIPTION:
+# updates 'package.cache' binary cacne for registered '*.conf'
+# packages
+ghc-recache-db() {
+	einfo "Recaching GHC package DB"
+	$(ghc-getghcpkg) recache
 }
 
 # @FUNCTION: ghc-register-pkg
@@ -231,16 +266,7 @@
 # registers all packages in the local (package-specific)
 # package configuration file
 ghc-register-pkg() {
-	local localpkgconf="$(ghc-confdir)/$1"
-
-	if [[ -f "${localpkgconf}" ]]; then
-		for pkg in $(ghc-listpkg "${localpkgconf}"); do
-			ebegin "Registering ${pkg} "
-			$(ghc-getghcpkgbin) -f "${localpkgconf}" describe "${pkg}" \
-				| $(ghc-getghcpkg) update - --force > /dev/null
-			eend $?
-		done
-	fi
+	ghc-recache-db
 }
 
 # @FUNCTION: ghc-reregister
@@ -248,99 +274,46 @@
 # re-adds all available .conf files to the global
 # package conf file, to be used on a ghc reinstallation
 ghc-reregister() {
-	has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-	einfo "Re-adding packages (may cause several harmless warnings) ..."
-	PATH="${EPREFIX}/usr/bin:${PATH}" CONFDIR="$(ghc-confdir)"
-	if [ -d "${CONFDIR}" ]; then
-		pushd "${CONFDIR}" > /dev/null
-		for conf in *.conf; do
-			PATH="${EPREFIX}/usr/bin:${PATH}" ghc-register-pkg "${conf}"
-		done
-		popd > /dev/null
-	fi
+	ghc-recache-db
 }
 
 # @FUNCTION: ghc-unregister-pkg
 # @DESCRIPTION:
 # unregisters a package configuration file
-# protected are all packages that are still contained in
-# another package configuration file
 ghc-unregister-pkg() {
-	local localpkgconf="$(ghc-confdir)/$1"
-	local i
-	local pkg
-
-	if [[ -f "${localpkgconf}" ]]; then
-		for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
-		  if ! ghc-package-exists "${pkg}"; then
-			einfo "Package ${pkg} is not installed for ghc-$(ghc-version)."
-		  else
-			ebegin "Unregistering ${pkg} "
-			$(ghc-getghcpkg) unregister "${pkg}" --force > /dev/null
-			eend $?
-		  fi
-		done
-	fi
-}
-
-# @FUNCTION: ghc-reverse
-# @DESCRIPTION:
-# help-function: reverse a list
-ghc-reverse() {
-	local result
-	local i
-	for i in $1; do
-		result="${i} ${result}"
-	done
-	echo "${result}"
+	ghc-recache-db
 }
 
-# @FUNCTION: ghc-elem
+# @FUNCTION: ghc-pkgdeps
 # @DESCRIPTION:
-# help-function: element-check
-ghc-elem() {
-	local i
-	for i in $2; do
-		[[ "$1" == "${i}" ]] && return 0
-	done
-	return 1
-}
-
-# @FUNCTION: ghc-listpkg
-# @DESCRIPTION:
-# show the packages in a package configuration file
-ghc-listpkg() {
-	local ghcpkgcall
-	local i
-	local extra_flags
-	if version_is_at_least '6.12.3' "$(ghc-version)"; then
-		extra_flags="${extra_flags} -v0"
-	fi
-	for i in $*; do
-		echo $($(ghc-getghcpkg) list ${extra_flags} -f "${i}") \
-			| sed \
-				-e "s|^.*${i}:\([^:]*\).*$|\1|" \
-				-e "s|/.*$||" \
-				-e "s|,| |g" -e "s|[(){}]||g"
-	done
+# exported function: loads a package dependency in a form
+# cabal_package version
+ghc-pkgdeps() {
+	echo $($(ghc-getghcpkg) describe "${1}") \
+	| sed \
+			-e '/depends/,/^.*:/ !d' \
+			-e 's/\(.*\)-\(.*\)-\(.*\)/\1 \2/' \
+			-e 's/^.*://g'
 }
 
 # @FUNCTION: ghc-package_pkg_postinst
 # @DESCRIPTION:
-# exported function: registers the package-specific package
-# configuration file
+# updates package.cache after package install
 ghc-package_pkg_postinst() {
-	ghc-register-pkg "$(ghc-localpkgconf)"
+	ghc-recache-db
 }
 
 # @FUNCTION: ghc-package_pkg_prerm
 # @DESCRIPTION:
-# exported function: unregisters the package-specific package
-# configuration file; a package contained therein is unregistered
-# only if it the same package is not also contained in another
-# package configuration file ...
+# updates package.cache after package deinstall
 ghc-package_pkg_prerm() {
-	ghc-unregister-pkg "$(ghc-localpkgconf)"
+	ewarn "ghc-package.eclass: 'ghc-package_pkg_prerm()' is a noop"
+	ewarn "ghc-package.eclass: consider 'haskell-cabal_pkg_postrm()' instead"
 }
 
-EXPORT_FUNCTIONS pkg_postinst pkg_prerm
+# @FUNCTION: ghc-package_pkg_postrm
+# @DESCRIPTION:
+# updates package.cache after package deinstall
+ghc-package_pkg_postrm() {
+	ghc-recache-db
+}



1.47                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- haskell-cabal.eclass	27 Jun 2014 07:26:18 -0000	1.46
+++ haskell-cabal.eclass	1 Jan 2015 21:23:03 -0000	1.47
@@ -1,6 +1,6 @@
-# Copyright 1999-2014 Gentoo Foundation
+# 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.46 2014/06/27 07:26:18 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.47 2015/01/01 21:23:03 slyfox Exp $
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
@@ -31,6 +31,9 @@
 #   nocabaldep --  don't add dependency on cabal.
 #                  only used for packages that _must_ not pull the dependency
 #                  on cabal, but still use this eclass (e.g. haskell-updater).
+#   ghcdeps    --  constraint dependency on package to ghc onces
+#                  only used for packages that use libghc internally and _must_
+#                  not pull upper versions
 #   test-suite --  add support for cabal test-suites (introduced in Cabal-1.8)
 
 inherit eutils ghc-package multilib multiprocessing
@@ -61,7 +64,7 @@
 # Needs working 'diff'.
 : ${CABAL_DEBUG_LOOSENING:=}
 
-HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install"
+HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install pkg_postinst pkg_postrm"
 
 # 'dev-haskell/cabal' passes those options with ./configure-based
 # configuration, but most packages don't need/don't accept it:
@@ -89,6 +92,7 @@
 		bin)        CABAL_HAS_BINARIES=yes;;
 		lib)        CABAL_HAS_LIBRARIES=yes;;
 		nocabaldep) CABAL_FROM_GHC=yes;;
+		ghcdeps)    CABAL_GHC_CONSTRAINT=yes;;
 		test-suite) CABAL_TEST_SUITE=yes;;
 		*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
 	esac
@@ -106,6 +110,11 @@
 	DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
 fi
 
+if [[ -n "${CABAL_USE_HOOGLE}" ]]; then
+	# enabled only in ::gentoo-haskell
+	:
+fi
+
 if [[ -n "${CABAL_USE_ALEX}" ]]; then
 	DEPEND="${DEPEND} dev-haskell/alex"
 fi
@@ -148,9 +157,7 @@
 			# of this package itself.
 			_CABAL_VERSION_CACHE="${PV}"
 		elif [[ "${CABAL_FROM_GHC}" ]]; then
-			local cabal_package=$(echo "$(ghc-libdir)"/Cabal-*)
-			# /path/to/ghc/Cabal-${VER} -> ${VER}
-			_CABAL_VERSION_CACHE="${cabal_package/*Cabal-/}"
+			_CABAL_VERSION_CACHE="$(ghc-cabal-version)"
 		else
 			# We ask portage, not ghc, so that we only pick up
 			# portage-installed cabal versions.
@@ -237,6 +244,10 @@
 	./setup "$@" || die "setup haddock failed"
 }
 
+cabal-hoogle() {
+	ewarn "hoogle USE flag requires doc USE flag, building without hoogle"
+}
+
 cabal-hscolour-haddock() {
 	# --hyperlink-source implies calling 'setup hscolour'
 	set -- haddock --hyperlink-source
@@ -244,6 +255,22 @@
 	./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed"
 }
 
+cabal-hoogle-haddock() {
+	set -- haddock --hoogle
+	echo ./setup "$@"
+	./setup "$@" || die "setup haddock --hoogle failed"
+}
+
+cabal-hoogle-hscolour-haddock() {
+	cabal-hscolour-haddock
+	cabal-hoogle-haddock
+}
+
+cabal-hoogle-hscolour() {
+	ewarn "hoogle USE flag requires doc USE flag, building without hoogle"
+	cabal-hscolour
+}
+
 cabal-die-if-nonempty() {
 	local breakage_type=$1
 	shift
@@ -305,6 +332,10 @@
 		cabalconf+=($(use_enable test tests))
 	fi
 
+	if [[ -n "${CABAL_GHC_CONSTRAINT}" ]]; then
+		cabalconf+=($(cabal-constraint "ghc"))
+	fi
+
 	local option
 	for option in ${HCFLAGS}
 	do
@@ -413,8 +444,7 @@
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
 		# Newer cabal can generate a package conf for us:
 		./setup register --gen-pkg-config="${T}/${P}.conf"
-		ghc-setup-pkg "${T}/${P}.conf"
-		ghc-install-pkg
+		ghc-install-pkg "${T}/${P}.conf"
 	fi
 }
 
@@ -487,16 +517,36 @@
 
 	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
 		if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
-			# hscolour and haddock
-			cabal-hscolour-haddock
+			if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
+				# hoogle, hscolour and haddock
+				cabal-hoogle-hscolour-haddock
+			else
+				# haddock and hscolour
+				cabal-hscolour-haddock
+			fi
 		else
-			# just haddock
-			cabal-haddock
+			if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
+				# hoogle and haddock
+				cabal-hoogle-haddock
+			else
+				# just haddock
+				cabal-haddock
+			fi
 		fi
 	else
 		if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
-			# just hscolour
-			cabal-hscolour
+			if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
+				# hoogle and hscolour
+				cabal-hoogle-hscolour
+			else
+				# just hscolour
+				cabal-hscolour
+			fi
+		else
+			if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then
+				# just hoogle
+				cabal-hoogle
+			fi
 		fi
 	fi
 }
@@ -538,27 +588,10 @@
 	local ghc_confdir_with_prefix="$(ghc-confdir)"
 	# remove EPREFIX
 	dodir ${ghc_confdir_with_prefix#${EPREFIX}}
-	local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
-	[[ -e $conf_file ]] || echo '[]' > "$conf_file" || die
-
-	# make sure installed packages do not destroy ghc's
-	# bundled packages
-	local initial_pkg_db=${ROOT}/$(ghc-libdir)/package.conf.d.initial
-	if [[ -e ${initial_pkg_db} ]]; then
-		local checked_pkg
-		for checked_pkg in $(ghc-listpkg "${conf_file}")
-		do
-			local initial_pkg
-			for initial_pkg in $(ghc-listpkg "${initial_pkg_db}"); do
-				if [[ ${checked_pkg} = ${initial_pkg} ]]; then
-					eerror "Package ${checked_pkg} is shipped with $(ghc-version)."
-					eerror "Ebuild author forgot CABAL_CORE_LIB_GHC_PV entry."
-					eerror "Found in ${initial_pkg_db}."
-					die
-				fi
-			done
-		done
-	fi
+	local hint_db="${D}/$(ghc-confdir)"
+	local hint_file="${hint_db}/${PF}.conf"
+	mkdir -p "${hint_db}" || die
+	touch "${hint_file}" || die
 }
 
 haskell-cabal_src_install() {
@@ -569,6 +602,14 @@
 	popd > /dev/null
 }
 
+haskell-cabal_pkg_postinst() {
+	ghc-package_pkg_postinst
+}
+
+haskell-cabal_pkg_postrm() {
+	ghc-package_pkg_postrm
+}
+
 # @FUNCTION: cabal_flag
 # @DESCRIPTION:
 # ebuild.sh:use_enable() taken as base
@@ -666,6 +707,16 @@
 		die "failed to update"
 }
 
+# @FUNCTION: cabal-constraint
+# @DESCRIPTION:
+# Allowes to set contraint to the libraries that are
+# used by specified package
+cabal-constraint() {
+	while read p v ; do
+		echo "--constraint \"$p == $v\""
+	done < $(ghc-pkgdeps ${1})
+}
+
 # @FUNCTION: replace-hcflags
 # @USAGE: <old> <new>
 # @DESCRIPTION:





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2015-03-28 13:32 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2015-03-28 13:32 UTC (permalink / raw
  To: gentoo-commits

slyfox      15/03/28 13:32:40

  Modified:             ChangeLog ghc-package.eclass haskell-cabal.eclass
  Log:
  Enable building dynamic haskell executables since dev-lang/ghc-7.10.1_rc3.

Revision  Changes    Path
1.1575               eclass/ChangeLog

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

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1574
retrieving revision 1.1575
diff -u -r1.1574 -r1.1575
--- ChangeLog	26 Mar 2015 16:15:33 -0000	1.1574
+++ ChangeLog	28 Mar 2015 13:32:40 -0000	1.1575
@@ -1,6 +1,10 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1574 2015/03/26 16:15:33 grknight Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1575 2015/03/28 13:32:40 slyfox Exp $
+
+  28 Mar 2015; Sergei Trofimovich <slyfox@gentoo.org> ghc-package.eclass,
+  haskell-cabal.eclass:
+  Enable building dynamic haskell executables since dev-lang/ghc-7.10.1_rc3.
 
   26 Mar 2015; <grknight@gentoo.org> php-ext-source-r2.eclass:
   Add deprecation warning when USE_PHP is empty



1.41                 eclass/ghc-package.eclass

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

Index: ghc-package.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- ghc-package.eclass	1 Jan 2015 21:23:03 -0000	1.40
+++ ghc-package.eclass	28 Mar 2015 13:32:40 -0000	1.41
@@ -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.40 2015/01/01 21:23:03 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.41 2015/03/28 13:32:40 slyfox Exp $
 
 # @ECLASS: ghc-package.eclass
 # @MAINTAINER:
@@ -126,13 +126,6 @@
 	$(ghc-getghc) --info | grep "Support SMP" | grep -q "YES"
 }
 
-# @FUNCTION: ghc-supports-dynamic-by-default
-# @DESCRIPTION:
-# checks if ghc links against shared haskell libraries by default
-ghc-supports-dynamic-by-default() {
-	$(ghc-getghc) --info | grep "Dynamic by default" | grep -q "YES"
-}
-
 # @FUNCTION: ghc-supports-interpreter
 # @DESCRIPTION:
 # checks if ghc has interpreter mode (aka GHCi)



1.50                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- haskell-cabal.eclass	15 Mar 2015 17:03:27 -0000	1.49
+++ haskell-cabal.eclass	28 Mar 2015 13:32:40 -0000	1.50
@@ -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.49 2015/03/15 17:03:27 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.50 2015/03/28 13:32:40 slyfox Exp $
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
@@ -388,8 +388,14 @@
 
 	if $(ghc-supports-shared-libraries); then
 		# maybe a bit lower
-		if $(ghc-supports-dynamic-by-default); then
-			cabalconf+=(--enable-shared)
+		cabalconf+=(--enable-shared)
+
+		# Experimental support for dynamically linked binaries.
+		# We are enabling it since 7.10.1_rc3
+		if version_is_at_least "7.10.0.20150316" "$(ghc-version)"; then
+			# Known to break on ghc-7.8/Cabal-1.18
+			# https://ghc.haskell.org/trac/ghc/ticket/9625
+			cabalconf+=(--enable-executable-dynamic)
 		fi
 	fi
 





^ permalink raw reply	[flat|nested] 8+ messages in thread

* [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass
@ 2015-08-06  8:20 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 8+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2015-08-06  8:20 UTC (permalink / raw
  To: gentoo-commits

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 <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



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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-06  8:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 21:23 [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog ghc-package.eclass haskell-cabal.eclass Sergei Trofimovich (slyfox)
  -- strict thread matches above, loose matches on Subject: below --
2015-08-06  8:20 Sergei Trofimovich (slyfox)
2015-03-28 13:32 Sergei Trofimovich (slyfox)
2014-02-11 19:00 Sergei Trofimovich (slyfox)
2013-05-11 12:46 Sergei Trofimovich (slyfox)
2013-01-06 13:06 Sergei Trofimovich (slyfox)
2012-11-16 15:47 Sergei Trofimovich (slyfox)
2012-04-09 18:08 Sergei Trofimovich (slyfox)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox