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

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

  ViewVC Help
Powered by ViewVC 1.1.20