/[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.29 Revision 1.32
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.29 2011/03/13 20:12:13 slyfox Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.32 2011/11/24 00:04:13 vapier Exp $
4# 4
5# @ECLASS: ghc-package.eclass 5# @ECLASS: ghc-package.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# "Gentoo's Haskell Language team" <haskell@gentoo.org> 7# "Gentoo's Haskell Language team" <haskell@gentoo.org>
8# 8# @AUTHOR:
9# Original Author: Andres Loeh <kosmikus@gentoo.org> 9# Original Author: Andres Loeh <kosmikus@gentoo.org>
10#
11# @BLURB: This eclass helps with the Glasgow Haskell Compiler's package configuration utility. 10# @BLURB: This eclass helps with the Glasgow Haskell Compiler's package configuration utility.
12# @DESCRIPTION: 11# @DESCRIPTION:
13# Helper eclass to handle ghc installation/upgrade/deinstallation process. 12# Helper eclass to handle ghc installation/upgrade/deinstallation process.
14 13
15inherit versionator 14inherit versionator
121 fi 120 fi
122 fi 121 fi
123 return 122 return
124} 123}
125 124
125# @FUNCTION: ghc-supports-shared-libraries
126# @DESCRIPTION:
127# checks if ghc is built with support for building
128# shared libraries (aka '-dynamic' option)
129ghc-supports-shared-libraries() {
130 $(ghc-getghc) --info | grep "RTS ways" | grep -q "dyn"
131}
132
126# @FUNCTION: ghc-extractportageversion 133# @FUNCTION: ghc-extractportageversion
127# @DESCRIPTION: 134# @DESCRIPTION:
128# extract the version of a portage-installed package 135# extract the version of a portage-installed package
129ghc-extractportageversion() { 136ghc-extractportageversion() {
130 local pkg 137 local pkg
169 local outfile 176 local outfile
170 outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')" 177 outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')"
171 ld --relocatable --discard-all --output="${outfile}" --whole-archive "$1" 178 ld --relocatable --discard-all --output="${outfile}" --whole-archive "$1"
172} 179}
173 180
174# @FUNCTION: ghc-makeghcilib 181# @FUNCTION: ghc-package-exists
175# @DESCRIPTION: 182# @DESCRIPTION:
176# tests if a ghc package exists 183# tests if a ghc package exists
177ghc-package-exists() { 184ghc-package-exists() {
178 local describe_flag 185 local describe_flag
179 if version_is_at_least "6.4" "$(ghc-version)"; then 186 if version_is_at_least "6.4" "$(ghc-version)"; then
280# another package configuration file 287# another package configuration file
281ghc-unregister-pkg() { 288ghc-unregister-pkg() {
282 local localpkgconf 289 local localpkgconf
283 local i 290 local i
284 local pkg 291 local pkg
285 local protected
286 local unregister_flag 292 local unregister_flag
287 localpkgconf="$(ghc-confdir)/$1" 293 localpkgconf="$(ghc-confdir)/$1"
288 294
289 if version_is_at_least "6.4" "$(ghc-version)"; then 295 if version_is_at_least "6.4" "$(ghc-version)"; then
290 unregister_flag="unregister" 296 unregister_flag="unregister"
291 else 297 else
292 unregister_flag="--remove-package" 298 unregister_flag="--remove-package"
293 fi 299 fi
294 300
295 for i in $(ghc-confdir)/*.conf; do
296 [[ "${i}" != "${localpkgconf}" ]] && protected="${protected} $(ghc-listpkg ${i})"
297 done
298 # protected now contains the packages that cannot be unregistered yet
299
300 if [[ -f "${localpkgconf}" ]]; then 301 if [[ -f "${localpkgconf}" ]]; then
301 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do 302 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
302 if $(ghc-elem "${pkg}" "${protected}"); then
303 einfo "Package ${pkg} is protected."
304 elif ! ghc-package-exists "${pkg}"; then 303 if ! ghc-package-exists "${pkg}"; then
305 :
306 # einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." 304 einfo "Package ${pkg} is not installed for ghc-$(ghc-version)."
307 else 305 else
308 ebegin "Unregistering ${pkg} " 306 ebegin "Unregistering ${pkg} "
309 $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null 307 $(ghc-getghcpkg) "${unregister_flag}" "${pkg}" --force > /dev/null
310 eend $? 308 eend $?
311 fi 309 fi
312 done 310 done
313 fi 311 fi
314} 312}
315 313
316# @FUNCTION: ghc-reverse 314# @FUNCTION: ghc-reverse

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.32

  ViewVC Help
Powered by ViewVC 1.1.20