| 1 | # Copyright 1999-2007 Gentoo Foundation |
1 | # Copyright 1999-2007 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/elisp-common.eclass,v 1.29 2007/10/14 22:12:30 ulm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.30 2007/11/17 15:39:35 ulm Exp $ |
| 4 | # |
4 | # |
| 5 | # Copyright 2007 Christian Faulhammer <opfer@gentoo.org> |
5 | # Copyright 2007 Christian Faulhammer <opfer@gentoo.org> |
| 6 | # Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org> |
6 | # Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org> |
| 7 | # Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org> |
7 | # Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org> |
| 8 | # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> |
8 | # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com> |
| … | |
… | |
| 137 | # Name of package's site-init file. |
137 | # Name of package's site-init file. |
| 138 | SITEFILE=50${PN}-gentoo.el |
138 | SITEFILE=50${PN}-gentoo.el |
| 139 | |
139 | |
| 140 | EMACS=/usr/bin/emacs |
140 | EMACS=/usr/bin/emacs |
| 141 | # The following works for Emacs versions 18--23, don't change it. |
141 | # The following works for Emacs versions 18--23, don't change it. |
| 142 | EMACS_BATCH_CLEAN="${EMACS} -batch -q --no-site-file" |
142 | EMACSFLAGS="-batch -q --no-site-file" |
| 143 | |
143 | |
| 144 | # @FUNCTION: elisp-compile |
144 | # @FUNCTION: elisp-compile |
| 145 | # @USAGE: <list of elisp files> |
145 | # @USAGE: <list of elisp files> |
| 146 | # @DESCRIPTION: |
146 | # @DESCRIPTION: |
| 147 | # Byte-compile Emacs Lisp files. |
147 | # Byte-compile Emacs Lisp files. |
| 148 | |
148 | |
| 149 | elisp-compile() { |
149 | elisp-compile() { |
| 150 | einfo "Compiling GNU Emacs Elisp files ..." |
150 | einfo "Compiling GNU Emacs Elisp files ..." |
| 151 | ${EMACS_BATCH_CLEAN} -f batch-byte-compile "$@" |
151 | ${EMACS} ${EMACSFLAGS} -f batch-byte-compile "$@" |
|
|
152 | } |
|
|
153 | |
|
|
154 | # @FUNCTION: elisp-comp |
|
|
155 | # @USAGE: <list of elisp files> |
|
|
156 | # @DESCRIPTION: |
|
|
157 | # Byte-compile interdependent Emacs Lisp files. |
|
|
158 | # |
|
|
159 | # This function byte-compiles all ".el" files which are part of its |
|
|
160 | # arguments, using GNU Emacs, and puts the resulting ".elc" files into the |
|
|
161 | # current directory, so disregarding the original directories used in ".el" |
|
|
162 | # arguments. |
|
|
163 | # |
|
|
164 | # This function manages in such a way that all Emacs Lisp files to be |
|
|
165 | # compiled are made visible between themselves, in the event they require or |
|
|
166 | # load one another. |
|
|
167 | |
|
|
168 | elisp-comp() { |
|
|
169 | # Copyright 1995 Free Software Foundation, Inc. |
|
|
170 | # François Pinard <pinard@iro.umontreal.ca>, 1995. |
|
|
171 | # Originally taken from GNU autotools. |
|
|
172 | |
|
|
173 | [ $# -gt 0 ] || return 1 |
|
|
174 | |
|
|
175 | einfo "Compiling GNU Emacs Elisp files ..." |
|
|
176 | |
|
|
177 | tempdir=elc.$$ |
|
|
178 | mkdir ${tempdir} |
|
|
179 | cp "$@" ${tempdir} |
|
|
180 | pushd ${tempdir} |
|
|
181 | |
|
|
182 | echo "(add-to-list 'load-path \"../\")" > script |
|
|
183 | ${EMACS} ${EMACSFLAGS} -l script -f batch-byte-compile *.el |
|
|
184 | local ret=$? |
|
|
185 | mv *.elc .. |
|
|
186 | |
|
|
187 | popd |
|
|
188 | rm -fr ${tempdir} |
|
|
189 | return ${ret} |
| 152 | } |
190 | } |
| 153 | |
191 | |
| 154 | # @FUNCTION: elisp-emacs-version |
192 | # @FUNCTION: elisp-emacs-version |
| 155 | # @DESCRIPTION: |
193 | # @DESCRIPTION: |
| 156 | # Output version of currently active Emacs. |
194 | # Output version of currently active Emacs. |
| 157 | |
195 | |
| 158 | elisp-emacs-version() { |
196 | elisp-emacs-version() { |
| 159 | # The following will work for at least versions 18-23. |
197 | # The following will work for at least versions 18-23. |
| 160 | echo "(princ emacs-version)" >"${T}"/emacs-version.el |
198 | echo "(princ emacs-version)" >"${T}"/emacs-version.el |
| 161 | ${EMACS_BATCH_CLEAN} -l "${T}"/emacs-version.el |
199 | ${EMACS} ${EMACSFLAGS} -l "${T}"/emacs-version.el |
| 162 | } |
200 | } |
| 163 | |
201 | |
| 164 | # @FUNCTION: elisp-make-autoload-file |
202 | # @FUNCTION: elisp-make-autoload-file |
| 165 | # @USAGE: [output file] [list of directories] |
203 | # @USAGE: [output file] [list of directories] |
| 166 | # @DESCRIPTION: |
204 | # @DESCRIPTION: |
| … | |
… | |
| 186 | ;; no-update-autoloads: t |
224 | ;; no-update-autoloads: t |
| 187 | ;; End: |
225 | ;; End: |
| 188 | ;;; ${f##*/} ends here |
226 | ;;; ${f##*/} ends here |
| 189 | EOF |
227 | EOF |
| 190 | |
228 | |
| 191 | ${EMACS_BATCH_CLEAN} \ |
229 | ${EMACS} ${EMACSFLAGS} \ |
| 192 | --eval "(setq make-backup-files nil)" \ |
230 | --eval "(setq make-backup-files nil)" \ |
| 193 | --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \ |
231 | --eval "(setq generated-autoload-file (expand-file-name \"${f}\"))" \ |
| 194 | -f batch-update-autoloads "${@-.}" |
232 | -f batch-update-autoloads "${@-.}" |
| 195 | } |
233 | } |
| 196 | |
234 | |
| … | |
… | |
| 311 | initialisation files in /usr/share/emacs/site-lisp/ to load. |
349 | initialisation files in /usr/share/emacs/site-lisp/ to load. |
| 312 | EOF |
350 | EOF |
| 313 | echo |
351 | echo |
| 314 | fi |
352 | fi |
| 315 | } |
353 | } |
| 316 | |
|
|
| 317 | # @FUNCTION: elisp-comp |
|
|
| 318 | # @USAGE: <list of elisp files> |
|
|
| 319 | # @DESCRIPTION: |
|
|
| 320 | # Byte-compile interdependent Emacs Lisp files. |
|
|
| 321 | # |
|
|
| 322 | # This function byte-compiles all ".el" files which are part of its |
|
|
| 323 | # arguments, using GNU Emacs, and puts the resulting ".elc" files into the |
|
|
| 324 | # current directory, so disregarding the original directories used in ".el" |
|
|
| 325 | # arguments. |
|
|
| 326 | # |
|
|
| 327 | # This function manages in such a way that all Emacs Lisp files to be |
|
|
| 328 | # compiled are made visible between themselves, in the event they require or |
|
|
| 329 | # load one another. |
|
|
| 330 | |
|
|
| 331 | elisp-comp() { |
|
|
| 332 | # Copyright 1995 Free Software Foundation, Inc. |
|
|
| 333 | # François Pinard <pinard@iro.umontreal.ca>, 1995. |
|
|
| 334 | # Originally taken from GNU autotools. |
|
|
| 335 | |
|
|
| 336 | test $# -gt 0 || return 1 |
|
|
| 337 | |
|
|
| 338 | if test -z "${EMACS}" || test "${EMACS}" = "t"; then |
|
|
| 339 | # Value of "t" means we are running in a shell under Emacs. |
|
|
| 340 | # Just assume Emacs is called "emacs". |
|
|
| 341 | EMACS=/usr/bin/emacs |
|
|
| 342 | fi |
|
|
| 343 | einfo "Compiling GNU Emacs Elisp files ..." |
|
|
| 344 | |
|
|
| 345 | tempdir=elc.$$ |
|
|
| 346 | mkdir ${tempdir} |
|
|
| 347 | cp "$@" ${tempdir} |
|
|
| 348 | pushd ${tempdir} |
|
|
| 349 | |
|
|
| 350 | echo "(add-to-list 'load-path \"../\")" > script |
|
|
| 351 | ${EMACS_BATCH_CLEAN} -l script -f batch-byte-compile *.el |
|
|
| 352 | local ret=$? |
|
|
| 353 | mv *.elc .. |
|
|
| 354 | |
|
|
| 355 | popd |
|
|
| 356 | rm -fr ${tempdir} |
|
|
| 357 | return ${ret} |
|
|
| 358 | } |
|
|