/[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.9
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.9 2005/04/08 01:13:39 araujo 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"
95 [ -n "$1" ] && echo ',' >> ${localpkgconf} 96 [ -n "$1" ] && echo ',' >> ${localpkgconf}
96 done 97 done
97 echo ']' >> ${localpkgconf} 98 echo ']' >> ${localpkgconf}
98} 99}
99 100
101# fixes the library and import directories path
102# of the package configuration file
103ghc-fixlibpath() {
104 sed -i "s|$1|$(ghc-libdir)|" ${S}/$(ghc-localpkgconf)
105 if [[ -n "$2" ]]; then
106 sed -i "s|$2|$(ghc-libdir)/imports|" ${S}/$(ghc-localpkgconf)
107 fi
108}
109
100# moves the local (package-specific) package configuration 110# moves the local (package-specific) package configuration
101# file to its final destination 111# file to its final destination
102ghc-install-pkg() { 112ghc-install-pkg() {
103 mkdir -p ${D}/$(ghc-confdir) 113 mkdir -p ${D}/$(ghc-confdir)
104 cat ${S}/$(ghc-localpkgconf) | sed "s:${D}::" \ 114 cat ${S}/$(ghc-localpkgconf) | sed "s:${D}::" \
108# registers all packages in the local (package-specific) 118# registers all packages in the local (package-specific)
109# package configuration file 119# package configuration file
110ghc-register-pkg() { 120ghc-register-pkg() {
111 local localpkgconf 121 local localpkgconf
112 localpkgconf="$(ghc-confdir)/$1" 122 localpkgconf="$(ghc-confdir)/$1"
123 if [[ -f ${localpkgconf} ]]; then
113 for pkg in $(ghc-listpkg ${localpkgconf}); do 124 for pkg in $(ghc-listpkg ${localpkgconf}); do
114 einfo "Registering ${pkg} ..." 125 ebegin "Registering ${pkg} "
115 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \ 126 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \
116 | $(ghc-getghcpkg) -u --force 127 | $(ghc-getghcpkg) -u --force > /dev/null
128 eend $?
117 done 129 done
130 fi
118} 131}
119 132
120# re-adds all available .conf files to the global 133# re-adds all available .conf files to the global
121# package conf file, to be used on a ghc reinstallation 134# package conf file, to be used on a ghc reinstallation
122ghc-reregister() { 135ghc-reregister() {
123 einfo "Re-adding packages ..." 136 einfo "Re-adding packages ..."
124 ewarn "This may cause several warnings, but they should be harmless." 137 einfo "(This may cause several warnings, but they should be harmless.)"
125 if [ -d "$(ghc-confdir)" ]; then 138 if [ -d "$(ghc-confdir)" ]; then
126 pushd $(ghc-confdir) 139 pushd $(ghc-confdir) > /dev/null
127 for conf in *.conf; do 140 for conf in *.conf; do
128 einfo "Processing ${conf} ..." 141 einfo "Processing ${conf} ..."
129 ghc-register-pkg ${conf} 142 ghc-register-pkg ${conf}
130 done 143 done
131 popd 144 popd > /dev/null
132 fi 145 fi
133} 146}
134 147
135# unregisters ... 148# unregisters ...
136ghc-unregister-pkg() { 149ghc-unregister-pkg() {
137 local localpkgconf 150 local localpkgconf
138 localpkgconf="$(ghc-confdir)/$1" 151 localpkgconf="$(ghc-confdir)/$1"
152 if [[ -f ${localpkgconf} ]]; then
139 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do 153 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
140 einfo "Unregistering ${pkg} ..." 154 ebegin "Unregistering ${pkg} "
141 $(ghc-getghcpkg) -r ${pkg} --force 155 $(ghc-getghcpkg) -r ${pkg} --force > /dev/null
156 eend $?
142 done 157 done
158 fi
143} 159}
144 160
145# help-function: reverse a list 161# help-function: reverse a list
146ghc-reverse() { 162ghc-reverse() {
147 local result 163 local result

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

  ViewVC Help
Powered by ViewVC 1.1.20