1 |
slyfox 15/01/01 21:23:03 |
2 |
|
3 |
Modified: ChangeLog ghc-package.eclass haskell-cabal.eclass |
4 |
Log: |
5 |
Add support for ghc-7.10 registration. User visible changes: ghc-package stopped exporting pkg_* phases and now they are reexported by haskell-cabal. pkg_* phases do not install any additional files anymore. |
6 |
|
7 |
Revision Changes Path |
8 |
1.1492 eclass/ChangeLog |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1492&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1492&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1491&r2=1.1492 |
13 |
|
14 |
Index: ChangeLog |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
17 |
retrieving revision 1.1491 |
18 |
retrieving revision 1.1492 |
19 |
diff -u -r1.1491 -r1.1492 |
20 |
--- ChangeLog 1 Jan 2015 21:09:28 -0000 1.1491 |
21 |
+++ ChangeLog 1 Jan 2015 21:23:03 -0000 1.1492 |
22 |
@@ -1,6 +1,12 @@ |
23 |
# ChangeLog for eclass directory |
24 |
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1491 2015/01/01 21:09:28 slyfox Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1492 2015/01/01 21:23:03 slyfox Exp $ |
27 |
+ |
28 |
+ 01 Jan 2015; Sergei Trofimovich <slyfox@g.o> ghc-package.eclass, |
29 |
+ haskell-cabal.eclass: |
30 |
+ Add support for ghc-7.10 registration. User visible changes: ghc-package |
31 |
+ stopped exporting pkg_* phases and now they are reexported by haskell-cabal. |
32 |
+ pkg_* phases do not install any additional files anymore. |
33 |
|
34 |
01 Jan 2015; Sergei Trofimovich <slyfox@g.o> darcs.eclass: |
35 |
Fix patch count on first clone (by vikraman). |
36 |
|
37 |
|
38 |
|
39 |
1.40 eclass/ghc-package.eclass |
40 |
|
41 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.40&view=markup |
42 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?rev=1.40&content-type=text/plain |
43 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ghc-package.eclass?r1=1.39&r2=1.40 |
44 |
|
45 |
Index: ghc-package.eclass |
46 |
=================================================================== |
47 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v |
48 |
retrieving revision 1.39 |
49 |
retrieving revision 1.40 |
50 |
diff -u -r1.39 -r1.40 |
51 |
--- ghc-package.eclass 11 Feb 2014 19:00:06 -0000 1.39 |
52 |
+++ ghc-package.eclass 1 Jan 2015 21:23:03 -0000 1.40 |
53 |
@@ -1,6 +1,6 @@ |
54 |
-# Copyright 1999-2014 Gentoo Foundation |
55 |
+# Copyright 1999-2015 Gentoo Foundation |
56 |
# Distributed under the terms of the GNU General Public License v2 |
57 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.39 2014/02/11 19:00:06 slyfox Exp $ |
58 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ghc-package.eclass,v 1.40 2015/01/01 21:23:03 slyfox Exp $ |
59 |
|
60 |
# @ECLASS: ghc-package.eclass |
61 |
# @MAINTAINER: |
62 |
@@ -36,16 +36,28 @@ |
63 |
# because for some reason the global package file |
64 |
# must be specified |
65 |
ghc-getghcpkgbin() { |
66 |
- # the ghc-pkg executable changed name in ghc 6.10, as it no longer needs |
67 |
- # the wrapper script with the static flags |
68 |
- echo '[]' > "${T}/empty.conf" |
69 |
- if version_is_at_least "7.7.20121101" "$(ghc-version)"; then |
70 |
+ if version_is_at_least "7.9.20141222" "$(ghc-version)"; then |
71 |
+ # ghc-7.10 stopped supporting single-file database |
72 |
+ local empty_db="${T}/empty.conf.d" ghc_pkg="$(ghc-libdir)/bin/ghc-pkg" |
73 |
+ if [[ ! -d ${empty_db} ]]; then |
74 |
+ "${ghc_pkg}" init "${empty_db}" || die "Failed to initialize empty global db" |
75 |
+ fi |
76 |
+ echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${empty_db}" |
77 |
+ |
78 |
+ elif version_is_at_least "7.7.20121101" "$(ghc-version)"; then |
79 |
+ # the ghc-pkg executable changed name in ghc 6.10, as it no longer needs |
80 |
+ # the wrapper script with the static flags |
81 |
# was moved to bin/ subtree by: |
82 |
# http://www.haskell.org/pipermail/cvs-ghc/2012-September/076546.html |
83 |
+ echo '[]' > "${T}/empty.conf" |
84 |
echo "$(ghc-libdir)/bin/ghc-pkg" "--global-package-db=${T}/empty.conf" |
85 |
+ |
86 |
elif version_is_at_least "7.5.20120516" "$(ghc-version)"; then |
87 |
+ echo '[]' > "${T}/empty.conf" |
88 |
echo "$(ghc-libdir)/ghc-pkg" "--global-package-db=${T}/empty.conf" |
89 |
+ |
90 |
else |
91 |
+ echo '[]' > "${T}/empty.conf" |
92 |
echo "$(ghc-libdir)/ghc-pkg" "--global-conf=${T}/empty.conf" |
93 |
fi |
94 |
} |
95 |
@@ -61,14 +73,19 @@ |
96 |
echo "${_GHC_VERSION_CACHE}" |
97 |
} |
98 |
|
99 |
-# @FUNCTION: ghc-bestcabalversion |
100 |
+# @FUNCTION: ghc-cabal-version |
101 |
# @DESCRIPTION: |
102 |
-# return the best version of the Cabal library that is available |
103 |
-ghc-bestcabalversion() { |
104 |
- # We ask portage, not ghc, so that we only pick up |
105 |
- # portage-installed cabal versions. |
106 |
- local cabalversion="$(ghc-extractportageversion dev-haskell/cabal)" |
107 |
- echo "Cabal-${cabalversion}" |
108 |
+# return version of the Cabal library bundled with ghc |
109 |
+ghc-cabal-version() { |
110 |
+ if version_is_at_least "7.9.20141222" "$(ghc-version)"; then |
111 |
+ # outputs in format: 'version: 1.18.1.5' |
112 |
+ set -- `$(ghc-getghcpkg) --package-db=$(ghc-libdir)/package.conf.d.initial field Cabal version` |
113 |
+ echo "$2" |
114 |
+ else |
115 |
+ local cabal_package=`echo "$(ghc-libdir)"/Cabal-*` |
116 |
+ # /path/to/ghc/Cabal-${VER} -> ${VER} |
117 |
+ echo "${cabal_package/*Cabal-/}" |
118 |
+ fi |
119 |
} |
120 |
|
121 |
# @FUNCTION: ghc-sanecabal |
122 |
@@ -158,26 +175,26 @@ |
123 |
|
124 |
# @FUNCTION: ghc-confdir |
125 |
# @DESCRIPTION: |
126 |
-# returns the (Gentoo) library configuration directory |
127 |
+# returns the (Gentoo) library configuration directory, we |
128 |
+# store here a hint for 'haskell-updater' about packages |
129 |
+# installed for old ghc versions and current ones. |
130 |
ghc-confdir() { |
131 |
echo "$(ghc-libdir)/gentoo" |
132 |
} |
133 |
|
134 |
-# @FUNCTION: ghc-localpkgconf |
135 |
+# @FUNCTION: ghc-package-db |
136 |
# @DESCRIPTION: |
137 |
-# returns the name of the local (package-specific) |
138 |
-# package configuration file |
139 |
-ghc-localpkgconf() { |
140 |
- echo "${PF}.conf" |
141 |
+# returns the global package database directory |
142 |
+ghc-package-db() { |
143 |
+ echo "$(ghc-libdir)/package.conf.d" |
144 |
} |
145 |
|
146 |
-# @FUNCTION: ghc-makeghcilib |
147 |
+# @FUNCTION: ghc-localpkgconfd |
148 |
# @DESCRIPTION: |
149 |
-# make a ghci foo.o file from a libfoo.a file |
150 |
-ghc-makeghcilib() { |
151 |
- local outfile |
152 |
- outfile="$(dirname $1)/$(basename $1 | sed 's:^lib\?\(.*\)\.a$:\1.o:')" |
153 |
- ld --relocatable --discard-all --output="${outfile}" --whole-archive "$1" |
154 |
+# returns the name of the local (package-specific) |
155 |
+# package configuration file |
156 |
+ghc-localpkgconfd() { |
157 |
+ echo "${PF}.conf.d" |
158 |
} |
159 |
|
160 |
# @FUNCTION: ghc-package-exists |
161 |
@@ -187,43 +204,61 @@ |
162 |
$(ghc-getghcpkg) describe "$1" > /dev/null 2>&1 |
163 |
} |
164 |
|
165 |
-# @FUNCTION: ghc-setup-pkg |
166 |
-# @DESCRIPTION: |
167 |
-# creates a local (package-specific) package |
168 |
-# configuration file; the arguments should be |
169 |
-# uninstalled package description files, each |
170 |
-# containing a single package description; if |
171 |
-# no arguments are given, the resulting file is |
172 |
-# empty |
173 |
-ghc-setup-pkg() { |
174 |
- local localpkgconf="${S}/$(ghc-localpkgconf)" |
175 |
- echo '[]' > "${localpkgconf}" |
176 |
- |
177 |
- for pkg in $*; do |
178 |
- $(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \ |
179 |
- < "${pkg}" || die "failed to register ${pkg}" |
180 |
+# @FUNCTION: check-for-collisions |
181 |
+# @DESCRIPTION: makes sure no packages |
182 |
+# have the same version as initial package setup |
183 |
+check-for-collisions() { |
184 |
+ local localpkgconf=$1 |
185 |
+ local checked_pkg |
186 |
+ local initial_pkg_db="$(ghc-libdir)/package.conf.d.initial" |
187 |
+ |
188 |
+ for checked_pkg in `$(ghc-getghcpkgbin) -f "${localpkgconf}" list --simple-output` |
189 |
+ do |
190 |
+ # should return empty output |
191 |
+ local collided=`$(ghc-getghcpkgbin) -f ${initial_pkg_db} list --simple-output "${checked_pkg}"` |
192 |
+ |
193 |
+ if [[ -n ${collided} ]]; then |
194 |
+ eerror "Package ${checked_pkg} is shipped with $(ghc-version)." |
195 |
+ eerror "Ebuild author forgot CABAL_CORE_LIB_GHC_PV entry." |
196 |
+ eerror "Found in ${initial_pkg_db}." |
197 |
+ die |
198 |
+ fi |
199 |
done |
200 |
} |
201 |
|
202 |
-# @FUNCTION: ghc-fixlibpath |
203 |
-# @DESCRIPTION: |
204 |
-# fixes the library and import directories path |
205 |
-# of the package configuration file |
206 |
-ghc-fixlibpath() { |
207 |
- sed -i "s|$1|$(ghc-libdir)|g" "${S}/$(ghc-localpkgconf)" |
208 |
- if [[ -n "$2" ]]; then |
209 |
- sed -i "s|$2|$(ghc-libdir)/imports|g" "${S}/$(ghc-localpkgconf)" |
210 |
- fi |
211 |
-} |
212 |
- |
213 |
# @FUNCTION: ghc-install-pkg |
214 |
# @DESCRIPTION: |
215 |
# moves the local (package-specific) package configuration |
216 |
# file to its final destination |
217 |
ghc-install-pkg() { |
218 |
- mkdir -p "${D}/$(ghc-confdir)" |
219 |
- cat "${S}/$(ghc-localpkgconf)" | sed "s|${D}||g" \ |
220 |
- > "${D}/$(ghc-confdir)/$(ghc-localpkgconf)" |
221 |
+ local pkg_config_file=$1 |
222 |
+ local localpkgconf="${T}/$(ghc-localpkgconfd)" |
223 |
+ local pkg_path pkg pkg_db="${D}/$(ghc-package-db)" hint_db="${D}/$(ghc-confdir)" |
224 |
+ |
225 |
+ $(ghc-getghcpkgbin) init "${localpkgconf}" || die "Failed to initialize empty local db" |
226 |
+ $(ghc-getghcpkgbin) -f "${localpkgconf}" update - --force \ |
227 |
+ < "${pkg_config_file}" || die "failed to register ${pkg}" |
228 |
+ |
229 |
+ check-for-collisions "${localpkgconf}" |
230 |
+ |
231 |
+ mkdir -p "${pkg_db}" || die |
232 |
+ for pkg_path in "${localpkgconf}"/*.conf; do |
233 |
+ pkg=$(basename "${pkg_path}") |
234 |
+ cp "${pkg_path}" "${pkg_db}/${pkg}" || die |
235 |
+ done |
236 |
+ |
237 |
+ mkdir -p "${hint_db}" || die |
238 |
+ cp "${pkg_config_file}" "${hint_db}/${PF}.conf" || die |
239 |
+ chmod 0644 "${hint_db}/${PF}.conf" || die |
240 |
+} |
241 |
+ |
242 |
+# @FUNCTION: ghc-recache-db |
243 |
+# @DESCRIPTION: |
244 |
+# updates 'package.cache' binary cacne for registered '*.conf' |
245 |
+# packages |
246 |
+ghc-recache-db() { |
247 |
+ einfo "Recaching GHC package DB" |
248 |
+ $(ghc-getghcpkg) recache |
249 |
} |
250 |
|
251 |
# @FUNCTION: ghc-register-pkg |
252 |
@@ -231,16 +266,7 @@ |
253 |
# registers all packages in the local (package-specific) |
254 |
# package configuration file |
255 |
ghc-register-pkg() { |
256 |
- local localpkgconf="$(ghc-confdir)/$1" |
257 |
- |
258 |
- if [[ -f "${localpkgconf}" ]]; then |
259 |
- for pkg in $(ghc-listpkg "${localpkgconf}"); do |
260 |
- ebegin "Registering ${pkg} " |
261 |
- $(ghc-getghcpkgbin) -f "${localpkgconf}" describe "${pkg}" \ |
262 |
- | $(ghc-getghcpkg) update - --force > /dev/null |
263 |
- eend $? |
264 |
- done |
265 |
- fi |
266 |
+ ghc-recache-db |
267 |
} |
268 |
|
269 |
# @FUNCTION: ghc-reregister |
270 |
@@ -248,99 +274,46 @@ |
271 |
# re-adds all available .conf files to the global |
272 |
# package conf file, to be used on a ghc reinstallation |
273 |
ghc-reregister() { |
274 |
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
275 |
- einfo "Re-adding packages (may cause several harmless warnings) ..." |
276 |
- PATH="${EPREFIX}/usr/bin:${PATH}" CONFDIR="$(ghc-confdir)" |
277 |
- if [ -d "${CONFDIR}" ]; then |
278 |
- pushd "${CONFDIR}" > /dev/null |
279 |
- for conf in *.conf; do |
280 |
- PATH="${EPREFIX}/usr/bin:${PATH}" ghc-register-pkg "${conf}" |
281 |
- done |
282 |
- popd > /dev/null |
283 |
- fi |
284 |
+ ghc-recache-db |
285 |
} |
286 |
|
287 |
# @FUNCTION: ghc-unregister-pkg |
288 |
# @DESCRIPTION: |
289 |
# unregisters a package configuration file |
290 |
-# protected are all packages that are still contained in |
291 |
-# another package configuration file |
292 |
ghc-unregister-pkg() { |
293 |
- local localpkgconf="$(ghc-confdir)/$1" |
294 |
- local i |
295 |
- local pkg |
296 |
- |
297 |
- if [[ -f "${localpkgconf}" ]]; then |
298 |
- for pkg in $(ghc-reverse "$(ghc-listpkg ${localpkgconf})"); do |
299 |
- if ! ghc-package-exists "${pkg}"; then |
300 |
- einfo "Package ${pkg} is not installed for ghc-$(ghc-version)." |
301 |
- else |
302 |
- ebegin "Unregistering ${pkg} " |
303 |
- $(ghc-getghcpkg) unregister "${pkg}" --force > /dev/null |
304 |
- eend $? |
305 |
- fi |
306 |
- done |
307 |
- fi |
308 |
-} |
309 |
- |
310 |
-# @FUNCTION: ghc-reverse |
311 |
-# @DESCRIPTION: |
312 |
-# help-function: reverse a list |
313 |
-ghc-reverse() { |
314 |
- local result |
315 |
- local i |
316 |
- for i in $1; do |
317 |
- result="${i} ${result}" |
318 |
- done |
319 |
- echo "${result}" |
320 |
+ ghc-recache-db |
321 |
} |
322 |
|
323 |
-# @FUNCTION: ghc-elem |
324 |
+# @FUNCTION: ghc-pkgdeps |
325 |
# @DESCRIPTION: |
326 |
-# help-function: element-check |
327 |
-ghc-elem() { |
328 |
- local i |
329 |
- for i in $2; do |
330 |
- [[ "$1" == "${i}" ]] && return 0 |
331 |
- done |
332 |
- return 1 |
333 |
-} |
334 |
- |
335 |
-# @FUNCTION: ghc-listpkg |
336 |
-# @DESCRIPTION: |
337 |
-# show the packages in a package configuration file |
338 |
-ghc-listpkg() { |
339 |
- local ghcpkgcall |
340 |
- local i |
341 |
- local extra_flags |
342 |
- if version_is_at_least '6.12.3' "$(ghc-version)"; then |
343 |
- extra_flags="${extra_flags} -v0" |
344 |
- fi |
345 |
- for i in $*; do |
346 |
- echo $($(ghc-getghcpkg) list ${extra_flags} -f "${i}") \ |
347 |
- | sed \ |
348 |
- -e "s|^.*${i}:\([^:]*\).*$|\1|" \ |
349 |
- -e "s|/.*$||" \ |
350 |
- -e "s|,| |g" -e "s|[(){}]||g" |
351 |
- done |
352 |
+# exported function: loads a package dependency in a form |
353 |
+# cabal_package version |
354 |
+ghc-pkgdeps() { |
355 |
+ echo $($(ghc-getghcpkg) describe "${1}") \ |
356 |
+ | sed \ |
357 |
+ -e '/depends/,/^.*:/ !d' \ |
358 |
+ -e 's/\(.*\)-\(.*\)-\(.*\)/\1 \2/' \ |
359 |
+ -e 's/^.*://g' |
360 |
} |
361 |
|
362 |
# @FUNCTION: ghc-package_pkg_postinst |
363 |
# @DESCRIPTION: |
364 |
-# exported function: registers the package-specific package |
365 |
-# configuration file |
366 |
+# updates package.cache after package install |
367 |
ghc-package_pkg_postinst() { |
368 |
- ghc-register-pkg "$(ghc-localpkgconf)" |
369 |
+ ghc-recache-db |
370 |
} |
371 |
|
372 |
# @FUNCTION: ghc-package_pkg_prerm |
373 |
# @DESCRIPTION: |
374 |
-# exported function: unregisters the package-specific package |
375 |
-# configuration file; a package contained therein is unregistered |
376 |
-# only if it the same package is not also contained in another |
377 |
-# package configuration file ... |
378 |
+# updates package.cache after package deinstall |
379 |
ghc-package_pkg_prerm() { |
380 |
- ghc-unregister-pkg "$(ghc-localpkgconf)" |
381 |
+ ewarn "ghc-package.eclass: 'ghc-package_pkg_prerm()' is a noop" |
382 |
+ ewarn "ghc-package.eclass: consider 'haskell-cabal_pkg_postrm()' instead" |
383 |
} |
384 |
|
385 |
-EXPORT_FUNCTIONS pkg_postinst pkg_prerm |
386 |
+# @FUNCTION: ghc-package_pkg_postrm |
387 |
+# @DESCRIPTION: |
388 |
+# updates package.cache after package deinstall |
389 |
+ghc-package_pkg_postrm() { |
390 |
+ ghc-recache-db |
391 |
+} |
392 |
|
393 |
|
394 |
|
395 |
1.47 eclass/haskell-cabal.eclass |
396 |
|
397 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.47&view=markup |
398 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?rev=1.47&content-type=text/plain |
399 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/haskell-cabal.eclass?r1=1.46&r2=1.47 |
400 |
|
401 |
Index: haskell-cabal.eclass |
402 |
=================================================================== |
403 |
RCS file: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v |
404 |
retrieving revision 1.46 |
405 |
retrieving revision 1.47 |
406 |
diff -u -r1.46 -r1.47 |
407 |
--- haskell-cabal.eclass 27 Jun 2014 07:26:18 -0000 1.46 |
408 |
+++ haskell-cabal.eclass 1 Jan 2015 21:23:03 -0000 1.47 |
409 |
@@ -1,6 +1,6 @@ |
410 |
-# Copyright 1999-2014 Gentoo Foundation |
411 |
+# Copyright 1999-2015 Gentoo Foundation |
412 |
# Distributed under the terms of the GNU General Public License v2 |
413 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.46 2014/06/27 07:26:18 slyfox Exp $ |
414 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/haskell-cabal.eclass,v 1.47 2015/01/01 21:23:03 slyfox Exp $ |
415 |
|
416 |
# @ECLASS: haskell-cabal.eclass |
417 |
# @MAINTAINER: |
418 |
@@ -31,6 +31,9 @@ |
419 |
# nocabaldep -- don't add dependency on cabal. |
420 |
# only used for packages that _must_ not pull the dependency |
421 |
# on cabal, but still use this eclass (e.g. haskell-updater). |
422 |
+# ghcdeps -- constraint dependency on package to ghc onces |
423 |
+# only used for packages that use libghc internally and _must_ |
424 |
+# not pull upper versions |
425 |
# test-suite -- add support for cabal test-suites (introduced in Cabal-1.8) |
426 |
|
427 |
inherit eutils ghc-package multilib multiprocessing |
428 |
@@ -61,7 +64,7 @@ |
429 |
# Needs working 'diff'. |
430 |
: ${CABAL_DEBUG_LOOSENING:=} |
431 |
|
432 |
-HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install" |
433 |
+HASKELL_CABAL_EXPF="pkg_setup src_compile src_test src_install pkg_postinst pkg_postrm" |
434 |
|
435 |
# 'dev-haskell/cabal' passes those options with ./configure-based |
436 |
# configuration, but most packages don't need/don't accept it: |
437 |
@@ -89,6 +92,7 @@ |
438 |
bin) CABAL_HAS_BINARIES=yes;; |
439 |
lib) CABAL_HAS_LIBRARIES=yes;; |
440 |
nocabaldep) CABAL_FROM_GHC=yes;; |
441 |
+ ghcdeps) CABAL_GHC_CONSTRAINT=yes;; |
442 |
test-suite) CABAL_TEST_SUITE=yes;; |
443 |
*) CABAL_UNKNOWN="${CABAL_UNKNOWN} ${feature}";; |
444 |
esac |
445 |
@@ -106,6 +110,11 @@ |
446 |
DEPEND="${DEPEND} hscolour? ( dev-haskell/hscolour )" |
447 |
fi |
448 |
|
449 |
+if [[ -n "${CABAL_USE_HOOGLE}" ]]; then |
450 |
+ # enabled only in ::gentoo-haskell |
451 |
+ : |
452 |
+fi |
453 |
+ |
454 |
if [[ -n "${CABAL_USE_ALEX}" ]]; then |
455 |
DEPEND="${DEPEND} dev-haskell/alex" |
456 |
fi |
457 |
@@ -148,9 +157,7 @@ |
458 |
# of this package itself. |
459 |
_CABAL_VERSION_CACHE="${PV}" |
460 |
elif [[ "${CABAL_FROM_GHC}" ]]; then |
461 |
- local cabal_package=$(echo "$(ghc-libdir)"/Cabal-*) |
462 |
- # /path/to/ghc/Cabal-${VER} -> ${VER} |
463 |
- _CABAL_VERSION_CACHE="${cabal_package/*Cabal-/}" |
464 |
+ _CABAL_VERSION_CACHE="$(ghc-cabal-version)" |
465 |
else |
466 |
# We ask portage, not ghc, so that we only pick up |
467 |
# portage-installed cabal versions. |
468 |
@@ -237,6 +244,10 @@ |
469 |
./setup "$@" || die "setup haddock failed" |
470 |
} |
471 |
|
472 |
+cabal-hoogle() { |
473 |
+ ewarn "hoogle USE flag requires doc USE flag, building without hoogle" |
474 |
+} |
475 |
+ |
476 |
cabal-hscolour-haddock() { |
477 |
# --hyperlink-source implies calling 'setup hscolour' |
478 |
set -- haddock --hyperlink-source |
479 |
@@ -244,6 +255,22 @@ |
480 |
./setup "$@" --hyperlink-source || die "setup haddock --hyperlink-source failed" |
481 |
} |
482 |
|
483 |
+cabal-hoogle-haddock() { |
484 |
+ set -- haddock --hoogle |
485 |
+ echo ./setup "$@" |
486 |
+ ./setup "$@" || die "setup haddock --hoogle failed" |
487 |
+} |
488 |
+ |
489 |
+cabal-hoogle-hscolour-haddock() { |
490 |
+ cabal-hscolour-haddock |
491 |
+ cabal-hoogle-haddock |
492 |
+} |
493 |
+ |
494 |
+cabal-hoogle-hscolour() { |
495 |
+ ewarn "hoogle USE flag requires doc USE flag, building without hoogle" |
496 |
+ cabal-hscolour |
497 |
+} |
498 |
+ |
499 |
cabal-die-if-nonempty() { |
500 |
local breakage_type=$1 |
501 |
shift |
502 |
@@ -305,6 +332,10 @@ |
503 |
cabalconf+=($(use_enable test tests)) |
504 |
fi |
505 |
|
506 |
+ if [[ -n "${CABAL_GHC_CONSTRAINT}" ]]; then |
507 |
+ cabalconf+=($(cabal-constraint "ghc")) |
508 |
+ fi |
509 |
+ |
510 |
local option |
511 |
for option in ${HCFLAGS} |
512 |
do |
513 |
@@ -413,8 +444,7 @@ |
514 |
if [[ -n ${CABAL_HAS_LIBRARIES} ]]; then |
515 |
# Newer cabal can generate a package conf for us: |
516 |
./setup register --gen-pkg-config="${T}/${P}.conf" |
517 |
- ghc-setup-pkg "${T}/${P}.conf" |
518 |
- ghc-install-pkg |
519 |
+ ghc-install-pkg "${T}/${P}.conf" |
520 |
fi |
521 |
} |
522 |
|
523 |
@@ -487,16 +517,36 @@ |
524 |
|
525 |
if [[ -n "${CABAL_USE_HADDOCK}" ]] && use doc; then |
526 |
if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then |
527 |
- # hscolour and haddock |
528 |
- cabal-hscolour-haddock |
529 |
+ if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then |
530 |
+ # hoogle, hscolour and haddock |
531 |
+ cabal-hoogle-hscolour-haddock |
532 |
+ else |
533 |
+ # haddock and hscolour |
534 |
+ cabal-hscolour-haddock |
535 |
+ fi |
536 |
else |
537 |
- # just haddock |
538 |
- cabal-haddock |
539 |
+ if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then |
540 |
+ # hoogle and haddock |
541 |
+ cabal-hoogle-haddock |
542 |
+ else |
543 |
+ # just haddock |
544 |
+ cabal-haddock |
545 |
+ fi |
546 |
fi |
547 |
else |
548 |
if [[ -n "${CABAL_USE_HSCOLOUR}" ]] && use hscolour; then |
549 |
- # just hscolour |
550 |
- cabal-hscolour |
551 |
+ if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then |
552 |
+ # hoogle and hscolour |
553 |
+ cabal-hoogle-hscolour |
554 |
+ else |
555 |
+ # just hscolour |
556 |
+ cabal-hscolour |
557 |
+ fi |
558 |
+ else |
559 |
+ if [[ -n "${CABAL_USE_HOOGLE}" ]] && use hoogle; then |
560 |
+ # just hoogle |
561 |
+ cabal-hoogle |
562 |
+ fi |
563 |
fi |
564 |
fi |
565 |
} |
566 |
@@ -538,27 +588,10 @@ |
567 |
local ghc_confdir_with_prefix="$(ghc-confdir)" |
568 |
# remove EPREFIX |
569 |
dodir ${ghc_confdir_with_prefix#${EPREFIX}} |
570 |
- local conf_file="${D}/$(ghc-confdir)/$(ghc-localpkgconf)" |
571 |
- [[ -e $conf_file ]] || echo '[]' > "$conf_file" || die |
572 |
- |
573 |
- # make sure installed packages do not destroy ghc's |
574 |
- # bundled packages |
575 |
- local initial_pkg_db=${ROOT}/$(ghc-libdir)/package.conf.d.initial |
576 |
- if [[ -e ${initial_pkg_db} ]]; then |
577 |
- local checked_pkg |
578 |
- for checked_pkg in $(ghc-listpkg "${conf_file}") |
579 |
- do |
580 |
- local initial_pkg |
581 |
- for initial_pkg in $(ghc-listpkg "${initial_pkg_db}"); do |
582 |
- if [[ ${checked_pkg} = ${initial_pkg} ]]; then |
583 |
- eerror "Package ${checked_pkg} is shipped with $(ghc-version)." |
584 |
- eerror "Ebuild author forgot CABAL_CORE_LIB_GHC_PV entry." |
585 |
- eerror "Found in ${initial_pkg_db}." |
586 |
- die |
587 |
- fi |
588 |
- done |
589 |
- done |
590 |
- fi |
591 |
+ local hint_db="${D}/$(ghc-confdir)" |
592 |
+ local hint_file="${hint_db}/${PF}.conf" |
593 |
+ mkdir -p "${hint_db}" || die |
594 |
+ touch "${hint_file}" || die |
595 |
} |
596 |
|
597 |
haskell-cabal_src_install() { |
598 |
@@ -569,6 +602,14 @@ |
599 |
popd > /dev/null |
600 |
} |
601 |
|
602 |
+haskell-cabal_pkg_postinst() { |
603 |
+ ghc-package_pkg_postinst |
604 |
+} |
605 |
+ |
606 |
+haskell-cabal_pkg_postrm() { |
607 |
+ ghc-package_pkg_postrm |
608 |
+} |
609 |
+ |
610 |
# @FUNCTION: cabal_flag |
611 |
# @DESCRIPTION: |
612 |
# ebuild.sh:use_enable() taken as base |
613 |
@@ -666,6 +707,16 @@ |
614 |
die "failed to update" |
615 |
} |
616 |
|
617 |
+# @FUNCTION: cabal-constraint |
618 |
+# @DESCRIPTION: |
619 |
+# Allowes to set contraint to the libraries that are |
620 |
+# used by specified package |
621 |
+cabal-constraint() { |
622 |
+ while read p v ; do |
623 |
+ echo "--constraint \"$p == $v\"" |
624 |
+ done < $(ghc-pkgdeps ${1}) |
625 |
+} |
626 |
+ |
627 |
# @FUNCTION: replace-hcflags |
628 |
# @USAGE: <old> <new> |
629 |
# @DESCRIPTION: |