/[gentoo-x86]/eclass/xemacs-elisp-common.eclass
Gentoo

Contents of /eclass/xemacs-elisp-common.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Sep 25 18:27:12 2007 UTC (7 years, 3 months ago) by graaff
Branch: MAIN
Changes since 1.1: +60 -12 lines
Add xemacs-elisp-comp to allow compiling of interdependent elisp
files, needed for octave ebuild patch. Fix documentation. Die
consistently at the same level and document this behavior.

1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/elisp-common.eclass,v 1.20 2007/04/29 12:59:39 ulm Exp $
4 #
5 # Copyright 2007 Hans de Graaff <graaff@gentoo.org>
6 #
7 # Based on elisp-common.eclass:
8 # Copyright 2007 Christian Faulhammer <opfer@gentoo.org>
9 # Copyright 2002-2004 Matthew Kennedy <mkennedy@gentoo.org>
10 # Copyright 2004-2005 Mamoru Komachi <usata@gentoo.org>
11 # Copyright 2003 Jeremy Maitin-Shepard <jbms@attbi.com>
12 # Copyright 2007 Ulrich Mueller <ulm@gentoo.org>
13 #
14 # @ECLASS: xemacs-elisp-common.eclass
15 # @MAINTAINER:
16 # xemacs@gentoo.org
17 # @BLURB: XEmacs-related installation utilities
18 # @DESCRIPTION:
19 #
20 # Usually you want to use this eclass for (optional) XEmacs support of
21 # your package. This is NOT for GNU Emacs!
22 #
23 # Many of the steps here are sometimes done by the build system of your
24 # package (especially compilation), so this is mainly for standalone elisp
25 # files you gathered from somewhere else.
26 #
27 # When relying on the xemacs USE flag, you need to add
28 #
29 # xemacs? ( virtual/xemacs )
30 #
31 # to your DEPEND/RDEPEND line and use the functions provided here to bring
32 # the files to the correct locations.
33 #
34 # .SS
35 # src_compile() usage:
36 #
37 # An elisp file is compiled by the xemacs-elisp-compile() function
38 # defined here and simply takes the source files as arguments.
39 #
40 # xemacs-elisp-compile *.el
41 #
42 # In the case of interdependent elisp files, you can use the
43 # xemacs-elisp-comp() function which makes sure all files are
44 # loadable.
45 #
46 # xemacs-elisp-comp *.el
47 #
48 # Function xemacs-elisp-make-autoload-file() can be used to generate a
49 # file with autoload definitions for the lisp functions. It takes a
50 # list of directories (default: working directory) as its argument.
51 # Use of this function requires that the elisp source files contain
52 # magic ";;;###autoload" comments. See the XEmacs Lisp Reference Manual
53 # (node "Autoload") for a detailed explanation.
54 #
55 # .SS
56 # src_install() usage:
57 #
58 # The resulting compiled files (.elc) should be put in a subdirectory
59 # of /usr/lib/xemacs/site-lisp/ which is named after the first
60 # argument of xemacs-elisp-install(). The following parameters are
61 # the files to be put in that directory. Usually the subdirectory
62 # should be ${PN}, but you can choose something else.
63 #
64 # xemacs-elisp-install ${PN} *.el *.elc
65 #
66
67
68 SITEPACKAGE=/usr/lib/xemacs/site-packages
69 XEMACS=/usr/bin/xemacs
70 XEMACS_BATCH_CLEAN="${XEMACS} --batch --no-site-file --no-init-file"
71
72 # @FUNCTION: xemacs-elisp-compile
73 # @USAGE: <list of elisp files>
74 # @DESCRIPTION:
75 # Byte-compile elisp files with xemacs. This function will die when
76 # there is a problem compiling the lisp files.
77 xemacs-elisp-compile () {
78 {
79 ${XEMACS_BATCH_CLEAN} -f batch-byte-compile "$@"
80 xemacs-elisp-make-autoload-file "$@"
81 } || die "Compile lisp files failed"
82 }
83
84 xemacs-elisp-make-autoload-file () {
85 ${XEMACS_BATCH_CLEAN} \
86 -eval "(setq autoload-package-name \"${PN}\")" \
87 -eval "(setq generated-autoload-file \"${S}/auto-autoloads.el\")" \
88 -l autoload -f batch-update-autoloads "$@"
89 }
90
91 # @FUNCTION: xemacs-elisp-install
92 # @USAGE: <subdirectory> <list of files>
93 # @DESCRIPTION:
94 # Install elisp source and byte-compiled files. All files are installed
95 # in site-packages in their own directory, indicated by the first
96 # argument to the function. This function will die if there is a problem
97 # installing the list files.
98
99 xemacs-elisp-install () {
100 local subdir="$1"
101 shift
102 ( # use sub-shell to avoid possible environment polution
103 dodir "${SITEPACKAGE}"/lisp/"${subdir}"
104 insinto "${SITEPACKAGE}"/lisp/"${subdir}"
105 doins "$@"
106 ) || die "Installing lisp files failed"
107 }
108
109 # @FUNCTION: xemacs-elisp-comp
110 # @USAGE: <list of elisp files>
111 # @DESCRIPTION:
112 # Byte-compile interdependent XEmacs lisp files.
113 # Originally taken from GNU autotools, but some configuration options
114 # removed as they don't make sense with the current status of XEmacs
115 # in Gentoo.
116
117 xemacs-elisp-comp() {
118 # Copyright 1995 Free Software Foundation, Inc.
119 # Fran├žois Pinard <pinard@iro.umontreal.ca>, 1995.
120 # This script byte-compiles all `.el' files which are part of its
121 # arguments, using XEmacs, and put the resulting `.elc' files into
122 # the current directory, so disregarding the original directories used
123 # in `.el' arguments.
124 #
125 # This script manages in such a way that all XEmacs LISP files to
126 # be compiled are made visible between themselves, in the event
127 # they require or load-library one another.
128
129 test $# -gt 0 || return 1
130
131 einfo "Compiling XEmacs Elisp files ..."
132
133 tempdir=elc.$$
134 mkdir ${tempdir}
135 cp "$@" ${tempdir}
136 pushd ${tempdir}
137
138 echo "(add-to-list 'load-path \"../\")" > script
139 ${XEMACS_BATCH_CLEAN} -l script -f batch-byte-compile *.el
140 local ret=$?
141 mv *.elc ..
142
143 popd
144 rm -fr ${tempdir}
145 return ${ret}
146 }

  ViewVC Help
Powered by ViewVC 1.1.20