/[gentoo-x86]/eclass/ghc-package.eclass
Gentoo

Diff of /eclass/ghc-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.17 Revision 1.22
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.17 2006/06/15 11:27:38 dcoutts Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.22 2007/03/13 12:02:04 kosmikus Exp $
4# 4#
5# Author: Andres Loeh <kosmikus@gentoo.org> 5# Author: Andres Loeh <kosmikus@gentoo.org>
6# Maintained by: Haskell herd <haskell@gentoo.org> 6# Maintained by: Haskell herd <haskell@gentoo.org>
7# 7#
8# This eclass helps with the Glasgow Haskell Compiler's package 8# This eclass helps with the Glasgow Haskell Compiler's package
14PATH="/usr/bin:/opt/ghc/bin:${PATH}" 14PATH="/usr/bin:/opt/ghc/bin:${PATH}"
15 15
16# for later configuration using environment variables/ 16# for later configuration using environment variables/
17# returns the name of the ghc executable 17# returns the name of the ghc executable
18ghc-getghc() { 18ghc-getghc() {
19 echo "ghc" 19 type -P ghc
20} 20}
21 21
22# returns the name of the ghc-pkg executable 22# returns the name of the ghc-pkg executable
23ghc-getghcpkg() { 23ghc-getghcpkg() {
24 echo "ghc-pkg" 24 type -P ghc-pkg
25} 25}
26 26
27# returns the name of the ghc-pkg binary (ghc-pkg 27# returns the name of the ghc-pkg binary (ghc-pkg
28# itself usually is a shell script, and we have to 28# itself usually is a shell script, and we have to
29# bypass the script under certain circumstances); 29# bypass the script under certain circumstances);
59# return the best version of the Cabal library that is available 59# return the best version of the Cabal library that is available
60ghc-bestcabalversion() { 60ghc-bestcabalversion() {
61 local cabalpackage 61 local cabalpackage
62 local cabalversion 62 local cabalversion
63 if ghc-cabal; then 63 if ghc-cabal; then
64 # Try if ghc-pkg can determine the latest version. 64 # We ask portage, not ghc, so that we only pick up
65 # If not, use portage. 65 # portage-installed cabal versions.
66 cabalpackage="$($(ghc-getghcpkg) latest Cabal 2> /dev/null)"
67 if [[ $? -eq 0 ]]; then
68 cabalversion="${cabalpackage#Cabal-}"
69 else
70 cabalpackage="$(best_version cabal)" 66 cabalpackage="$(best_version dev-haskell/cabal)"
71 cabalversion="${cabalpackage#dev-haskell/cabal-}" 67 cabalversion="${cabalpackage#dev-haskell/cabal-}"
72 cabalversion="${cabalversion%-r*}" 68 cabalversion="${cabalversion%-r*}"
73 cabalversion="${cabalversion%_pre*}" 69 cabalversion="${cabalversion%_pre*}"
74 fi
75 echo "Cabal-${cabalversion}" 70 echo "Cabal-${cabalversion}"
76 else 71 else
77 # older ghc's don't support package versioning 72 # older ghc's don't support package versioning
78 echo Cabal 73 echo Cabal
79 fi 74 fi
253 | sed 's:,: :g' 248 | sed 's:,: :g'
254 fi 249 fi
255 done 250 done
256} 251}
257 252
253# exported function: check if we have a consistent ghc installation
254ghc-package_pkg_setup() {
255 #place holder for sanity check of ghc vs ghc-bin version issues
256 return
257}
258
258# exported function: registers the package-specific package 259# exported function: registers the package-specific package
259# configuration file 260# configuration file
260ghc-package_pkg_postinst() { 261ghc-package_pkg_postinst() {
261 ghc-register-pkg "$(ghc-localpkgconf)" 262 ghc-register-pkg "$(ghc-localpkgconf)"
262} 263}
267# package configuration file ... 268# package configuration file ...
268ghc-package_pkg_prerm() { 269ghc-package_pkg_prerm() {
269 ghc-unregister-pkg "$(ghc-localpkgconf)" 270 ghc-unregister-pkg "$(ghc-localpkgconf)"
270} 271}
271 272
272EXPORT_FUNCTIONS pkg_postinst pkg_prerm 273EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20