dev-util/qbs: version bump
[gentoo.git] / eclass / common-lisp-common-2.eclass
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4 #
5 # Author Matthew Kennedy <mkennedy@gentoo.org>
6 #
7 # Sundry code common to many Common Lisp related ebuilds.
8
9 # Some handy constants
10
11 inherit eutils multilib
12
13 CLSOURCEROOT=/usr/share/common-lisp/source/
14 CLSYSTEMROOT=/usr/share/common-lisp/systems/
15
16 # Many of our Common Lisp ebuilds are either inspired by, or actually
17 # use packages and files from the Debian project's archives.
18
19 do-debian-credits() {
20         docinto debian
21         for i in copyright README.Debian changelog; do
22                 test -f $i && dodoc "${S}"/debian/${i}
23         done
24         docinto .
25 }
26
27 # BIG FAT HACK: Since the Portage emerge step kills file timestamp
28 # information, we need to compensate by ensuring all FASL files are
29 # more recent than their source files.
30
31 # The following `impl-*-timestamp-hack' functions SHOULD NOT be used
32 # outside of this eclass.
33
34 impl-save-timestamp-hack() {
35         local impl=$1
36         dodir /usr/share/${impl}
37         tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
38 }
39
40 impl-restore-timestamp-hack() {
41         local impl=$1
42         tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
43 }
44
45 impl-remove-timestamp-hack() {
46         local impl=$1
47         rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
48 }
49
50 standard-impl-postinst() {
51         local impl=$1
52         unregister-common-lisp-implementation cmucl
53         case ${impl} in
54                 cmucl|sbcl)
55                         impl-restore-timestamp-hack ${impl}
56                         ;;
57                 *)
58                         ;;
59         esac
60         register-common-lisp-implementation ${impl}
61 }
62
63 standard-impl-postrm() {
64         local impl=$1 impl_binary=$2
65         if [ ! -x ${impl_binary} ]; then
66                 case ${impl} in
67                         cmucl|sbcl)
68                                 impl-remove-timestamp-hack ${impl}
69                                 ;;
70                         *)
71                                 ;;
72                 esac
73                 rm -rf /var/cache/common-lisp-controller/*/${impl}
74         fi
75 }
76
77 # Local Variables: ***
78 # mode: shell-script ***
79 # tab-width: 4 ***
80 # End: ***