/[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.1 Revision 1.5
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.1 2004/11/03 15:06:41 kosmikus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.5 2004/11/24 15:05:49 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.
49# package configuration file 49# package configuration file
50ghc-localpkgconf() { 50ghc-localpkgconf() {
51 echo "${PF}.conf" 51 echo "${PF}.conf"
52} 52}
53 53
54# make a ghci foo.o file from a libfoo.a file
55ghc-makeghcilib() {
56 local outfile
57 outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')"
58 ld --relocatable --discard-all --output="${outfile}" --whole-archive $1
59}
60
54# creates an empty local (package-specific) package 61# creates a local (package-specific) package
55# configuration file 62# configuration file; the arguments should be
63# uninstalled package description files, each
64# containing a single package description; if
65# no arguments are given, the resulting file is
66# empty
56ghc-setup-pkg() { 67ghc-setup-pkg() {
68 local localpkgconf
69 localpkgconf="${S}/$(ghc-localpkgconf)"
57 echo '[]' > ${S}/$(ghc-localpkgconf) 70 echo '[' > ${localpkgconf}
71 while [ -n "$1" ]; do
72 cat "$1" >> ${localpkgconf}
73 shift
74 [ -n "$1" ] && echo ',' >> ${localpkgconf}
75 done
76 echo ']' >> ${localpkgconf}
58} 77}
59 78
60# moves the local (package-specific) package configuration 79# moves the local (package-specific) package configuration
61# file to its final destination 80# file to its final destination
62ghc-install-pkg() { 81ghc-install-pkg() {
67 86
68# registers all packages in the local (package-specific) 87# registers all packages in the local (package-specific)
69# package configuration file 88# package configuration file
70ghc-register-pkg() { 89ghc-register-pkg() {
71 local localpkgconf 90 local localpkgconf
72 localpkgconf=$(ghc-confdir)/$1 91 localpkgconf="$(ghc-confdir)/$1"
73 for pkg in $(ghc-listpkg ${localpkgconf}); do 92 for pkg in $(ghc-listpkg ${localpkgconf}); do
74 einfo "Registering ${pkg} ..." 93 einfo "Registering ${pkg} ..."
75 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \ 94 $(ghc-getghcpkgbin) -f ${localpkgconf} -s ${pkg} \
76 | $(ghc-getghcpkg) -u --auto-ghci-libs --force 95 | $(ghc-getghcpkg) -u --force
77 done 96 done
78} 97}
79 98
80# re-adds all available .conf files to the global 99# re-adds all available .conf files to the global
81# package conf file, to be used on a ghc reinstallation 100# package conf file, to be used on a ghc reinstallation
82ghc-reregister() { 101ghc-reregister() {
83 einfo "Re-adding packages ..." 102 einfo "Re-adding packages ..."
84 ewarn "This may cause several warnings, but they should be harmless." 103 ewarn "This may cause several warnings, but they should be harmless."
104 if [ -d "$(ghc-confdir)" ]; then
85 pushd $(ghc-confdir) 105 pushd $(ghc-confdir)
86 for conf in *.conf; do 106 for conf in *.conf; do
87 einfo "Processing ${conf} ..." 107 einfo "Processing ${conf} ..."
88 ghc-register-pkg ${conf} 108 ghc-register-pkg ${conf}
89 done 109 done
90 popd 110 popd
111 fi
91} 112}
92 113
93# unregisters ... 114# unregisters ...
94ghc-unregister-pkg() { 115ghc-unregister-pkg() {
95 local localpkgconf 116 local localpkgconf
96 localpkgconf=$(ghc-confdir)/$1 117 localpkgconf="$(ghc-confdir)/$1"
97 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do 118 for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do
98 einfo "Unregistering ${pkg} ..." 119 einfo "Unregistering ${pkg} ..."
99 $(ghc-getghcpkg) -r ${pkg} --force 120 $(ghc-getghcpkg) -r ${pkg} --force
100 done 121 done
101} 122}

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20