| 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.8 2005/04/07 22:00:20 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 | |
| 10 | inherit versionator |
10 | inherit versionator |
| 11 | |
11 | |
| 12 | ECLASS="ghc-package" |
|
|
| 13 | INHERITED="${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 |
| 16 | PATH="/usr/bin:/opt/ghc/bin:${PATH}" |
14 | PATH="/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 |
| 89 | ghc-setup-pkg() { |
87 | ghc-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 |
|
|
99 | ghc-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 |
| 103 | ghc-install-pkg() { |
108 | ghc-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 |