/[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.6 Revision 1.7
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.6 2005/03/18 23:31:48 kosmikus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.7 2005/03/23 13:55:06 kosmikus Exp $
4# 4#
5# Author: Andres Loeh <kosmikus@gentoo.org> 5# Author: Andres Loeh <kosmikus@gentoo.org>
6# 6#
7# This eclass helps with the Glasgow Haskell Compiler's package 7# This eclass helps with the Glasgow Haskell Compiler's package
8# configuration utility. 8# configuration utility.
10inherit versionator 10inherit versionator
11 11
12ECLASS="ghc-package" 12ECLASS="ghc-package"
13INHERITED="${INHERITED} ${ECLASS}" 13INHERITED="${INHERITED} ${ECLASS}"
14 14
15PATH="${PATH}:/opt/ghc/bin" 15# promote /opt/ghc/bin to a better position in the search path
16PATH="/usr/bin:/opt/ghc/bin:${PATH}"
16 17
17# for later configuration using environment variables/ 18# for later configuration using environment variables/
18# returns the name of the ghc executable 19# returns the name of the ghc executable
19ghc-getghc() { 20ghc-getghc() {
20 echo "ghc" 21 echo "ghc"
108# registers all packages in the local (package-specific) 109# registers all packages in the local (package-specific)
109# package configuration file 110# package configuration file
110ghc-register-pkg() { 111ghc-register-pkg() {
111 local localpkgconf 112 local localpkgconf
112 localpkgconf="$(ghc-confdir)/$1" 113 localpkgconf="$(ghc-confdir)/$1"
114 if [[ -f ${localpkgconf} ]]; then
113 for pkg in $(ghc-listpkg ${localpkgconf}); do 115 for pkg in $(ghc-listpkg ${localpkgconf}); do
114 einfo "Registering ${pkg} ..." 116 einfo "Registering ${pkg} ..."
115 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \ 117 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \
116 | $(ghc-getghcpkg) -u --force 118 | $(ghc-getghcpkg) -u --force
117 done 119 done
120 fi
118} 121}
119 122
120# re-adds all available .conf files to the global 123# re-adds all available .conf files to the global
121# package conf file, to be used on a ghc reinstallation 124# package conf file, to be used on a ghc reinstallation
122ghc-reregister() { 125ghc-reregister() {
134 137
135# unregisters ... 138# unregisters ...
136ghc-unregister-pkg() { 139ghc-unregister-pkg() {
137 local localpkgconf 140 local localpkgconf
138 localpkgconf="$(ghc-confdir)/$1" 141 localpkgconf="$(ghc-confdir)/$1"
142 if [[ -f ${localpkgconf} ]]; then
139 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do 143 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
140 einfo "Unregistering ${pkg} ..." 144 einfo "Unregistering ${pkg} ..."
141 $(ghc-getghcpkg) -r ${pkg} --force 145 $(ghc-getghcpkg) -r ${pkg} --force
142 done 146 done
147 fi
143} 148}
144 149
145# help-function: reverse a list 150# help-function: reverse a list
146ghc-reverse() { 151ghc-reverse() {
147 local result 152 local result

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20