runlisp.c: Undefine local option-parsing macros at the end of the block.
[runlisp] / dump-runlisp-image.1.in
CommitLineData
10427eb2
MW
1.\" -*-nroff-*-
2.\"
3.\" Manual for `dump-runlisp-image'
4.\"
5.\" (c) 2020 Mark Wooding
6.\"
7.
8.\"----- Licensing notice ---------------------------------------------------
9.\"
10.\" This file is part of Runlisp, a tool for invoking Common Lisp scripts.
11.\"
12.\" Runlisp is free software: you can redistribute it and/or modify it
13.\" under the terms of the GNU General Public License as published by the
14.\" Free Software Foundation; either version 3 of the License, or (at your
15.\" option) any later version.
16.\"
17.\" Runlisp is distributed in the hope that it will be useful, but WITHOUT
18.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20.\" for more details.
21.\"
22.\" You should have received a copy of the GNU General Public License
23.\" along with Runlisp. If not, see <https://www.gnu.org/licenses/>.
24.
25.ie t \{\
26. ds o \(bu
27. if \n(.g \{\
28. fam P
29. ev an-1
30. fam P
31. ev
32. \}
33.\}
34.el \{\
35. ds o o
36.\}
37.
38.de hP
39.IP
40\h'-\w'\fB\\$1\ \fP'u'\fB\\$1\ \fP\c
41..
eea3b0c7 42.ds .. \&.\|.\|.
10427eb2
MW
43.
44.\"--------------------------------------------------------------------------
45.TH dump-runlisp-image 1 "12 August 2020" "Mark Wooding"
46.SH NAME
47dump-runlisp-image \- dump Lisp images for faster script execution
48.
49.\"--------------------------------------------------------------------------
50.SH SYNOPSIS
51.
52.B dump-runlisp-image
53.RB [ \-RUafinqrv ]
54.RB [ +RUfinr ]
55.RB [ \-O
56.IR output ]
57.br
8ed4c352 58 \c
10427eb2
MW
59.RB [ \-c
60.IR conf ]
61.RB [ \-o
62.RI [ sect \c
63.BR : ] \c
64.IB var = \c
65.IR value ]
66.RB [ \-j
67.IR njobs ]
68.RI [ lisp
eea3b0c7 69\*(..]
10427eb2
MW
70.
71.\"--------------------------------------------------------------------------
72.SH DESCRIPTION
73.
74The
75.B dump-runlisp-image
c7af83cd 76program builds and manages custom images for use by
10427eb2
MW
77.BR runlisp (1).
78For many Lisp implementation,
79a custom image,
80with ASDF already loaded,
81can start scripts much more quickly
82than the `vanilla' images installed by default.
83The downside is that custom images may be rather large.
c7af83cd
MW
84.PP
85There are actually
86.I two
87filenames for each Lisp image:
88the well-known one that
89.BR runlisp (1)
90uses to run scripts is a symbolic link to the other,
91the actual image file,
92whose name contains an ugly hexadecimal lump
93which identifies the versions of the Lisp code dumped in the image file.
94The
95.B dump-runlisp-image
96program uses this hash to determine whether
97the current image is up-to-date or needs replacing.
10427eb2
MW
98.
99.SS "Options"
100The following options are accepted on the command line.
101.
102.TP
103.BR "\-h" ", " "\-\-help"
104Write a synopsis of
105.BR dump-runlisp-image 's
106command-line syntax
107and a description of the command-line options
108to standard output
109and immediately exit with status 0.
110.
111.TP
112.BR "\-V" ", " "\-\-version"
113Write
114.BR dump-runlisp-image 's
115version number
116to standard output
117and immediately exit with status 0.
118.
119.TP
10427eb2
MW
120.BI "\-O" "\fR, " "\-\-output=" output
121If
122.I output
123names a directory,
124then write images to that directory
125with their default names as specified in the configuration file.
126Otherwise,
127exactly one Lisp implementation must be explicitly named,
128the
129.RB ` \-R '
130and
131.RB `\-U '
132options must not be set,
133and
134the image is written to a file named
135.IR output .
136By default,
137images are written to the directory in which
138.BR runlisp (1)
139will look in when checking for custom images:
140run
bf52b6ca 141.B query-runlisp-config \-x@image-dir
10427eb2
MW
142to see the default setting.
143.
144.TP
c88b892c
MW
145.BR "\-R" ", " "\-\-remove-other"
146After processing the selected Lisp implementations,
147delete all of the image files corresponding to other Lisps
148defined in the configuration.
149Negate with
150.B +R
151or
152.BR \-\-no-remove-other .
153.
154.TP
155.BR "\-U" ", " "\-\-remove-unknown"
156After processing the selected Lisp implementations,
157delete all of the files in the image directory which
158.I aren't
159image files of a configured Lisp implementation.
160Negate with
161.B +U
162or
163.BR \-\-no-remove-unknown .
164.
165.TP
10427eb2
MW
166.BR "\-a" ", " "\-\-all-configured"
167Select all configured Lisp implementations.
168You must either list Lisp implementations explicitly on the command line
169or set the
170.RB ` \- a'
171option,
172but not both.
173.
174.TP
175.BI "\-c" "\fR, " "\-\-config-file=" conf
176Read configuration from
177.IR conf .
178If
179.I conf
180is a directory, then all of the files within
181whose names end with
182.RB ` .conf ',
183are loaded, in ascending lexicographical order;
184otherwise,
185.I conf
186is opened as a file.
af677646 187All of the files are expected to be as described in
10427eb2
MW
188.BR runlisp.conf (5).
189.
190.TP
191.BR "\-f" ", " "\-\-force"
192Create fresh Lisp images
193even if a file with the appropriate name
194already exists.
195Negate with
196.B +f
197or
198.BR \-\-no-force .
199.
200.TP
201.BR "\-i" ", " "\-\-check-installed"
202Only select those Lisp implementations
203which are actually installed
204(and can be found).
205To count as `installed',
206the program named by
207.B command
208must exist and be executable in one of the directories listed in the
209.B PATH
210environment variable,
211as must the command named in the first word of the
212.B dump-image
213command line.
214Note that a Lisp implementation which fails this check
215is not counted as `selected' for the purposes of the
216.RB ` \-R '
217option above.
218For example, the command
219.B "dump-runlisp-image \-Rai"
220will dump images for Lisps which have been installed since the last run,
221and delete images for Lisps which have been uninstalled since then.
222Negate with
223.B +i
224or
225.BR \-\-no-check-installed .
226.
227.TP
228.BI "\-j" "\fR, " "\-\-jobs=" njobs
229Dump image for up to
230.I njobs
231Lisp implementations in parallel.
232The default is to run the jobs sequentially.
233.
234.TP
bf52b6ca 235.BR "\-n" ", " "\-\-dry-run"
10427eb2
MW
236Don't actually run any commands to dump images.
237This may be helpful for the curious,
238in conjunction with
239.RB ` \-v '
240to increase the verbosity.
241Negate with
242.B +n
243or
244.BR "\-\-no-dry-run" .
245.
246.TP
497e5a4a
MW
247.BI "\-o" "\fR, " "\-\-set-option=\fR[" sect "\fR]\fB:" var = value
248Assign
249.I value
250to the variable
251.I var
252in configuration section
253.IR sect ,
254or
255.B @CONFIG
256if no section is specified.
257The value is unexpandable,
258and overrides any similarly named setting
259from the configuration file(s).
260.
261.TP
10427eb2
MW
262.BR "\-q" ", " "\-\-quiet"
263Don't print warning messages.
264This option may be repeated:
265each use reduces verbosity by one step,
266counteracting one
267.RB ` \-v '
268option.
269The default verbosity level is 1,
270which prints only warning measages.
271.
272.TP
273.BR "\-r" ", " "\-\-remove-image"
274Delete image files for the selected Lisp implementations,
275rather than dumping them.
276Negate with
277.B +r
278or
279.BR \-\-no-remove-image .
280.
281.TP
282.BR "\-v" ", " "\-\-verbose"
283Be more verbose about the process of creating images.
284Lisp implementations can be rather noisy:
285by default,
286.B dump-runlisp-image
287runs silently unless something goes wrong,
288in which case it prints the failed Lisp command line
289and its output.
290If you set
291.B \-v
292then
293.B dump-runlisp-image
294will show Lisp implementation's noise immediately,
295without waiting to see whether it succeeds or fails.
296.
297.SS "Operation"
298The
299.B dump-runlisp-image
300program first determines a collection of
301.I selected
302Lisp implementations.
303If the
304.RB ` \-a '
305option is not set,
306then the selected Lisps are those named on the command line.
307If
308.RB ` \-a '
309is set,
310and the configuration contains a setting for
311.B dump
312in the
313.B @CONFIG
314section,
315then its (expanded) value is taken to be
316a list of Lisp implementation names
317separated by commas and/or one or more whitespace characters,
318and these named Lisp implementations are selected;
319if there is no
320.B dump
321setting, then
322.I all
323configured Lisp implementations which claim support for custom images
324\(en i.e., configuration sections with settings for
325.B run-script
326and
327.B image-file
328\(en are selected, and the
329.RB ` \-i '
330option is forced on.
331If the
332.RB ` \-i '
333option is set,
334then only those Lisp implementations which are actually installed
335are selected.
336.PP
c7af83cd
MW
337If necessary
338(see below),
339.B dump-runlisp-image
340invokes each selected Lisp in order to determine a
341.IR "version hash" .
342For each selected Lisp system,
343it constructs a command line,
344in the manner of
345.BR runlisp (1),
346to evaluate the expression resulting from expanding the
347.B lisp-version
348setting in the Lisp system's configuration section.
349It hashes the result,
350using a collision-resistant hash function
351(currently SHA256),
352to produce a string of hexadecimal digits which represents
353the versions of the various pieces of Lisp code which
354.I should
355be in the dumped image.
356The standard setting for
357.B lisp-version
358includes the Lisp implementation version string
359and the version of ASDF currently installed.
360(This step is skipped
361if it's not necessary to determine the Lisp system versions.
362In practice, this happens when the
363.RB ` \-r ',
364.RB ` \-R '
365and
366.RB ` \-U '
367options are all set.)
368.PP
10427eb2 369Having established the selected Lisps,
c7af83cd 370and their version hashes,
10427eb2
MW
371.B dump-runlisp-image
372proceeds to act on them:
373in the absence of the
374.RB ` \-r '
375option,
376it attempts to dump a custom image
377for each selected Lisp implementation,
378unless an image file already exists
379or the
380.RB ` \-f '
381option is set.
382(Note that
383.RB ` \-f '
384is an optimization of image dumping,
385and does not affect selection.)
386On the other hand, if
387.RB ` \-r '
388is set,
389then the custom image files of the selected Lisp implementations
390are deleted.
391.PP
392Next, if the
393.RB ` \-R '
394option is set,
395then all the images for Lisp implementations
396which are defined in the configuration
397but were
398.I not
399selected
400are deleted.
401.PP
402Finally, if the
403.RB ` \-U '
404option is set,
405then all files in the image directory
406which aren't recognized as being
407the custom image of some Lisp implementation
408are deleted.
409.PP
410If all of these operations are successfully performed
411then
412.B dump-runlisp-image
413exits with status 0;
414if there was a problem with the command line,
415or if any jobs fail,
416then it exits with status 127.
417.
418.\"--------------------------------------------------------------------------
419.
420.SH SEE ALSO
421.BR query-runlisp-config (1),
422.BR runlisp (1),
423.BR runlisp.conf (5).
424.
425.SH AUTHOR
426Mark Wooding, <mdw@distorted.org.uk>
427.
428.\"----- That's all, folks --------------------------------------------------