public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2007-12-13  4:44 Duncan Coutts (dcoutts)
  0 siblings, 0 replies; 12+ messages in thread
From: Duncan Coutts (dcoutts) @ 2007-12-13  4:44 UTC (permalink / raw
  To: gentoo-commits

dcoutts     07/12/13 04:44:40

  Modified:             haskell-cabal.eclass
  Log:
  Update cabal eclass for new cabal-1.2 series

Revision  Changes    Path
1.14                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.14&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.14&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.13&r2=1.14

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- haskell-cabal.eclass	5 Aug 2007 18:49:58 -0000	1.13
+++ haskell-cabal.eclass	13 Dec 2007 04:44:39 -0000	1.14
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.13 2007/08/05 18:49:58 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.14 2007/12/13 04:44:39 dcoutts Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -61,7 +61,6 @@
 if [[ -n "${CABAL_USE_HADDOCK}" ]]; then
 	IUSE="${IUSE} doc"
 	DEPEND="${DEPEND} doc? ( dev-haskell/haddock )"
-	cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock"
 fi
 
 if [[ -n "${CABAL_USE_ALEX}" ]]; then
@@ -90,7 +89,9 @@
 
 # We always use a standalone version of Cabal, rather than the one that comes
 # with GHC. But of course we can't depend on cabal when building cabal itself.
-CABAL_MIN_VERSION=1.1.4
+if [[ -z ${CABAL_MIN_VERSION} ]]; then
+	CABAL_MIN_VERSION=1.1.4
+fi
 if [[ -z "${CABAL_BOOTSTRAP}" ]]; then
 	DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
 fi
@@ -100,9 +101,26 @@
 	RDEPEND="${RDEPEND} dev-lang/ghc"
 fi
 
+# returns the version of cabal currently in use
+_CABAL_VERSION_CACHE=""
+cabal-version() {
+	if [[ -z "${_CABAL_VERSION_CACHE}" ]]; then
+		if [[ "${CABAL_BOOTSTRAP}" ]]; then
+			# We're bootstrapping cabal, so the cabal version is the version
+			# of this package itself.
+			_CABAL_VERSION_CACHE="${PV}"
+		else
+			# We ask portage, not ghc, so that we only pick up
+			# portage-installed cabal versions.
+			_CABAL_VERSION_CACHE="$(ghc-extractportageversion dev-haskell/cabal)"
+		fi
+	fi
+	echo "${_CABAL_VERSION_CACHE}"
+}
+
 cabal-bootstrap() {
 	local setupmodule
-	local cabalversion
+	local cabalpackage
 	if [[ -f "${S}/Setup.lhs" ]]; then
 		setupmodule="${S}/Setup.lhs"
 	else
@@ -115,17 +133,40 @@
 
 	# We build the setup program using the latest version of
 	# cabal that we have installed
-	cabalversion=$(ghc-bestcabalversion)
-	einfo "Using ${cabalversion}."
-	$(ghc-getghc) -package "${cabalversion}" --make "${setupmodule}" -o setup \
+	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
+	einfo "Using cabal-$(cabal-version)."
+	$(ghc-getghc) -package "${cabalpackage}" --make "${setupmodule}" -o setup \
 		|| die "compiling ${setupmodule} failed"
 }
 
+cabal-mksetup() {
+	local setupdir
+
+	if [[ -n $1 ]]; then
+		setupdir=$1
+	else
+		setupdir=${S}
+	fi
+
+	rm -f "${setupdir}"/Setup.{lhs,hs}
+
+	echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
+		> $setupdir/Setup.hs
+}
+
 cabal-haddock() {
 	./setup haddock || die "setup haddock failed"
 }
 
 cabal-configure() {
+	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
+		cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock"
+	fi
 	if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
 		cabalconf="${cabalconf} --enable-library-profiling"
 	fi
@@ -134,7 +175,13 @@
 		cabalconf="${cabalconf} --disable-library-for-ghci"
 	fi
 
-	# Note: with Cabal-1.1.6.x we still do not have enough control
+	if version_is_at_least "1.2.0" "$(cabal-version)"; then
+		cabalconf="${cabalconf} --docdir=/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}/
@@ -155,6 +202,7 @@
 }
 
 cabal-build() {
+	unset LANG LC_ALL LC_MESSAGES
 	./setup build \
 		|| die "setup build failed"
 }
@@ -185,13 +233,23 @@
 	local err
 
 	if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then
-		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
+		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
-			die "setup register has not generated a package configuration file"
+			# 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
 	fi
 }
@@ -259,8 +317,7 @@
 		cabal-pkg
 
 		if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
-			local cabalversion=$(ghc-extractportageversion dev-haskell/cabal)
-			if ! version_is_at_least "1.1.6" "${cabalversion}"; then
+			if ! version_is_at_least "1.1.6" "$(cabal-version)"; then
 				dohtml -r dist/doc/html/*
 			fi
 		fi



-- 
gentoo-commits@gentoo.org mailing list



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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2009-07-27 19:03 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2009-07-27 19:03 UTC (permalink / raw
  To: gentoo-commits

kolmodin    09/07/27 19:03:20

  Modified:             haskell-cabal.eclass
  Log:
  Fix (kind of harmless) typo in haskell-cabal eclass. $CABAL_UNKNONW -> $CABAL_UNKNOWN.

Revision  Changes    Path
1.15                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.15&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.15&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.14&r2=1.15

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- haskell-cabal.eclass	13 Dec 2007 04:44:39 -0000	1.14
+++ haskell-cabal.eclass	27 Jul 2009 19:03:20 -0000	1.15
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.14 2007/12/13 04:44:39 dcoutts Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.15 2009/07/27 19:03:20 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -283,7 +283,7 @@
 		eerror "QA: Neither bin nor lib are in CABAL_FEATURES."
 	fi
 	if [[ -n "${CABAL_UNKNOWN}" ]]; then
-		ewarn "Unknown entry in CABAL_FEATURES: ${CABAL_UNKNONW}"
+		ewarn "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."






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2009-09-09 18:40 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2009-09-09 18:40 UTC (permalink / raw
  To: gentoo-commits

kolmodin    09/09/09 18:40:11

  Modified:             haskell-cabal.eclass
  Log:
  Updating the haskell-cabal eclass to support the CABAL_FEATURES nocabaldep
  which is used in the dev-haskell/haskell-updater package. It enables
  packages to use the cabal eclass without depending on cabal.

Revision  Changes    Path
1.16                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.16&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.16&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.15&r2=1.16

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- haskell-cabal.eclass	27 Jul 2009 19:03:20 -0000	1.15
+++ haskell-cabal.eclass	9 Sep 2009 18:40:11 -0000	1.16
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.15 2009/07/27 19:03:20 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.16 2009/09/09 18:40:11 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -26,6 +26,9 @@
 #   bootstrap  --  only used for the cabal package itself
 #   bin        --  the package installs binaries
 #   lib        --  the package installs libraries
+#   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.
@@ -45,15 +48,16 @@
 
 for feature in ${CABAL_FEATURES}; do
 	case ${feature} in
-		haddock)   CABAL_USE_HADDOCK=yes;;
-		alex)      CABAL_USE_ALEX=yes;;
-		happy)     CABAL_USE_HAPPY=yes;;
-		c2hs)      CABAL_USE_C2HS=yes;;
-		cpphs)     CABAL_USE_CPPHS=yes;;
-		profile)   CABAL_USE_PROFILE=yes;;
-		bootstrap) CABAL_BOOTSTRAP=yes;;
-		bin)       CABAL_HAS_BINARIES=yes;;
-		lib)       CABAL_HAS_LIBRARIES=yes;;
+		haddock)    CABAL_USE_HADDOCK=yes;;
+		alex)       CABAL_USE_ALEX=yes;;
+		happy)      CABAL_USE_HAPPY=yes;;
+		c2hs)       CABAL_USE_C2HS=yes;;
+		cpphs)      CABAL_USE_CPPHS=yes;;
+		profile)    CABAL_USE_PROFILE=yes;;
+		bootstrap)  CABAL_BOOTSTRAP=yes;;
+		bin)        CABAL_HAS_BINARIES=yes;;
+		lib)        CABAL_HAS_LIBRARIES=yes;;
+		nocabaldep) CABAL_FROM_GHC=yes;;
 		*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";;
 	esac
 done
@@ -92,7 +96,7 @@
 if [[ -z ${CABAL_MIN_VERSION} ]]; then
 	CABAL_MIN_VERSION=1.1.4
 fi
-if [[ -z "${CABAL_BOOTSTRAP}" ]]; then
+if [[ -z "${CABAL_BOOTSTRAP}" && -z "${CABAL_FROM_GHC}" ]]; then
 	DEPEND="${DEPEND} >=dev-haskell/cabal-${CABAL_MIN_VERSION}"
 fi
 
@@ -273,10 +277,10 @@
 # the currently active ghc (we cannot guarantee this with portage)
 haskell-cabal_pkg_setup() {
 	ghc-package_pkg_setup
-	if [[ -z "${CABAL_BOOTSTRAP}" ]] && ! ghc-sanecabal "${CABAL_MIN_VERSION}"; then
+	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 re-emerge dev-haskell/cabal."
+		eerror "run ghc-updater or 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
@@ -302,6 +306,7 @@
 		fi
 	fi
 }
+
 haskell-cabal_src_compile() {
 	cabal_src_compile
 }






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2009-10-28 23:46 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2009-10-28 23:46 UTC (permalink / raw
  To: gentoo-commits

kolmodin    09/10/28 23:46:17

  Modified:             haskell-cabal.eclass
  Log:
  Properly support the CABAL_FEATURES="nocabaldep" if user doesn't have dev-haskell/cabal

Revision  Changes    Path
1.17                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.17&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.17&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.16&r2=1.17

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- haskell-cabal.eclass	9 Sep 2009 18:40:11 -0000	1.16
+++ haskell-cabal.eclass	28 Oct 2009 23:46:16 -0000	1.17
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.16 2009/09/09 18:40:11 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.17 2009/10/28 23:46:16 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -113,6 +113,22 @@
 			# We're bootstrapping cabal, so the cabal version is the version
 			# of this package itself.
 			_CABAL_VERSION_CACHE="${PV}"
+		elif [[ "${CABAL_FROM_GHC}" ]]; then
+			# We can't assume there's a version of Cabal installed by ebuild as
+			# this might be a first time install of GHC (for packages that
+			# use the shipped Cabal like haskell-updater).
+
+			# The user is likely to only have one version of Cabal, provided
+			# by GHC. Note that dev-haskell/cabal can be a dummy package, only
+			# using the version provided by GHC. If the user has another version
+			# of Cabal too (more recent than the one GHC provides through
+			# dev-haskell/cabal, or possibly older if he used an old
+			# Cabal package) the most recent is used (expected to be the last
+			# one in the ghc-pkg output).
+			_CABAL_VERSION_CACHE="$(ghc-pkg field Cabal version | tail -n 1)"
+
+			# Strip out the "version: " prefix
+			_CABAL_VERSION_CACHE="${_CABAL_VERSION_CACHE#"version: "}"
 		else
 			# We ask portage, not ghc, so that we only pick up
 			# portage-installed cabal versions.






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2010-01-26 20:50 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2010-01-26 20:50 UTC (permalink / raw
  To: gentoo-commits

kolmodin    10/01/26 20:50:40

  Modified:             haskell-cabal.eclass
  Log:
  haskell-cabal.eclass: Don't strip executables, let portage do it.

Revision  Changes    Path
1.18                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.18&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.18&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.17&r2=1.18

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- haskell-cabal.eclass	28 Oct 2009 23:46:16 -0000	1.17
+++ haskell-cabal.eclass	26 Jan 2010 20:50:40 -0000	1.18
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.17 2009/10/28 23:46:16 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.18 2010/01/26 20:50:40 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -195,6 +195,16 @@
 		cabalconf="${cabalconf} --disable-library-for-ghci"
 	fi
 
+	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=/usr/share/doc/${PF}"
 		# As of Cabal 1.2, configure is quite quiet. For diagnostic purposes






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2010-03-27  9:10 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2010-03-27  9:10 UTC (permalink / raw
  To: gentoo-commits

kolmodin    10/03/27 09:10:47

  Modified:             haskell-cabal.eclass
  Log:
  Update haskell-cabal eclass to handle EAPI=2.

Revision  Changes    Path
1.19                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.19&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.19&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.18&r2=1.19

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- haskell-cabal.eclass	26 Jan 2010 20:50:40 -0000	1.18
+++ haskell-cabal.eclass	27 Mar 2010 09:10:46 -0000	1.19
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.18 2010/01/26 20:50:40 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.19 2010/03/27 09:10:46 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -45,6 +45,14 @@
 
 inherit ghc-package multilib
 
+HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install"
+
+case "${EAPI:-0}" in
+	2|3|4) HASKELL_CABAL_EXPF+=" src_configure" ;;
+	*) ;;
+esac
+
+EXPORT_FUNCTIONS ${HASKELL_CABAL_EXPF}
 
 for feature in ${CABAL_FEATURES}; do
 	case ${feature} in
@@ -320,11 +328,24 @@
 	fi
 }
 
+haskell-cabal_src_configure() {
+	pushd "${S}" > /dev/null
+
+	cabal-bootstrap
+	cabal-configure "$@"
+
+	popd > /dev/null
+}
+
+# exported function: nice alias
+cabal_src_configure() {
+	haskell-cabal_src_configure "$@"
+}
+
 # exported function: cabal-style bootstrap configure and compile
 cabal_src_compile() {
 	if ! cabal-is-dummy-lib; then
-		cabal-bootstrap
-		cabal-configure
+		has src_configure ${HASKELL_CABAL_EXPF} || haskell-cabal_src_configure "$@"
 		cabal-build
 
 		if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
@@ -334,7 +355,20 @@
 }
 
 haskell-cabal_src_compile() {
-	cabal_src_compile
+	pushd "${S}" > /dev/null
+
+	cabal_src_compile "$@"
+
+	popd > /dev/null
+}
+
+haskell-cabal_src_test() {
+	pushd "${S}" > /dev/null
+
+	einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
+	./setup test || die "cabal test failed"
+
+	popd > /dev/null
 }
 
 # exported function: cabal-style copy and register
@@ -354,8 +388,39 @@
 		fi
 	fi
 }
+
 haskell-cabal_src_install() {
+	pushd "${S}" > /dev/null
+
 	cabal_src_install
+
+	popd > /dev/null
 }
 
-EXPORT_FUNCTIONS pkg_setup src_compile src_install
+# ebuild.sh:use_enable() taken as base
+#
+# Usage examples:
+#
+#     CABAL_CONFIGURE_FLAGS=$(cabal_flag gui)
+#  leads to "--flags=gui" or "--flags=-gui" (useflag 'gui')
+#
+#     CABAL_CONFIGURE_FLAGS=$(cabal_flag gtk gui)
+#  also leads to "--flags=gui" or " --flags=-gui" (useflag 'gtk')
+#
+cabal_flag() {
+	if [[ -z "$1" ]]; then
+		echo "!!! cabal_flag() called without a parameter." >&2
+		echo "!!! cabal_flag() <USEFLAG> [<cabal_flagname>]" >&2
+		return 1
+	fi
+
+	local UWORD=${2:-$1}
+
+	if use "$1"; then
+		echo "--flags=${UWORD}"
+	else
+		echo "--flags=-${UWORD}"
+	fi
+
+	return 0
+}






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2010-03-30 22:18 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2010-03-30 22:18 UTC (permalink / raw
  To: gentoo-commits

kolmodin    10/03/30 22:18:37

  Modified:             haskell-cabal.eclass
  Log:
  When using dummy haskell libraries, there is no test suite.

Revision  Changes    Path
1.20                 eclass/haskell-cabal.eclass

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.20&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.20&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.19&r2=1.20

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- haskell-cabal.eclass	27 Mar 2010 09:10:46 -0000	1.19
+++ haskell-cabal.eclass	30 Mar 2010 22:18:37 -0000	1.20
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.19 2010/03/27 09:10:46 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.20 2010/03/30 22:18:37 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -365,8 +365,12 @@
 haskell-cabal_src_test() {
 	pushd "${S}" > /dev/null
 
-	einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
-	./setup test || die "cabal test failed"
+	if cabal-is-dummy-lib; then
+		einfo ">>> No tests for dummy library: ${CATEGORY}/${PF}"
+	else
+		einfo ">>> Test phase [cabal test]: ${CATEGORY}/${PF}"
+		./setup test || die "cabal test failed"
+	fi
 
 	popd > /dev/null
 }






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2010-08-07 12:06 Lennart Kolmodin (kolmodin)
  0 siblings, 0 replies; 12+ messages in thread
From: Lennart Kolmodin (kolmodin) @ 2010-08-07 12:06 UTC (permalink / raw
  To: gentoo-commits

kolmodin    10/08/07 12:06:29

  Modified:             haskell-cabal.eclass
  Log:
  Allow USE=hscolour for dev-haskell packages that have
  CABAL_FEATURES="hscolour" (none yet in portage).

Revision  Changes    Path
1.21                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- haskell-cabal.eclass	30 Mar 2010 22:18:37 -0000	1.20
+++ haskell-cabal.eclass	7 Aug 2010 12:06:27 -0000	1.21
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.20 2010/03/30 22:18:37 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.21 2010/08/07 12:06:27 kolmodin Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -18,6 +18,7 @@
 #
 # Currently supported features:
 #   haddock    --  for documentation generation
+#   hscolour   --  generation of colourised sources
 #   alex       --  lexer/scanner generator
 #   happy      --  parser generator
 #   c2hs       --  C interface generator
@@ -57,6 +58,7 @@
 for feature in ${CABAL_FEATURES}; do
 	case ${feature} in
 		haddock)    CABAL_USE_HADDOCK=yes;;
+		hscolour)   CABAL_USE_HSCOLOUR=yes;;
 		alex)       CABAL_USE_ALEX=yes;;
 		happy)      CABAL_USE_HAPPY=yes;;
 		c2hs)       CABAL_USE_C2HS=yes;;
@@ -75,6 +77,11 @@
 	DEPEND="${DEPEND} doc? ( dev-haskell/haddock )"
 fi
 
+if [[ -n "${CABAL_USE_HSCOLOUR}" ]]; then
+	IUSE="${IUSE} hscolour"
+	DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )"
+fi
+
 if [[ -n "${CABAL_USE_ALEX}" ]]; then
 	DEPEND="${DEPEND} dev-haskell/alex"
 	cabalconf="${cabalconf} --with-alex=/usr/bin/alex"
@@ -187,10 +194,19 @@
 		> $setupdir/Setup.hs
 }
 
+cabal-hscolour() {
+	./setup hscolour || die "setup hscolour failed"
+}
+
 cabal-haddock() {
 	./setup haddock || die "setup haddock failed"
 }
 
+cabal-hscolour-haddock() {
+	# --hyperlink-source implies calling 'setup hscolour'
+	./setup haddock --hyperlink-source || die "setup haddock failed"
+}
+
 cabal-configure() {
 	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
 		cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock"
@@ -349,7 +365,18 @@
 		cabal-build
 
 		if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
-			cabal-haddock
+			if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
+				# hscolour and haddock
+				cabal-hscolour-haddock
+			else
+				# just haddock
+				cabal-haddock
+			fi
+		else
+			if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then
+				# just hscolour
+				cabal-hscolour
+			fi
 		fi
 	fi
 }






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2010-09-12  7:37 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2010-09-12  7:37 UTC (permalink / raw
  To: gentoo-commits

slyfox      10/09/12 07:37:09

  Modified:             haskell-cabal.eclass
  Log:
  Make .cabal built haskell packages respect LDFLAGS envvar. Fixes bug #333217 (and inferior bug #335591)

Revision  Changes    Path
1.22                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- haskell-cabal.eclass	7 Aug 2010 12:06:27 -0000	1.21
+++ haskell-cabal.eclass	12 Sep 2010 07:37:09 -0000	1.22
@@ -1,6 +1,6 @@
 # Copyright 1999-2006 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.21 2010/08/07 12:06:27 kolmodin Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.22 2010/09/12 07:37:09 slyfox Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -348,7 +348,13 @@
 	pushd "${S}" > /dev/null
 
 	cabal-bootstrap
-	cabal-configure "$@"
+
+	ghc_flags=""
+	# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
+	# so translate LDFLAGS to ghc parameters (without filtering)
+	for flag in $LDFLAGS; do ghc_flags="${ghc_flags} --ghc-option=-optl$flag"; done
+
+	cabal-configure $ghc_flags "$@"
 
 	popd > /dev/null
 }






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2011-03-13 20:15 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2011-03-13 20:15 UTC (permalink / raw
  To: gentoo-commits

slyfox      11/03/13 20:15:14

  Modified:             haskell-cabal.eclass
  Log:
  Added EPREFIX support. Fixed default src_configure for dummy packages (EAPI=3 and upper).

Revision  Changes    Path
1.23                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- haskell-cabal.eclass	12 Sep 2010 07:37:09 -0000	1.22
+++ haskell-cabal.eclass	13 Mar 2011 20:15:14 -0000	1.23
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.22 2010/09/12 07:37:09 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.23 2011/03/13 20:15:14 slyfox Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -28,8 +28,8 @@
 #   bin        --  the package installs binaries
 #   lib        --  the package installs libraries
 #   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).
+#                  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.
@@ -84,22 +84,18 @@
 
 if [[ -n "${CABAL_USE_ALEX}" ]]; then
 	DEPEND="${DEPEND} dev-haskell/alex"
-	cabalconf="${cabalconf} --with-alex=/usr/bin/alex"
 fi
 
 if [[ -n "${CABAL_USE_HAPPY}" ]]; then
 	DEPEND="${DEPEND} dev-haskell/happy"
-	cabalconf="${cabalconf} --with-happy=/usr/bin/happy"
 fi
 
 if [[ -n "${CABAL_USE_C2HS}" ]]; then
 	DEPEND="${DEPEND} dev-haskell/c2hs"
-	cabalconf="${cabalconf} --with-c2hs=/usr/bin/c2hs"
 fi
 
 if [[ -n "${CABAL_USE_CPPHS}" ]]; then
 	DEPEND="${DEPEND} dev-haskell/cpphs"
-	cabalconf="${cabalconf} --with-cpphs=/usr/bin/cpphs"
 fi
 
 if [[ -n "${CABAL_USE_PROFILE}" ]]; then
@@ -208,12 +204,29 @@
 }
 
 cabal-configure() {
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+
 	if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then
-		cabalconf="${cabalconf} --with-haddock=/usr/bin/haddock"
+		cabalconf="${cabalconf} --with-haddock=${EPREFIX}/usr/bin/haddock"
 	fi
 	if [[ -n "${CABAL_USE_PROFILE}" ]] && use profile; then
 		cabalconf="${cabalconf} --enable-library-profiling"
 	fi
+	if [[ -n "${CABAL_USE_ALEX}" ]]; then
+		cabalconf="${cabalconf} --with-alex=${EPREFIX}/usr/bin/alex"
+	fi
+
+	if [[ -n "${CABAL_USE_HAPPY}" ]]; then
+		cabalconf="${cabalconf} --with-happy=${EPREFIX}/usr/bin/happy"
+	fi
+
+	if [[ -n "${CABAL_USE_C2HS}" ]]; then
+		cabalconf="${cabalconf} --with-c2hs=${EPREFIX}/usr/bin/c2hs"
+	fi
+	if [[ -n "${CABAL_USE_CPPHS}" ]]; then
+		cabalconf="${cabalconf} --with-cpphs=${EPREFIX}/usr/bin/cpphs"
+	fi
+
 	# Building GHCi libs on ppc64 causes "TOC overflow".
 	if use ppc64; then
 		cabalconf="${cabalconf} --disable-library-for-ghci"
@@ -230,7 +243,7 @@
 	fi
 
 	if version_is_at_least "1.2.0" "$(cabal-version)"; then
-		cabalconf="${cabalconf} --docdir=/usr/share/doc/${PF}"
+		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"
@@ -242,13 +255,13 @@
 	# Because we can only set the datadir, not the docdir.
 
 	./setup configure \
-		--ghc --prefix=/usr \
+		--ghc --prefix="${EPREFIX}"/usr \
 		--with-compiler="$(ghc-getghc)" \
 		--with-hc-pkg="$(ghc-getghcpkg)" \
-		--prefix=/usr \
-		--libdir=/usr/$(get_libdir) \
+		--prefix="${EPREFIX}"/usr \
+		--libdir="${EPREFIX}"/usr/$(get_libdir) \
 		--libsubdir=${P}/ghc-$(ghc-version) \
-		--datadir=/usr/share/ \
+		--datadir="${EPREFIX}"/usr/share/ \
 		--datasubdir=${P}/ghc-$(ghc-version) \
 		${cabalconf} \
 		${CABAL_CONFIGURE_FLAGS} \
@@ -262,19 +275,21 @@
 }
 
 cabal-copy() {
+	has "${EAPI:-0}" 0 1 2 && ! use prefix && ED=${D}
+
 	./setup copy \
 		--destdir="${D}" \
 		|| die "setup copy failed"
 
 	# cabal is a bit eager about creating dirs,
 	# so remove them if they are empty
-	rmdir "${D}/usr/bin" 2> /dev/null
+	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 "${D}/usr/bin" ]] ; then
-		chmod +x "${D}/usr/bin/"*
+	if [[ -d "${ED}/usr/bin" ]] ; then
+		chmod +x "${ED}/usr/bin/"*
 	fi
 	# TODO: do we still need this?
 }
@@ -345,18 +360,20 @@
 }
 
 haskell-cabal_src_configure() {
-	pushd "${S}" > /dev/null
+	if ! cabal-is-dummy-lib; then
+		pushd "${S}" > /dev/null
 
-	cabal-bootstrap
+		cabal-bootstrap
 
-	ghc_flags=""
-	# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
-	# so translate LDFLAGS to ghc parameters (without filtering)
-	for flag in $LDFLAGS; do ghc_flags="${ghc_flags} --ghc-option=-optl$flag"; done
+		ghc_flags=""
+		# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
+		# so translate LDFLAGS to ghc parameters (without filtering)
+		for flag in $LDFLAGS; do ghc_flags="${ghc_flags} --ghc-option=-optl$flag"; done
 
-	cabal-configure $ghc_flags "$@"
+		cabal-configure $ghc_flags "$@"
 
-	popd > /dev/null
+		popd > /dev/null
+	fi
 }
 
 # exported function: nice alias
@@ -410,9 +427,13 @@
 
 # exported function: cabal-style copy and register
 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
-		dodir "$(ghc-confdir)"
+		local ghc_confdir_with_prefix="$(ghc-confdir)"
+		# remove EPREFIX
+		dodir ${ghc_confdir_with_prefix#${EPREFIX}}
 		echo '[]' > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)"
 	else
 		cabal-copy






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2011-05-08 15:13 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2011-05-08 15:13 UTC (permalink / raw
  To: gentoo-commits

slyfox      11/05/08 15:13:11

  Modified:             haskell-cabal.eclass
  Log:
  added CABAL_EXTRA_CONFIGURE_FLAGS variable, more tweaks
  
  - CABAL_EXTRA_CONFIGURE_FLAGS - variable similar to EXTRA_ECONF for econf.
    It appends given arguments to 'runhaskell Setup configure args' call.
    It's handy when one wants to pass some argument for all haskell packages,
    like 'CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared' to get shared variants
    for all haskell libraries.
  
  - GHC_BOOTSTRAP_FLAGS - ghc option when building Setup.hs.
  
  - fix CABAL_FEATURES="nocabaldep" (found by Felipe Almeida Lessa)
  
      Felipe's output for ghc-6.12.3:
      > $ ghc-pkg field Cabal version
      > version: 1.8.0.6
      > version: 1.10.1.0
  
      My output for ghc-6.12.3:
      > $ ghc-pkg field Cabal version
      >    version: 1.10.1.0
      >    version: 1.8.0.6
  
      It has unstable order and breaks dev-haskell/cairo setup.
  
      Now we always pick ghc's Cabal version (as CABAL_FROM_GHC var name says),
      not the most recently installed.
  
  - Setup.hs is linked dynamically where available. Drastically speedups (from
    tens of seconds down to seconds) link time (and the whole package build time).
  
  - src_compile() got a QA warning when passed '--flags=' argument for EAPI,
    where yet src_configure() (catches potential package misconfiguration)

Revision  Changes    Path
1.24                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- haskell-cabal.eclass	13 Mar 2011 20:15:14 -0000	1.23
+++ haskell-cabal.eclass	8 May 2011 15:13:10 -0000	1.24
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.23 2011/03/13 20:15:14 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.24 2011/05/08 15:13:10 slyfox Exp $
 #
 # Original authors: Andres Loeh <kosmikus@gentoo.org>
 #                   Duncan Coutts <dcoutts@gentoo.org>
@@ -46,6 +46,20 @@
 
 inherit ghc-package multilib
 
+# @ECLASS-VARIABLE: CABAL_EXTRA_CONFIGURE_FLAGS
+# @DESCRIPTION:
+# User-specified additional parameters passed to 'setup configure'.
+# example: /etc/make.conf: CABAL_EXTRA_CONFIGURE_FLAGS=--enable-shared
+: ${CABAL_EXTRA_CONFIGURE_FLAGS:=}
+
+# @ECLASS-VARIABLE: GHC_BOOTSTRAP_FLAGS
+# @DESCRIPTION:
+# User-specified additional parameters for ghc when building
+# _only_ 'setup' binary bootstrap.
+# example: /etc/make.conf: GHC_BOOTSTRAP_FLAGS=-dynamic to make
+# linking 'setup' faster.
+: ${GHC_BOOTSTRAP_FLAGS:=}
+
 HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install"
 
 case "${EAPI:-0}" in
@@ -125,21 +139,9 @@
 			# of this package itself.
 			_CABAL_VERSION_CACHE="${PV}"
 		elif [[ "${CABAL_FROM_GHC}" ]]; then
-			# We can't assume there's a version of Cabal installed by ebuild as
-			# this might be a first time install of GHC (for packages that
-			# use the shipped Cabal like haskell-updater).
-
-			# The user is likely to only have one version of Cabal, provided
-			# by GHC. Note that dev-haskell/cabal can be a dummy package, only
-			# using the version provided by GHC. If the user has another version
-			# of Cabal too (more recent than the one GHC provides through
-			# dev-haskell/cabal, or possibly older if he used an old
-			# Cabal package) the most recent is used (expected to be the last
-			# one in the ghc-pkg output).
-			_CABAL_VERSION_CACHE="$(ghc-pkg field Cabal version | tail -n 1)"
-
-			# Strip out the "version: " prefix
-			_CABAL_VERSION_CACHE="${_CABAL_VERSION_CACHE#"version: "}"
+			local cabal_package=$(echo "$(ghc-libdir)"/Cabal-*)
+			# /path/to/ghc/Cabal-${VER} -> ${VER}
+			_CABAL_VERSION_CACHE="${cabal_package/*Cabal-/}"
 		else
 			# We ask portage, not ghc, so that we only pick up
 			# portage-installed cabal versions.
@@ -171,8 +173,20 @@
 		cabalpackage=Cabal
 	fi
 	einfo "Using cabal-$(cabal-version)."
-	$(ghc-getghc) -package "${cabalpackage}" --make "${setupmodule}" -o setup \
-		|| die "compiling ${setupmodule} failed"
+
+	make_setup() {
+		$(ghc-getghc) -package "${cabalpackage}" --make "${setupmodule}" \
+			${GHC_BOOTSTRAP_FLAGS} \
+			"$@" \
+			-o setup
+	}
+	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
+		make_setup -dynamic "$@" || make_setup "$@" || die "compiling ${setupmodule} failed"
+	else
+		make_setup "$@" || die "compiling ${setupmodule} failed"
+	fi
 }
 
 cabal-mksetup() {
@@ -232,6 +246,11 @@
 		cabalconf="${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
+
 	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.
@@ -254,6 +273,12 @@
 	# rather than	/usr/share/doc/${PF}/
 	# Because we can only set the datadir, not the docdir.
 
+	# 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"
+
 	./setup configure \
 		--ghc --prefix="${EPREFIX}"/usr \
 		--with-compiler="$(ghc-getghc)" \
@@ -265,6 +290,7 @@
 		--datasubdir=${P}/ghc-$(ghc-version) \
 		${cabalconf} \
 		${CABAL_CONFIGURE_FLAGS} \
+		${CABAL_EXTRA_CONFIGURE_FLAGS} \
 		"$@" || die "setup configure failed"
 }
 
@@ -365,11 +391,6 @@
 
 		cabal-bootstrap
 
-		ghc_flags=""
-		# currently cabal does not respect CFLAGS and LDFLAGS on it's own (bug #333217)
-		# so translate LDFLAGS to ghc parameters (without filtering)
-		for flag in $LDFLAGS; do ghc_flags="${ghc_flags} --ghc-option=-optl$flag"; done
-
 		cabal-configure $ghc_flags "$@"
 
 		popd > /dev/null
@@ -383,6 +404,17 @@
 
 # exported function: cabal-style bootstrap configure and compile
 cabal_src_compile() {
+	# it's a common mistake when one bumps ebuild to EAPI="2" (and upper)
+	# and forgets to separate src_compile() to src_configure()/src_compile().
+	# Such error leads to default src_configure and we lose all passed flags.
+	if ! has "${EAPI:-0}" 0 1; then
+		local passed_flag
+		for passed_flag in "$@"; do
+			[[ ${passed_flag} == --flags=* ]] && \
+				eqawarn "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






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

* [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass
@ 2012-11-19 21:27 Sergei Trofimovich (slyfox)
  0 siblings, 0 replies; 12+ messages in thread
From: Sergei Trofimovich (slyfox) @ 2012-11-19 21:27 UTC (permalink / raw
  To: gentoo-commits

slyfox      12/11/19 21:27:56

  Modified:             haskell-cabal.eclass
  Log:
  Fix error case to be more descriptive. Move 'einfo' lower to avoid empty output.

Revision  Changes    Path
1.37                 eclass/haskell-cabal.eclass

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

Index: haskell-cabal.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- haskell-cabal.eclass	19 Nov 2012 20:35:16 -0000	1.36
+++ haskell-cabal.eclass	19 Nov 2012 21:27:56 -0000	1.37
@@ -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.36 2012/11/19 20:35:16 slyfox Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.37 2012/11/19 21:27:56 slyfox Exp $
 
 # @ECLASS: haskell-cabal.eclass
 # @MAINTAINER:
@@ -580,11 +580,12 @@
 	while :; do
 		from_pat=$1
 		to_str=$2
-		einfo "CHDEP: '${from_pat}' -> '${to_str}'"
 
 		[[ -n ${from_pat} ]] || break
 		[[ -n ${to_str} ]] || die "'${from_str}' does not have 'to' part"
 
+		einfo "CHDEP: '${from_pat}' -> '${to_str}'"
+
 		# escape pattern-like symbols
 		from_pat=${from_pat//\*/\\*}
 		from_pat=${from_pat//\[/\\[}
@@ -597,7 +598,7 @@
 			diff -u "${T}/${cf}".{pre,post}
 		fi
 
-		[[ "${orig_c}" == "${new_c}" ]] && die "no trigger for '${from_ss}'"
+		[[ "${orig_c}" == "${new_c}" ]] && die "no trigger for '${from_pat}'"
 		orig_c=${new_c}
 		shift
 		shift





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

end of thread, other threads:[~2012-11-19 21:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-28 23:46 [gentoo-commits] gentoo-x86 commit in eclass: haskell-cabal.eclass Lennart Kolmodin (kolmodin)
  -- strict thread matches above, loose matches on Subject: below --
2012-11-19 21:27 Sergei Trofimovich (slyfox)
2011-05-08 15:13 Sergei Trofimovich (slyfox)
2011-03-13 20:15 Sergei Trofimovich (slyfox)
2010-09-12  7:37 Sergei Trofimovich (slyfox)
2010-08-07 12:06 Lennart Kolmodin (kolmodin)
2010-03-30 22:18 Lennart Kolmodin (kolmodin)
2010-03-27  9:10 Lennart Kolmodin (kolmodin)
2010-01-26 20:50 Lennart Kolmodin (kolmodin)
2009-09-09 18:40 Lennart Kolmodin (kolmodin)
2009-07-27 19:03 Lennart Kolmodin (kolmodin)
2007-12-13  4:44 Duncan Coutts (dcoutts)

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