2 @c This is part of the XEmacs Lisp Reference Manual.
3 @c Copyright (C) 2001 Free Software Foundation, Inc.
4 @c See the file lispref.texi for copying conditions.
6 @setfilename ../../info/packaging.info
8 @c Macro to make formatting of the XEmacs pms name consistent.
9 @c Maybe @sc looks OK in HTML? If so, condition on Info.
12 XE@sc{macs} Packaging System
17 XEmacs Packaging System
21 @node Packaging, Lisp Data Types, Introduction, Top
26 The XEmacs distribution, starting with version 21, comes only with a
27 very basic set of built-in modes and libraries. Most of the libraries
28 that were part of the distribution of earlier versions of XEmacs are now
29 available separately. The user as well as the system administrator can
30 choose which packages to install; the actual installation process is
31 easy. This gives an installer the ability to tailor an XEmacs
32 installation for local needs with safe removal of unnecessary code.
34 This chapter describes how to package Lisp libraries for use with the
37 @emph{Please note carefully} that the term @dfn{package} as used in
38 XEmacs refers to an aggregation of Lisp code and/or data distributed as
39 a unit. It does not, as it does in many Lisps, refer to a way of
40 creating separate name spaces. XEmacs has no facility for providing
41 separate name spaces. (If we ever do get separate name spaces, we'll
42 probably regret overloading the nomenclature in this way, but it's
47 * Package Overview:: Lisp Libraries and Packages.
49 Packaging Lisp Libraries:
50 * Package Terminology:: Basic stuff.
51 * Building Packages:: Turn packaged source into a tarball.
52 * Local.rules File:: Tell the @xpms{} about your host.
53 * Creating Packages:: Tell the @xpms{} about your package.
54 @c * History:: History of the @xpms{}
55 @c * Installation:: Installing the @xpms{} with your (X)Emacs.
56 @c * Configuration:: Configuring the @xpms{} for use.
57 @c * Usage:: An overview of the operation of the @xpms{}.
58 @c * Bug Reports:: Reporting Bugs and Problems
59 @c * Frequently Asked Questions:: Questions and answers from the mailing list.
61 Internals and Package Release Engineering:
65 @node Package Overview, Package Terminology, , Packaging
66 @chapter An overview of the @xpms{}
68 The @xpms{} is a system for administering the installation, upgrade, and
69 removal of Lisp libraries. For the end user, it provides facilities for
70 determining availability of packages and which versions at remote
71 sites. It will download and automatically install a package, ensuring
72 that any old files from previous versions of the package are removed
73 first. By providing a standard set of hierarchies for installation, it
74 makes configuration of XEmacs simpler. Furthermore, packages normally
75 provide ancillary auto-autoloads and custom-loads libraries, which are
76 automatically detected and loaded by XEmacs upon startup. This means
77 that once installed, all facilities of package, including autoloading
78 the library upon invocation of a command provided by the library and
79 convenient configuration and customization, are automatically available
80 to the user. There is no need to add autoloads or keybindings to in the
81 init file, and structured configuration of the package is available
82 through the Customize system even before the libraries are loaded.
84 All of this convenience comes at a cost. The cost of administration at
85 the package level is negligible compared to the benefits, of course.
86 However, the requirement that XEmacs find and load auto-autoloads and
87 custom-loads libraries comes at a fairly large cost in startup time. In
88 order to reduce this cost, XEmacs imposes fairly strict conditions on
89 the structure of an installed package.
91 Meeting these requirements, as well as simply providing the
92 auto-autoloads and the information about availability and so on does
93 impose some costs on the library maintainer. The @xpms{} also provides
94 structure and utilities to the library maintainer to make these tasks
95 easier. This manual documents the requirements and the tools that the
96 @xpms{} provides to ensure that a package satisfies them.
100 * The Library Maintainer's View::
101 * The Package Release Engineer's View::
105 @node The User's View, The Library Maintainer's View, , Package Overview
106 @section The User's View
108 @strong{N.B.} Much of the discussion in this section undoubtedly
109 belongs elsewhere, @ref{Packages,,,xemacs}.
111 From the user's point of view, an XEmacs binary package is simply a
112 standard tarball (usually gzipped) containing Lisp sources, compiled
113 Lisp, documentation, and possibly data files or supporting executables.
114 The tarball is unpacked using standard tools such as GNU tar and gzip.
115 The package system does impose certain requirements for automatic
116 configuration to work.
118 Here the main consideration is that the tarball ``expects'' to be
119 unpacked from the top of a package hierarchy. A @dfn{package hierarchy}
120 is basically an image of a classic Emacs ``run-in-place'' tree, with
121 @file{lisp}, @file{etc}, @file{info}, @file{man}, @file{lib-src}, and
122 @file{pkginfo} subdirectories of the top. The @file{pkginfo}
123 subdirectory is for use by the @xpms{} administration tools, and
124 currently contains a @file{MANIFEST.@var{package-name}} file for each
125 package to ensure that no cruft remains when a package is removed or
126 updated. The @file{lisp}, @file{etc}, and @file{lib-src} subdirectories
127 are further subdivided, with a subdirectory for each package. The
128 @file{info} directory obeys the usual conventions.
129 @emph{I.e.}, the @file{info} directory is flat
130 with a(n) (optional) @file{dir} file and one (set of) info file(s) per
131 package. The @file{man} subdirectory typically contains documentation
132 sources, separated by package. (It does not contain @file{man(1)}
133 pages, as Emacs provides very few of them.)
135 There are several standard package hierarchies, and administrators can
136 configure others at build time, while users can configure others at run
137 time. The standard system hierarchies are all subdirectories of an
138 @c #### This is possibly incorrect usage of "installation root."
139 XEmacs installation root, typically @file{/usr/local/lib/xemacs/}.
140 These are the @file{xemacs-packages}, @file{mule-packages},
141 @file{infodock-packages}, and @file{site-packages} hierarchies. Each
142 has the structure described above, but the purposes differ. The
143 @file{xemacs-packages} is the normal place for installing ``official''
144 packages and many third-party libraries. Unfortunately, it is not yet
145 quite possible to read libraries containing international characters
146 with a non-Mule XEmacs, so such libraries are sequestered in the
147 @file{mule-packages} hierarchy. Some packages are compatible only with
148 the Infodock development environment, and they will be installed in the
149 @file{infodock-packages} hierarchy. The @file{site-packages} hierarchy
150 is for packages not distributed by XEmacs.org, typically locally
153 Packages are in principle supposed to be XEmacs version-independent, but
154 if such dependencies are unavoidable, additional standard package
155 hierarchies may be installed under version directories, @emph{e.g.}
156 @file{/usr/local/lib/xemacs-21.4.6/}.
158 Users who do not have sufficient privilege to install packages in the
159 system hierarchies may install package hierarchies under
160 @file{~/.xemacs}. At present only the @file{xemacs-packages} and
161 @file{mule-packages} hierarchies are supported, but it might make sense
162 to extend this to support @file{infodock-packages} and
163 @file{site-packages} hierarchies in the future.
165 The package hierarchies are not searched directly for libraries to be
166 loaded; this would be very costly. Instead, the hierarchies are ordered
167 according to certain rules, and searched for package lisp directories at
168 invocation. These directories are added to the general
169 @code{load-path}. As usual, it is @code{load-path} that is searched at
170 run-time. This approach is somewhat costly at initialization, but
171 results in a very ``clean'' @code{load-path}.
173 The order of search can be changed at build time by specifying the
174 @samp{--package-path} option to @file{configure}, or at run-time by
175 specifying the @code{EMACSPACKAGEPATH} environment variable.
176 @xref{Packages,,,xemacs}.
178 @c #### The following description is quite possibly inaccurate.
179 @c Please, Michael, write some specs up!
180 The default order of search is hierarchically determined. First, the
181 roots are ordered. The @dfn{early} roots are the user-specific roots,
182 typically @file{~/.xemacs}. The @dfn{late} roots are the system roots,
183 typically @file{/usr/local/lib/xemacs-21.4.6} and
184 @file{/usr/local/lib/xemacs}, in that order. All hierarchies for a
185 given root are searched for package Lisp directories, which are appended
186 to @code{load-path} in the order found. Then the search proceeds to the
187 next root, whose results will be appended to the @code{load-path}
188 generated by previous roots.
190 Second, the hierarchies below each root are searched in the order
191 @file{site-packages}, @file{infodock-packages}, @file{mule-packages},
192 then @file{xemacs-packages}.
194 In each hierarchy there should be a @file{lisp} subdirectory, containing
195 directories named for the packages. Each package's Lisp libraries thus
196 are contained in a directory of the form
197 @var{root}/@var{hierarchy}/lisp/@var{package}/.
199 With such a complex search algorithm, the possibility of libraries being
200 shadowed by another library with the same name is quite real. There are
201 two considerations here. First, every XEmacs package contains certain
202 libraries with constant names. These are
206 Lisp code to inform the package administration system about the package
208 @item auto-autoloads.el
209 Lisp code to set up autoloaded functions and variables that may be
213 definitions of configuration variables for use with the Customize
217 They are special-cased, because the way they are used prevents shadowing
220 Second, it is possible that multiple copies of some library, or
221 different libraries with the same name, are installed in various places
222 in the hierarchies. To detect such shadows, use
223 @code{list-load-path-shadows}.
225 Finally, note that most basic Emacs functionality, including most of the
226 Lisp API, is implemented in Lisp libraries. Because they use internal
227 reserved APIs that are subject to change according the needs of the
228 developers, these libraries are distributed with the XEmacs binary, and
229 are called @dfn{core Lisp libraries}. Most core Lisp libraries are
230 ``preloaded'' into the Emacs binary and in normal usage are never
231 explicitly loaded. However, they can be explicitly loaded, and if so
232 they are searched on @code{load-path}.
233 @c #### Is this correct? It is not for C-h f, for example.
234 Furthermore, functions such as @code{locate-library} will also search on
235 the @code{load-path}. The searching takes place under somewhat
236 different rules from those used for packaged Lisp. It is probably
237 easiest to think of the package hierarchy searching algorithm as
238 receiving a @code{load-path} initialized to the core Lisp directories.
241 @node The Library Maintainer's View, The Package Release Engineer's View, The User's View, Package Overview
242 @section The Library Maintainer's View
244 From the library maintainer's viewpoint, the advantages to the @xpms{}
245 stem from the convenience to the user of installation and upgrade.
246 Since an installed package automatically registers its entry points via
247 autoload and its configuration variables with the Customize system,
248 configuration FAQs are reduced. When it's easy to upgrade, users learn
249 to try @samp{Tools | Packages | Update Installed Packages} before
250 posting a FAQ whose answer is ``long since fixed, please upgrade.''
252 This comes at some cost, as the library maintainer needs to arrange that
253 the package be installed in a directory structure that satisfies the
254 requirements of the @xpms{}. Autoload cookies and defcustoms must also
255 be added to existing libraries. The @xpms{} provides infrastructure to
256 assure that all of these annoyances need only be dealt with once. The
257 autoload cookies and defcustoms are beyond the scope of this chapter, but
258 most maintainers of modern packages are already familiar with these
261 The @xpms{} may be divided into the @dfn{infrastructure} common to all
262 packages, and the package-specific @dfn{control files}. The
263 infrastructure supports global builds, installation, and generation of
264 the ``sumo'' bundles of packages, as well as generation of individual
265 packages. The package control files describe the structure of the
266 package's source tree and provide administrative information.
269 * Infrastructure:: Global Makefiles and common rules.
270 * Control Files:: Package-specific Makefiles and administrative files.
271 * Obtaining:: Obtaining the @xpms{} and required utilities.
274 @node Infrastructure, Control Files, , The Library Maintainer's View
275 @subsection Infrastructure
277 In order to get the greatest benefit from the @xpms{}, a library
278 maintainer should place the package sources in an appropriate place in
279 the XEmacs source package hierarchy, and arrange to have the source
280 package imported into the XEmacs CVS repository.
281 @c #### the parenthetical remark should go to "issues."
283 latter requirement can be quite burdensome. We are working on ways to
284 remove this requirement, but for the present it remains necessary.) The
285 library maintainer must also keep sources for any packages his/her
286 package requires. This requirement is somewhat burdensome, but unlikely
287 to be relaxed because of the implementation of compilation of macros in
288 Emacs Lisp. Macros cannot be called by compiled Lisp (the macro
289 expansion, which is always known at compile time, is inlined), so the
290 source of the macro must be loaded before compiling the called function.
292 The source package hierarchy may be rooted anywhere. The CVS module is
293 called ``packages,'' so we will refer to the top directory of the source
294 package hierarchy as ``the @file{packages} directory.'' The
295 @file{packages} directory contains two source subdirectories,
296 @file{xemacs-packages} and @file{mule-packages} (for convenience in
297 segregating the packages which depend on Mule, as they will cause
298 load-time errors in a non-Mule XEmacs). Each subdirectory contains many
299 package source directories, whose internal structure is not specified.
300 That structure is left up to the convenience of the library maintainers.
301 The requirements on the top directory of an individual package source
302 tree are given below, @ref{Control Files}.
304 The @file{packages} directory contains some auxiliary Lisp libraries
305 used in the compilation and packaging process. The content of these
306 libraries is of interest primarily to the packaging engineers, @ref{The
307 Package Release Engineer's View}.
309 Finally, the @file{packages}, @file{packages/xemacs-packages}, and
310 @file{packages/mule-packages} directories contain @file{Makefile}s and
311 include files to control the package creation process. The
312 @file{Makefile}s in @file{packages/xemacs-packages} and
313 @file{packages/mule-packages} simply define the default sets of known
314 packages and include @file{../iterate.rules}, which implements recursive
315 building of all target packages.
317 The @samp{make} infrastructure in @file{packages} includes
321 controls building of individual packages, local installation, and
322 bundling of ``sumo'' tarballs
325 controls recursive builds of multiple packages
328 provides the rules for building and packaging. Included by all package
332 provides local configuration, such as installation targets and staging
333 directories, as well as a number of kludges (many now obsolete) required
334 for building packages on the Windows platform.
336 @item Local.rules.template
337 a template for Local.rules, liberally commented
340 consistency checking for @file{Local.rules}, included by both the
341 top-level @file{Makefile} and by @file{XEmacs.rules}.
343 @c #### Add to "issues"
344 @item package-compile.el
345 compile environment (@emph{e.g.}, load-path) setup. It is very bogus
346 that this is here, an alternative mechanism is likely to be provided.
349 Of these, only @file{Local.rules} and @file{package-compile.el} need to
350 be modified by the library maintainer. The changes to Local.rules
351 affect only your environment. This should need to be done only once
352 when first preparing the source environment. The necessary
353 modifications to @file{package-compile.el} need to be done for each
354 package and are discussed in the next section, @ref{Control Files}.
357 @node Control Files, Obtaining, Infrastructure, The Library Maintainer's View
358 @subsection Control Files
360 Each package source must contain a number of control files in the
361 top-level directory. These files in general can be created and then
362 ignored, except for a few variables that need to be updated when new
363 versions are released. In most cases even adding, renaming, and
364 removing library source files can be handled by generic rules.
366 The package control files include
370 Must set a few @file{make} variables used by the administrative
371 utilities, and defines a couple of package-building targets to depend on
372 appropriate targets defined generically in @file{XEmacs.rules}. It may
373 also provide various variables and rules to transform the source tree
374 structure into that expected by the run-time system.
376 @item package-info.in
377 Provides a template for package information to be provided to the
378 administrative utilities. Static variables that are rarely changed
379 (such as the package's name) are entered as literals. Some variables
380 are generated by the build process (build dates and MD5 checksums) and
381 are automatically filled in. Finally, some variables that change
382 irregularly (dependences and even version numbers) are set as
383 @file{make} variables in the @file{Makefile}.
386 Not strictly required, but normally a ChangeLog will be added by the
387 XEmacs package maintainer if different from the upstream maintainer.
389 @item package-compile.el
390 compile environment (@emph{e.g.}, load-path) setup. It is very bogus
391 that this is here, an alternative mechanism is likely to be provided.
394 Generated. Simply does a @code{package-provide} for the package.
396 @item _auto-autoloads.el
397 Generated. Read when XEmacs is initialized, and provides autoloads for
398 all defuns and other specially-marked forms in the sources.
400 @item custom-loads.el
401 Generated. Read when XEmacs is initialized, and informs the Customize
402 subsystem how to find the defcustom forms needed to create Customization
403 forms for the usre configuration variables of the package.
407 @node Obtaining, , Control Files, The Library Maintainer's View
408 @subsection Obtaining the @xpms{} and Required Utilities
410 Currently both the infrastructure for creating XEmacs packages and the
411 package sources themselves are available only by CVS. See
412 @uref{http://www.xemacs.org/Develop/cvsaccess.html} for more
415 The @xpms{} currently requires GNU @file{make}, and probably XEmacs, to
419 @node The Package Release Engineer's View, , The Library Maintainer's View, Package Overview
420 @subsection The Package Release Engineer's View
422 The XEmacs Package Release Engineer is responsible for keeping the
423 system coherent. The changes to @file{packages/package-compile.el} and
424 @file{packages/xemacs-packages/Makefile} required to make the package
425 available to others, and for building SUMO tarballs, @emph{etc}, are
426 done by the Package Release Engineer, not individual library
429 The Package Release Engineer also maintains assorted infrastructure for
430 actually making releases. These are generally available for inspection
431 in the @code{xemacs-builds} module in the CVS repository.
433 @c #### To be completed.
436 @c #### The following section is lifted verbatim from the XEmacs User's
437 @c Manual, file packages.texi.
438 @node Package Terminology, Building Packages, Package Overview, Packaging
439 @comment node-name, next, previous, up
440 @heading Package Terminology:
442 @subsection Libraries and Packages
446 A Lisp @dfn{library} is a single loadable file containing Lisp code. It
447 may be in source or byte-compiled form. A Lisp @dfn{package} is a set
448 of one or more libraries, usually related to each other in some way,
449 bundled with administrative information for convenient distribution.
451 @subsection Package Flavors
453 There are two main flavors of packages.
456 @item Regular Packages
457 @cindex regular package
458 A regular package is a set of Lisp libraries design to cooperate with
459 one another. A very complex example is Gnus. One may not in general
460 safely remove any of the component libraries.
462 @item Single-File Packages
463 @cindex single-file package
464 A single-file package is a collection of thematically related but
465 otherwise independent Lisp libraries. These libraries are bundled
466 together for convenience of the maintainers. Usually individual
467 libraries may be deleted at will without any loss of functionality of
468 other libraries in the package. However, we would recommend that you
469 follow this rule of thumb: "When in doubt, don't delete". If it's
470 really that big a deal, request that the maintainers split the package
471 into smaller aggregations.
474 @subsection Package Distributions
475 @cindex package distributions
476 @cindex binary packages
477 @cindex source packages
478 XEmacs Lisp packages are distributed in two ways. @dfn{Binary packages}
479 are used by system administrators and end users. They are packaged in a
480 form convenient for direct installation into an XEmacs package
481 hierarchy. @dfn{Source packages} are for developers and include all
482 files necessary for rebuilding byte-compiled lisp and creating tarballs
483 for distribution or installation. This is all of the package author's
484 source code plus all of the files necessary to build distribution
485 tarballs (Unix Tar format files, gzipped for space savings).
486 @c #### This next is an Evile Practice and should be discontinued.
487 (Occasionally sources that are not relevant to XEmacs are removed.)
489 Currently, source packages are only available via CVS. See
490 @url{http://www.xemacs.org/Develop/cvsaccess.html} for details.
492 The package distributions are also split according to major features
493 required in XEmacs to support them. At present there are @dfn{generic}
494 packages, which can be loaded by @emph{any} XEmacs, and @dfn{Mule}
495 packages, which @emph{require} Mule support or they will cause errors
496 when loaded. Note that there is no guarantee that a generic package
497 will have any useful functionality in a minimally configured XEmacs. As
498 long as any XEmacs can successfully load the package's libraries
499 (perhaps given other required Lisp libraries), it will be classified as
500 generic. At the present time only Mule packages need be treated
501 specially, and even those only if they contain multibyte characters.
504 @c #### The following section is lifted verbatim from the XEmacs User's
505 @c Manual, file packages.texi.
506 @node Building Packages, Local.rules File, Package Terminology, Packaging
507 @comment node-name, next, previous, up
508 @cindex building packages
509 @cindex package building
510 @heading Building Packages:
511 Currently, source packages are only available via anonymous CVS. See
512 @url{http://www.xemacs.org/Develop/cvsaccess.html} for details of
513 checking out the @file{packages} module.
515 @subsection Prerequisites for Building Source Packages
520 (or a BSD compatible install program).
522 (3.75 or later preferred).
524 (1.68 from texinfo-3.11 or later required, 1.69 from Texinfo 4 preferred).
529 @item A properly configured @file{Local.rules} file.
530 @ref{Local.rules File}.
533 And of course, XEmacs, 21.0 or higher.
535 @subsection What You Can Do With Source Packages
537 The packages CVS sources are most useful for creating XEmacs package
538 tarballs for installation into your own XEmacs installations or for
539 distributing to others.
541 The supported @file{make} targets are:
545 Bytecompile all files, build and bytecompile byproduct files like
546 @file{auto-autoloads.el} and @file{custom-load.el}. Create info version
547 of TeXinfo documentation if present.
549 @c #### Why do we need this _and_ the binkit target?
551 Does a @code{make all} as well as create a binary package tarball in the
555 Bytecompile all files, build and bytecompile byproduct files like
556 @file{auto-autoloads.el} and @file{custom-load.el}. Create info version
557 of TeXinfo documentation if present. And install everything into the
561 Usually simply depends on @code{srckit-std}, with no actions. This does
562 a @code{make distclean} and creates a package source tarball in the
563 staging directory. This is generally only of use for package
567 May depend on @code{binkit-sourceonly}, @code{binkit-sourceinfo},
568 @code{binkit-sourcedata}, or @code{binkit-sourcedatainfo}, with no
569 actions. @code{sourceonly} indicates there is nothing to install in a
570 data directory or info directory. @code{sourceinfo} indicates that
571 source and info files are to be installed. @code{sourcedata} indicates
572 that source and etc (data) files are to be installed.
573 @code{sourcedatainfo} indicates source, etc (data), and info files are
574 to be installed. A few packages have needs beyond the basic templates
575 so this is not yet complete.
578 Runs the rules @code{srckit} followed by @code{binkit}. This is
579 primarily of use by XEmacs maintainers producing files for distribution.
582 Remove all built files except @file{auto-autoloads.el} and
583 @file{custom-load.el}.
586 Remove all created files.
589 @c #### The following section is lifted verbatim from the XEmacs User's
590 @c Manual, file packages.texi.
591 @node Local.rules File, Creating Packages, Building Packages, Packaging
592 @comment node-name, next, previous, up
594 @heading The Local.rules File:
595 This file in @file{packages} provides the @xpms{} with information about
596 the local configuration and environment. To create @file{Local.rules},
597 simply copy @file{Local.rules.template} from that directory to
598 @file{Local.rules} and edit it to suit your needs.
600 These are the variables in @file{Local.rules} that you will need to
601 provide values for. The following variables control which packages will
605 @item XEMACS_PACKAGES
606 The default is @samp{xemacs-packages}, which results in the set in
607 the @file{xemacs-packages/Makefile} @code{PACKAGES} variable.
609 Otherwise, it should be a list of package source directories prefixed by
610 @samp{xemacs-packages}:
613 XEMACS_PACKAGES = xemacs-packages/xemacs-base xemacs-packages/bbdb
616 @item BUILD_WITHOUT_MULE
617 The default is the empty value.
619 Building from CVS defaults to building the Mule
620 packages. Set this to 't' if you don't want/have Mule.
623 The default is @samp{mule-packages}, which results in the set in
624 the @file{mule-packages/Makefile} @code{PACKAGES} variable.
626 Otherwise, it should be a list of package source directories prefixed by
627 @samp{mule-packages}:
630 MULE_PACKAGES = mule-packages/mule-base mule-packages/skk
634 The default is @file{package-index}.
636 If you want the package index file to have a different name, change
637 this. This is probably a bad idea unless you are a packages release
638 engineer, as it will confuse the package administration tools.
641 The following variables determine where files are installed and how they
642 are installed. Several of the defaults use the variable
643 @var{XEMACS_PACKAGES_BASE}. Never set this variable in
644 @file{Local.rules}; it is automatically set in @file{XEmacs.rules}.
647 @item @var{XEMACS_STAGING}
648 The default is @file{$@{XEMACS_PACKAGES_BASE@}/../xemacs-packages}.
650 Generic packages will be installed here. This can be the final
651 destination for files or symlinks (if the packages are being installed
652 locally), or a clean staging area for building tarballs.
654 @strong{N.B.} @samp{make bindist} ignores this variable. It should be
655 handled by the administration utilities, but currently isn't.
657 @item @var{MULE_STAGING}
659 The default is @file{$@{XEMACS_PACKAGES_BASE@}/../mule-packages}.
661 Packages requiring Mule to load correctly will be installed here. This
662 can be the final destination for files or symlinks (if the packages are
663 being installed locally), or a clean staging area for building tarballs.
665 @strong{N.B.} @samp{make bindist} ignores this variable. It should be
666 handled by the administration utilities, but currently isn't.
669 The default is the empty value.
671 Set this to 't' if you want to simulate ``running in place.'' It is
672 currently not possible to ask XEmacs to use any package source tree as
673 an automatically configured member of @code{load-path}, and it is
674 unlikely that complex trees such as that of the Gnus package will ever
675 be able to ``run in place.'' This variable, when set to `t', causes the
676 build process to create a symlink farm otherwise identical to an
677 installed tree of binary packages. Thus it is purely a space
680 Setting this is incompatible with @samp{make bindist}.
683 The following variables determine how packages are made.
687 The default is @samp{xemacs}.
689 The path to the XEmacs executable you wish to use to compile the
690 packages and execute Lisp build scripts.
692 @item XEMACS_NATIVE_NT
693 The default is the empty value.
695 Set this to 't' if you are building on WinNT. It controls hairy shell
696 quoting in the @file{Makefile}s.
699 The default is @samp{install -c}.
701 The path to your BSD compatible install program.
704 The default is @samp{tar}.
706 The path to your tar program.
709 The default is the empty value.
711 If unset, bzipped tarballs will not be built. If this is set to
712 something that resolves to a @samp{bzip2} executable, bzip2 tarballs
713 will be built @emph{in addition to} @samp{gzip} tarballs.
716 The default is @samp{makeinfo}.
718 The path to your @file{makeinfo} program
722 @c #### The following section is lifted verbatim from the XEmacs User's
723 @c Manual, file packages.texi.
724 @node Creating Packages, Issues, Local.rules File, Packaging
725 @comment node-name, next, previous, up
726 @cindex creating packages
727 @heading Creating Packages:
728 Creating a package from an existing Lisp library is not very difficult.
730 In addition to the Lisp libraries themselves, you need a
731 @file{package-info.in} file and a simple @file{Makefile}. The rest is
732 done by @file{XEmacs.rules}, part of the packaging system
735 @file{package-info.in} contains a single Lisp form like this:
738 (NAME ; your package's name
739 (standards-version 1.1
740 version VERSION ; Makefile
741 author-version AUTHOR_VERSION ; Makefile
743 build-date BUILD_DATE ; generated
744 maintainer MAINTAINER ; Makefile
745 distribution DISTRIBUTION ; "mule" if MULE is needed,
748 category CATEGORY ; Makefile
750 description "DESCRIPTION" ; a one-line period-terminated string
751 filename FILENAME ; obsolete
752 md5sum MD5SUM ; generated
753 size SIZE ; generated
754 provides (FEATURE ...) ; one for every `provides' form
755 requires (REQUIRES) ; Makefile
756 ; NOT run-time dependencies! These
757 ; are files that provide macros or
758 ; defsubsts that must be inlined.
763 You should replace NAME, DISTRIBUTION, DESCRIPTION, and FEATURE ... with
764 appropriate values, according to the comments. As a matter of style,
765 the first letter of the description should be capitalized, and the
766 string should end with a period. It need not be a complete sentence
767 grammatically. Fields marked as @samp{obsolete} can be ignored. Fields
768 marked as @samp{generated} are generated by the package construction
769 process, and will be filled in automatically. Fields marked as
770 @samp{Makefile} should be set as variables in the @file{Makefile}.
772 The @samp{provides} can be done automatically, but currently aren't. It
773 would probably be a good idea to set them in the @file{Makefile} (they
774 do change, fairly often, but at present they aren't.
776 The @file{Makefile} is quite stylized. The idea is similar to an
777 @file{Imakefile} or an @code{automake} file: the complexity is hidden in
778 generic rules files, in this case the @file{XEmacs.rules} include file
779 in the top directory of the packages hierarchy.
781 An @xpms{} @file{Makefile} has three components. First, there is a
782 variable definition section. The standard @xpms{} @file{make} variables
783 must be defined here for use by the @file{XEmacs.rules} include file.
784 Second, the file @file{../../XEmacs.rules} is included. Finally, the
785 @file{make} rules are defined, possibly including additional variable
786 definitions for use by the @file{Makefile}. These always include rules
787 for the targets @samp{all}, @samp{binkit}, and @file{srckit}.
789 Although a number of facilities are available for complex libraries,
790 most simple packages' @file{Makefile}s contain a copyright notice, the
791 variable definitions mentioned above, and some boilerplate.
794 # Makefile for apackage's lisp code
796 # This file is part of XEmacs.
798 # XEmacs is free software; you can redistribute it and/or modify it
799 # under the terms of the GNU General Public License as published by the
800 # Free Software Foundation; either version 2, or (at your option) any
803 # XEmacs is distributed in the hope that it will be useful, but WITHOUT
804 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
805 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
808 # You should have received a copy of the GNU General Public License
809 # along with XEmacs; see the file COPYING. If not, write to
810 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
811 # Boston, MA 02111-1307, USA.
814 AUTHOR_VERSION = 0.00
815 MAINTAINER = A. M. Aintainer <ama@@not.a.doc>
818 REQUIRES = xemacs-base
821 # All .els should be compiled and packaged.
822 ELS = $(wildcard *.el)
823 ELCS = $(ELS:.el=.elc)
825 include ../../XEmacs.rules
827 all:: $(ELCS) auto-autoloads.elc custom-load.elc
831 binkit: binkit-common
835 * package-compile.el::
836 * package-info.in Fields::
837 * Makefile Variables::
842 @node package-compile.el, package-info.in Fields, , Creating Packages
844 The @xpms{} does not automatically become aware of your package simply
845 because there is a new subtree. If any package, including your own,
846 requires any of your files, it must be explicitly added to the compile
847 environment or loads/requires that search load-path will fail. The
848 changes that need to be made are
851 @item an entry in @code{package-directory-map}
852 This tells the @xpms{} which distribution (currently
853 @samp{xemacs-packages} or @samp{mule-packages}) your package is found
854 in. It then looks in the distribution subdirectory whose name is the
855 same as the package's.
857 @item an entry in the @code{cond} in @code{package-name-to-directory}
858 This is optional; it is necessary only if you keep your Lisp code
859 somewhere other than the top-level directory of the package's source
860 tree, eg, in @file{packages/xemacs-packages/@var{PACKAGE}/lisp}.
863 This only needs to be done once, when the package is first added to the
864 @xpms{}. (Well, when you randomly change the subdirectory layout, too.)
865 Your changes to @file{package-compile.el} must be cleared and checked in
866 by the XEmacs Package Release Engineer before your package will build
867 correctly from a fresh checkout.
869 This is unfortunate; it works pretty well once set up, but can cause
870 confusion when first building a package in the @xpms{} context. In
871 particular, if the @code{package-directory-map} entry for a required
873 @c #### including the package itself?
874 is not found, the necessary requires will not be executed by
875 @file{package-compile.el}. If required functions are executed (under
876 @code{eval-when-compile}), they won't be found and the compile will
877 fail. If required function is actually a macro, the byte compiler will
878 not recognize that, compile a function call to the macro. This will
879 cause a run-time error because the byte-code interpreter does not know
880 how to execute macros. (Macros can always be expanded at compile-time,
881 and this is more efficient.)
883 If your package keeps some or all Lisp code somewhere other than the top
884 directory, then an entry in @code{package-name-to-directory} is also
885 necessary, or requires will fail, leading to the problems just described.
888 @node package-info.in Fields, Makefile Variables, package-compile.el, Creating Packages
890 The @file{package-info.in} structure is simply Lisp data, to be read by
891 a Lisp script, have values substituted for variables, and then written
892 out (appropriately quoted) into a loadable Lisp file, to be consed into
893 the @file{package-index.el} list at the FTP archives. That list is
894 structured as an alist with package names as keys. The package data is
895 a plist. Do not rely on this, as it may change. If you have a good
896 reason for relying on it, let the maintainers know and we may
897 incorporate it in a future revision of the @xpms{} standard.
899 There are several kinds of fields, distinguished by how they get their
900 values. There are literals written into @file{package-info.in} by the
901 package maintainer. There are variables substituted in by the build
902 process, some computed, and others written as values of @file{make}
903 variables in the @file{Makefile} by the package maintainer. There are a
904 few implementation constants, some of which are simply the default value
907 The @file{package-info.in} literals provided by the maintainer generally
908 should not change over the life of the package. (The exception is the
909 @samp{provides} field, which should be generated, but isn't yet.)
910 Values described as ``literal'' below are unquoted literal text. These
911 are normally interpreted as symbols by the package build process. The
912 maintainer literals are
915 @item @var{package_name}
916 A literal. The only unnamed ``field,'' the name of the package.
919 A literal, either @samp{xemacs} (for generic packages) or @samp{mule}
920 (for packages requiring Mule). @xref{Package Terminology}.
923 A Lisp string containing a one-line text description for use in package
927 A (Lisp) list of features provided by the libraries in the package. All
928 of the features provided by libraries in your package should be elements
932 A literal, either @samp{regular} or @samp{single-file}. For practical
933 purposes, @samp{regular} should be considered an implementation constant.
936 @c #### The following should be rewritten to @xref the make variables
937 @c node, and simply associate the field names to the make variables with
938 @c one line of description.
939 Values which are expected to change regularly as the package is enhanced
940 are implemented as @file{make} variables. You should not change them in
941 the @file{package-info.in} file; they are automatically filled in by the
944 The corresponding field name is given in parentheses. These include
949 The version of the XEmacs package, a numeric literal (a decimal
950 fixed-point number with two-places of precision).
954 The upstream author's version, an unintepreted literal.
958 Date of release of the upstream version.
962 A literal containing the XEmacs package's maintainer and his/her email
967 A literal, either @samp{standard} or @samp{mule}. Probably redundant.
971 A list of packages required to correctly build this package.
973 Note that the usual form in @file{package-info.in} already has the
974 parentheses, so the @file{make} variable should be set to a
975 space-separated list of package names @emph{not} enclosed in
978 The list is of @emph{packages}, not @emph{libraries}, as would
979 ordinarily be provided to the Lisp @code{require} function.
981 @samp{REQUIRES} cannot be correctly computed from the calls to
982 @code{require} in the package's library sources. @samp{REQUIRES} is
983 used to ensure that all macro and defstruct definitions used by the
984 package are available at build time. This is not merely a matter of
985 efficiency, to get the expansions inlined. In fact, it is
986 @emph{impossible} to call a macro by name in byte-compiled Emacs Lisp
987 code. Thus, if the macro expansion is not inlined, the call will result
988 in an error at run-time! Thus, packages providing libraries that would
989 be loaded because of autoload definitions must also be included.
991 On the other hand, if a package provides no macros to this package, it
992 is preferable @emph{not} to include it in @samp{REQUIRES}, because it is
993 not uncommon that if the developer doesn't normally use the required
994 package, he will never use the functionality in the package being built,
995 either. In that case it would be preferable to not require the
996 developer to have source for the dependencies. That said, of course it
997 is safe to put too many packages in @samp{REQUIRES}.
1000 Values for the following fields are automatically generated by the build
1005 The date the package tarball was generated.
1008 An MD5 checksum for the package tarball, as gzipped.
1011 The size of the package tarball, as gzipped.
1014 It is not clear that either md5sum or size works correctly if the
1015 @samp{BZIP2} variable in @file{Local.rules} is set.
1017 The implementation constants are
1020 @item standards-version
1021 Currently 1.1. Defines the format of the @file{package-info.in} file
1022 and the @file{Makefile}. A true implementation constant.
1025 An unimplemented and underspecified feature. Suggestions for
1026 specification and implementation welcome.
1029 An obsolete feature, superseded by the @file{site-load.el} mechanism.
1030 The value should always be nil.
1033 An obsolete feature, completely ignored. Don't even think about doing
1034 anything useful with it.
1038 @node Makefile Variables, Makefile Targets, package-info.in Fields, Creating Packages
1040 A number of @file{make} variables are defined by the @xpms{}. Some are
1041 required, others are optional. Of course your @file{Makefile} may
1042 define other variables for private use, but you should be careful not to
1043 choose names that conflict with variables defined and used by the
1046 The required variables are described in the table below.
1047 The corresponding field names for @file{package-info.in}, where
1048 relevant, are given in parentheses.
1050 @c #### This is the canonical place for this information. If there is
1051 @c unnecessary duplication with package-info.in documentation, shorten
1052 @c that and leave this full-length.
1056 The version of the XEmacs package, a numeric literal (a decimal
1057 fixed-point number with two-places of precision).
1059 @item AUTHOR_VERSION
1061 The upstream author's version, an unintepreted literal.
1065 Date of release of the upstream version.
1069 A literal containing the XEmacs package's maintainer and his/her email
1074 A literal, either @samp{standard} or @samp{mule}. Probably redundant.
1078 A list of packages required to correctly build this package.
1080 Note that the usual form in @file{package-info.in} already has the
1081 parentheses, so the @file{make} variable should be set to a
1082 space-separated list of package names @emph{not} enclosed in
1085 The list is of @emph{packages}, not @emph{libraries}, as would
1086 ordinarily be provided to the Lisp @code{require} function.
1088 @samp{REQUIRES} cannot be correctly computed from the calls to
1089 @code{require} in the package's library sources. @samp{REQUIRES} is
1090 used to ensure that all macro and defstruct definitions used by the
1091 package are available at build time. This is not merely a matter of
1092 efficiency, to get the expansions inlined. In fact, it is
1093 @emph{impossible} to call a macro by name in byte-compiled Emacs Lisp
1094 code. Thus, if the macro expansion is not inlined, the call will result
1095 in an error at run-time! Thus, packages providing libraries that would
1096 be loaded because of autoload definitions must also be included.
1098 On the other hand, if a package provides no macros to this package, it
1099 is preferable @emph{not} to include it in @samp{REQUIRES}, because it is
1100 not uncommon that if the developer doesn't normally use the required
1101 package, he will never use the functionality in the package being built,
1102 either. In that case it would be preferable to not require the
1103 developer to have source for the dependencies. That said, of course it
1104 is safe to put too many packages in @samp{REQUIRES}.
1107 The list of the byte-compiled Lisp files used by the package. These
1108 files and their @file{.el} versions will be included in the binary
1109 package. This variable determines which libraries will be
1110 byte-compiled. These libraries are also deleted by @samp{make clean}.
1112 Note there is no sanity-checking done on this variable. If you put
1113 @samp{.el} files in here, they will not be compiled and they @emph{will}
1114 be deleted by @samp{make clean}. You would surely be very distressed if
1115 that happened, so be very careful. If this variable is left empty, none
1116 of your Lisp code will be compiled or packaged. This would be a less
1117 than amusing surprise, too.
1119 We don't consider this a feature, of course. Please do submit code to
1120 do sanity checking to @email{xemacs-patches@@xemacs.org}.
1123 Optional, but very commonly used variables include:
1127 Other files (such as extra Lisp sources or an upstream @file{Makefile})
1128 that are normally placed in the installed Lisp directory, but not
1129 byte-compiled. These files are @emph{preserved} by the @samp{clean}
1133 Other files (such as compiled autoload or concatenated @file{.elc}
1134 libraries) which are normally placed in the installed Lisp directory,
1135 but do @emph{not} have corresponding source files and @emph{should} be
1136 deleted by the @samp{clean} targets. Some of these (such as
1137 package-specific autoload setups) can and probably should be replaced by
1138 @xpms{} solutions such as @file{auto-autoloads.el}, but many cannot.
1141 A specification for loading libraries containing macros before compiling
1142 the Lisp in the package. This is spliced directly into the invocation
1143 of XEmacs for byte-compilation, so it must contain the @samp{-l} flag
1147 PRELOADS=-l ./apackage-macros.el -l ../bpackage/lisp/bpackage-macros.el
1151 Any Info file(s) generated by the package. These must be paths relative
1152 to the root of the package's source tree.
1155 The Texinfo source file(s). These must be paths relative
1156 to the root of the package's source tree.
1159 The name to be used for Info files and man pages.
1162 Any data files, such as pixmaps, READMEs, and ChangeLogs. These must be
1163 paths relative to the root of the package's source tree.
1166 The installation location for data files, relative to the @file{etc/}
1167 directory of the package hierarchy. The normal value is simply
1168 $(PACKAGE). Leaving it empty (@emph{i.e.}, put it directly under
1169 @file{etc/}) will probably work, but is subject to name conflicts with
1173 Rarely used variables.
1179 @node Makefile Targets, , Makefile Variables, Creating Packages
1181 The standard targets that need to be defined in your @file{Makefile}
1182 follow. These normally should @emph{not} have an action. All of the
1183 work should be done by dependent targets, usually having standard
1184 definitions in the @xpms{}.
1188 A list of generated files, usually byte-compiled Lisp libraries, to be
1189 bundled in the package. The typical dependencies are
1192 $(ELCS) auto-autoloads.elc custom-load.elc
1195 Other targets (such as Info files) may need to be added as dependencies
1196 for the @code{all} target.
1199 The target for generating a source package. Not implemented. If it
1200 were, the normal dependency would be @samp{srckit-std}.
1203 The target for creating a ``master'' installation. Binary packages are
1204 actually generated by the @samp{bindist} target. @xref{Building Packages}.
1207 Standard dependencies for @code{srckit} and @code{binkit} are defined in
1208 @file{XEmacs.rules}. The most useful of these values are given in the
1213 Build a standard source kit. Not fully implemented.
1215 @item binkit-sourceonly
1216 The @samp{binkit} target need only install source and compiled Lisp in
1217 the staging area. There is nothing to install in a data directory or
1220 @item binkit-sourceinfo
1221 Both source and info files are to be installed in the staging area.
1223 @item binkit-sourcedata
1224 Both source and etc (data) files are to be installed in the staging
1227 @item binkit-sourcedatainfo
1228 Source, etc (data), and info files all are present and need to be
1229 installed in the staging area.
1232 A dependency for all the above. (In fact in the current implementation
1233 @samp{binkit-common} does all the work for all of the @samp{binkit}
1237 Data files include things like pixmaps for a package-specific toolbar,
1238 and are normally installed in @file{etc/@var{PACKAGE_NAME}}. A few
1239 packages have needs beyond the basic templates. See @file{XEmacs.rules}
1240 or a future revision of this manual for details.
1243 @node Issues, , Creating Packages, Packaging