/[gentoo-x86]/eclass/common-lisp-common.eclass
Gentoo

Contents of /eclass/common-lisp-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download)
Sat Jun 2 19:16:31 2012 UTC (2 years, 1 month ago) by zmedico
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +3 -3 lines
inherit multilib for get_libdir

1 zmedico 1.15 # Copyright 1999-2012 Gentoo Foundation
2 mkennedy 1.1 # Distributed under the terms of the GNU General Public License v2
3 zmedico 1.15 # $Header: /var/cvsroot/gentoo-x86/eclass/common-lisp-common.eclass,v 1.14 2011/12/27 17:55:12 fauli Exp $
4 mkennedy 1.1 #
5     # Author Matthew Kennedy <mkennedy@gentoo.org>
6     #
7 mkennedy 1.6 # Sundry code common to many Common Lisp related ebuilds.
8 mkennedy 1.1
9 mkennedy 1.3 # Some handy constants
10    
11 zmedico 1.15 inherit eutils multilib
12 kugelfang 1.9
13     CLFASLROOT=/usr/$(get_libdir)/common-lisp/
14 mkennedy 1.3 CLSOURCEROOT=/usr/share/common-lisp/source/
15     CLSYSTEMROOT=/usr/share/common-lisp/systems/
16    
17     # Many of our Common Lisp ebuilds are either inspired by, or actually
18     # use packages and files from the Debian project's archives.
19    
20 mkennedy 1.1 do-debian-credits() {
21     docinto debian
22     for i in copyright README.Debian changelog; do
23 mkennedy 1.3 # be silent, since all files are not always present
24 hkbst 1.13 dodoc "${S}"/debian/${i} &>/dev/null || true
25 mkennedy 1.1 done
26     docinto .
27     }
28    
29 mkennedy 1.2 # Most of the code below is from Debian's Common Lisp Controller
30     # package
31    
32     register-common-lisp-implementation() {
33     PROGNAME=$(basename $0)
34     # first check if there is at least a compiler-name:
35     if [ -z "$1" ] ; then
36     cat <<EOF
37     usage: $PROGNAME compiler-name
38    
39     registers a Common Lisp compiler to the
40     Common-Lisp-Controller system.
41     EOF
42     exit 1
43     fi
44     IMPL=$1
45 kugelfang 1.9 FILE="/usr/$(get_libdir)/common-lisp/bin/$IMPL.sh"
46 mkennedy 1.2 if [ ! -f "$FILE" ] ; then
47     cat <<EOF
48     $PROGNAME: I cannot find the script $FILE for the implementation $IMPL
49     EOF
50     exit 2
51     fi
52     if [ ! -r "$FILE" ] ; then
53     cat <<EOF
54     $PROGNAME: I cannot read the script $FILE for the implementation $IMPL
55     EOF
56     exit 2
57     fi
58     # install CLC into the lisp
59     sh "$FILE" install-clc || (echo "Installation of CLC failed" >&2 ; exit 3)
60 kugelfang 1.9 mkdir /usr/$(get_libdir)/common-lisp/$IMPL &>/dev/null || true
61     chown cl-builder:cl-builder /usr/$(get_libdir)/common-lisp/$IMPL
62 mkennedy 1.2
63     # now recompile the stuff
64     for i in /usr/share/common-lisp/systems/*.asd ; do
65     if [ -f $i -a -r $i ] ; then
66     i=${i%.asd}
67     package=${i##*/}
68     clc-autobuild-check $IMPL $package
69     if [ $? = 0 ]; then
70     echo recompiling package $package for implementation $IMPL
71     /usr/bin/clc-send-command --quiet recompile $package $IMPL
72     fi
73     fi
74     done
75     for i in /usr/share/common-lisp/systems/*.system ; do
76     if [ -f $i -a -r $i ] ; then
77     i=${i%.system}
78     package=${i##*/}
79     clc-autobuild-check $IMPL $package
80     if [ $? = 0 ]; then
81     echo recompiling package $package for implementation $IMPL
82     /usr/bin/clc-send-command --quiet recompile $package $IMPL
83     fi
84     fi
85     done
86     echo "$PROGNAME: Compiler $IMPL installed"
87     }
88    
89     unregister-common-lisp-implementation() {
90     PROGNAME=$(basename $0)
91     if [ `id -u` != 0 ] ; then
92     echo $PROGNAME: you need to be root to run this program
93     exit 1
94     fi
95     if [ -z "$1" ] ; then
96     cat <<EOF
97     usage: $PROGNAME compiler-name
98    
99     un-registers a Common Lisp compiler to the
100     Common-Lisp-Controller system.
101     EOF
102     exit 1
103     fi
104     IMPL=$1
105 kugelfang 1.9 IMPL_BIN="/usr/$(get_libdir)/common-lisp/bin/$IMPL.sh"
106 mkennedy 1.2 if [ ! -f "$IMPL_BIN" ] ; then
107     cat <<EOF
108     $PROGNAME: No implementation of the name $IMPL is registered
109     Cannot find the file $IMPL_BIN
110    
111     Maybe you already removed it?
112     EOF
113     exit 0
114     fi
115     if [ ! -r "$IMPL_BIN" ] ; then
116     cat <<EOF
117     $PROGNAME: No implementation of the name $IMPL is registered
118     Cannot read the file $IMPL_BIN
119    
120     Maybe you already removed it?
121     EOF
122     exit 0
123     fi
124     # Uninstall the CLC
125     sh $IMPL_BIN remove-clc || echo "De-installation of CLC failed" >&2
126     clc-autobuild-impl $IMPL inherit
127     # Just remove the damn subtree
128 kugelfang 1.9 (cd / ; rm -rf "/usr/$(get_libdir)/common-lisp/$IMPL/" ; true )
129 mkennedy 1.2 echo "$PROGNAME: Common Lisp implementation $IMPL uninstalled"
130     }
131    
132     reregister-all-common-lisp-implementations() {
133     # Rebuilds all common lisp implementations
134     # Written by Kevin Rosenberg <kmr@debian.org>
135     # GPL-2 license
136 kugelfang 1.9 local clc_bin_dir=/usr/$(get_libdir)/common-lisp/bin
137 hkbst 1.11 local opt=$(shopt nullglob); shopt -s nullglob
138 mkennedy 1.2 cd $clc_bin_dir
139     for impl_bin in *.sh; do
140     impl=$(echo $impl_bin | sed 's/\(.*\).sh/\1/')
141     unregister-common-lisp-implementation $impl
142     register-common-lisp-implementation $impl
143     done
144 hkbst 1.12 cd - >/dev/null
145 hkbst 1.11 [[ $opt = *off ]] && shopt -u nullglob
146 mkennedy 1.2 }
147    
148 mkennedy 1.4 # BIG FAT HACK: Since the Portage emerge step kills file timestamp
149     # information, we need to compensate by ensuring all FASL files are
150     # more recent than their source files.
151    
152     # The following `impl-*-timestamp-hack' functions SHOULD NOT be used
153     # outside of this eclass.
154    
155     impl-save-timestamp-hack() {
156     local impl=$1
157     dodir /usr/share/${impl}
158 hkbst 1.13 tar cpjf "${D}"/usr/share/${impl}/portage-timestamp-compensate -C "${D}"/usr/$(get_libdir)/${impl} .
159 mkennedy 1.4 }
160    
161     impl-restore-timestamp-hack() {
162     local impl=$1
163 kugelfang 1.9 tar xjpfo /usr/share/${impl}/portage-timestamp-compensate -C /usr/$(get_libdir)/${impl}
164 mkennedy 1.4 }
165    
166     impl-remove-timestamp-hack() {
167     local impl=$1
168 kugelfang 1.9 rm -rf /usr/$(get_libdir)/${impl} &>/dev/null || true
169 mkennedy 1.4 }
170    
171 mkennedy 1.5 test-in() {
172     local symbol=$1
173     shift
174     for i in $@; do
175     if [ $i == ${symbol} ]; then
176     return 0 # true
177     fi
178     done
179     false
180     }
181    
182 mkennedy 1.4 standard-impl-postinst() {
183     local impl=$1
184 kugelfang 1.9 rm -rf /usr/$(get_libdir)/common-lisp/${impl}/* &>/dev/null || true
185     chown cl-builder:cl-builder /usr/$(get_libdir)/common-lisp/${impl}
186 mkennedy 1.5 if test-in ${impl} cmucl sbcl; then
187     impl-restore-timestamp-hack ${impl}
188     fi
189 mkennedy 1.10 chown -R root:0 /usr/$(get_libdir)/${impl}
190 mkennedy 1.4 /usr/bin/clc-autobuild-impl ${impl} yes
191     register-common-lisp-implementation ${impl}
192     }
193    
194     standard-impl-postrm() {
195     local impl=$1 impl_binary=$2
196     # Since we keep our own time stamps we must manually remove them
197     # here.
198     if [ ! -x ${impl_binary} ]; then
199 mkennedy 1.5 if test-in ${impl} cmucl sbcl; then
200     impl-remove-timestamp-hack ${impl}
201     fi
202 kugelfang 1.9 rm -rf /usr/$(get_libdir)/common-lisp/${impl}/*
203 mkennedy 1.4 fi
204     }
205 mkennedy 1.2
206 mkennedy 1.1 # Local Variables: ***
207     # mode: shell-script ***
208     # tab-width: 4 ***
209 vapier 1.7 # End: ***

  ViewVC Help
Powered by ViewVC 1.1.20