/[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.7 Revision 1.10
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.7 2005/03/23 13:55:06 kosmikus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.10 2005/05/08 14:49:25 dcoutts 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.
87# no arguments are given, the resulting file is 87# no arguments are given, the resulting file is
88# empty 88# empty
89ghc-setup-pkg() { 89ghc-setup-pkg() {
90 local localpkgconf 90 local localpkgconf
91 localpkgconf="${S}/$(ghc-localpkgconf)" 91 localpkgconf="${S}/$(ghc-localpkgconf)"
92 echo '[' > ${localpkgconf} 92 echo '[]' > ${localpkgconf}
93 while [ -n "$1" ]; do 93 for pkg in $*; do
94 cat "$1" >> ${localpkgconf} 94 $(ghc-getghcpkgbin) -f ${localpkgconf} -u --force \
95 shift 95 < ${pkg}
96 [ -n "$1" ] && echo ',' >> ${localpkgconf}
97 done 96 done
98 echo ']' >> ${localpkgconf} 97}
98
99# fixes the library and import directories path
100# of the package configuration file
101ghc-fixlibpath() {
102 sed -i "s|$1|$(ghc-libdir)|g" ${S}/$(ghc-localpkgconf)
103 if [[ -n "$2" ]]; then
104 sed -i "s|$2|$(ghc-libdir)/imports|g" ${S}/$(ghc-localpkgconf)
105 fi
99} 106}
100 107
101# moves the local (package-specific) package configuration 108# moves the local (package-specific) package configuration
102# file to its final destination 109# file to its final destination
103ghc-install-pkg() { 110ghc-install-pkg() {
104 mkdir -p ${D}/$(ghc-confdir) 111 mkdir -p ${D}/$(ghc-confdir)
105 cat ${S}/$(ghc-localpkgconf) | sed "s:${D}::" \ 112 cat ${S}/$(ghc-localpkgconf) | sed "s|${D}||g" \
106 > ${D}/$(ghc-confdir)/$(ghc-localpkgconf) 113 > ${D}/$(ghc-confdir)/$(ghc-localpkgconf)
107} 114}
108 115
109# registers all packages in the local (package-specific) 116# registers all packages in the local (package-specific)
110# package configuration file 117# package configuration file
111ghc-register-pkg() { 118ghc-register-pkg() {
112 local localpkgconf 119 local localpkgconf
113 localpkgconf="$(ghc-confdir)/$1" 120 localpkgconf="$(ghc-confdir)/$1"
114 if [[ -f ${localpkgconf} ]]; then 121 if [[ -f ${localpkgconf} ]]; then
115 for pkg in $(ghc-listpkg ${localpkgconf}); do 122 for pkg in $(ghc-listpkg ${localpkgconf}); do
116 einfo "Registering ${pkg} ..." 123 ebegin "Registering ${pkg} "
117 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \ 124 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \
118 | $(ghc-getghcpkg) -u --force 125 | $(ghc-getghcpkg) -u --force > /dev/null
126 eend $?
119 done 127 done
120 fi 128 fi
121} 129}
122 130
123# re-adds all available .conf files to the global 131# re-adds all available .conf files to the global
124# package conf file, to be used on a ghc reinstallation 132# package conf file, to be used on a ghc reinstallation
125ghc-reregister() { 133ghc-reregister() {
126 einfo "Re-adding packages ..." 134 einfo "Re-adding packages ..."
127 ewarn "This may cause several warnings, but they should be harmless." 135 einfo "(This may cause several warnings, but they should be harmless.)"
128 if [ -d "$(ghc-confdir)" ]; then 136 if [ -d "$(ghc-confdir)" ]; then
129 pushd $(ghc-confdir) 137 pushd $(ghc-confdir) > /dev/null
130 for conf in *.conf; do 138 for conf in *.conf; do
131 einfo "Processing ${conf} ..." 139 einfo "Processing ${conf} ..."
132 ghc-register-pkg ${conf} 140 ghc-register-pkg ${conf}
133 done 141 done
134 popd 142 popd > /dev/null
135 fi 143 fi
136} 144}
137 145
138# unregisters ... 146# unregisters ...
139ghc-unregister-pkg() { 147ghc-unregister-pkg() {
140 local localpkgconf 148 local localpkgconf
141 localpkgconf="$(ghc-confdir)/$1" 149 localpkgconf="$(ghc-confdir)/$1"
142 if [[ -f ${localpkgconf} ]]; then 150 if [[ -f ${localpkgconf} ]]; then
143 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do 151 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
144 einfo "Unregistering ${pkg} ..." 152 ebegin "Unregistering ${pkg} "
145 $(ghc-getghcpkg) -r ${pkg} --force 153 $(ghc-getghcpkg) -r ${pkg} --force > /dev/null
154 eend $?
146 done 155 done
147 fi 156 fi
148} 157}
149 158
150# help-function: reverse a list 159# help-function: reverse a list

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

  ViewVC Help
Powered by ViewVC 1.1.20