| 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.9 2005/04/08 01:13:39 araujo 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 |
| 89 | ghc-setup-pkg() { |
89 | ghc-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} |
|
|
| 99 | } |
97 | } |
| 100 | |
98 | |
| 101 | # fixes the library and import directories path |
99 | # fixes the library and import directories path |
| 102 | # of the package configuration file |
100 | # of the package configuration file |
| 103 | ghc-fixlibpath() { |
101 | ghc-fixlibpath() { |
| 104 | sed -i "s|$1|$(ghc-libdir)|" ${S}/$(ghc-localpkgconf) |
102 | sed -i "s|$1|$(ghc-libdir)|g" ${S}/$(ghc-localpkgconf) |
| 105 | if [[ -n "$2" ]]; then |
103 | if [[ -n "$2" ]]; then |
| 106 | sed -i "s|$2|$(ghc-libdir)/imports|" ${S}/$(ghc-localpkgconf) |
104 | sed -i "s|$2|$(ghc-libdir)/imports|g" ${S}/$(ghc-localpkgconf) |
| 107 | fi |
105 | fi |
| 108 | } |
106 | } |
| 109 | |
107 | |
| 110 | # moves the local (package-specific) package configuration |
108 | # moves the local (package-specific) package configuration |
| 111 | # file to its final destination |
109 | # file to its final destination |
| 112 | ghc-install-pkg() { |
110 | ghc-install-pkg() { |
| 113 | mkdir -p ${D}/$(ghc-confdir) |
111 | mkdir -p ${D}/$(ghc-confdir) |
| 114 | cat ${S}/$(ghc-localpkgconf) | sed "s:${D}::" \ |
112 | cat ${S}/$(ghc-localpkgconf) | sed "s|${D}||g" \ |
| 115 | > ${D}/$(ghc-confdir)/$(ghc-localpkgconf) |
113 | > ${D}/$(ghc-confdir)/$(ghc-localpkgconf) |
| 116 | } |
114 | } |
| 117 | |
115 | |
| 118 | # registers all packages in the local (package-specific) |
116 | # registers all packages in the local (package-specific) |
| 119 | # package configuration file |
117 | # package configuration file |