runlisp.conf.5.in: Some minor typesetting touch-ups.
[runlisp] / runlisp.conf.5.in
CommitLineData
8996f767
MW
1.\" -*-nroff-*-
2.\"
3.\" Manual for `runlisp' configuration files
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 .. \&.\|.\|.
8996f767
MW
43.
44.\"--------------------------------------------------------------------------
45.TH runlisp.conf 5 "27 August 2020" "Mark Wooding"
46.SH NAME
47runlisp.conf \- configuration files for runlisp
48.
49.\"--------------------------------------------------------------------------
50.SH DESCRIPTION
51.
10427eb2
MW
52.SS "Default configuration files"
53By default, the
54.B runlisp
55programs read configuration from the following files.
56(Note that if a
57.RB ` \-c '
58command-line option is given, then
59these default files are
60.I not
61read.)
62.TP
63.B @etcdir@/runlisp.d/*.conf
64If a directory named
65.B @etcdir@/runlisp.d
66exists,
67then all of the files within
68whose names end in
69.RB ` .conf '
70are read,
71in ascending lexicographical order by name.
72This directory name can be overridden by setting the
73.B RUNLISP_SYSCONFIG_DIR
74environment variable.
75.TP
76.B @etcdir@/runlisp.conf
77The file named
78.B @etcdir@/runlisp.conf
79is read; the file must exist.
80This filename can be overridden by setting the
81.B RUNLISP_SYSCONFIG
82environment variable.
83.TP
84.B ~/.runlisp.conf
85If there is a file named
86.B .runlisp.conf
87in the user's home directory,
88then it is read.
89The home directory is determined to be
90the value of the
91.B HOME
92environment variable, or, if that is not set,
93the home directory associated with the process's real uid
94in the system password database.
95This filename can be overridden by setting the
96.B RUNLISP_USERCONFIG
97environment variable.
98.TP
99.B ~/.config/runlisp.conf
100If there is a file named
101.B runlisp.conf
102in the user's XDG configuration directory,
103then it is read.
104The XDG configuration directory is determined to be the value of the
105.B XDG_CONFIG_HOME
106environment variable, or the
107.B .config
108directory in the user's home directory
109(as determined above).
110This filename can be overridden by setting the
111.B RUNLISP_USERCONFIG
112environment variable.
113(Note, therefore, that this variable overrides
114.I both
115of the user configuration files.)
116.
8996f767
MW
117.SS "General syntax"
118In summary,
119a configuration file is structured as a collection of assignments
120.I variable
121.B =
122.IR value ,
123gathered into named sections by header lines
124.BI [ section ]\fR.
125.PP
126Comments are indicated by a semicolon
127.RB ` ; '
128in the leftmost column,
129and extend to the end of the line;
130comments and lines consisting only of whiteapace are ignored
131and have no effect whatever.
132Semicolons not in the first column do
133.I not
134introduce comments,
135and have no special meaning.
136.PP
137A
138.I name
139is a non-empty sequence of ASCII alphanumeric characters,
140or the special constituent characters
141.RB ` \- ',
142.RB ` _ ',
143.RB ` . ',
144.RB ` / ',
145.RB ` * ',
146.RB ` + ',
147.RB ` *% ',
148or
149.RB ` @ '.
150For example,
151.RB ` foo ',
152.RB ` 12345 ',
153.RB ` \-2.718 ',
154.RB ` 113/355 ',
155.RB ` image-dir ',
156.RB ` @%IMAGEDIR ',
157and
158.RB ` *organa-solo* '
159are all names, but
160.RB ` foo:bar '
161.RB ` happy? '
162and
163.RB ` $3.95 '
164are not.
165Names beginning with
166.RB ` @ '
167are reserved for use by the
168.B runlisp
169programs;
170names beginning with
171.RB ` % '
172or
173.RB ` @% '
174are by convention private.
175.PP
176A
177.I section header
178is a line of the form
179.IP
180.BI [ section ]
181.PP
182where
183.I section
184is a name, as defined above.
185There may be whitespace before and after the
186.I name
187or after the
188.RB ` ] '.
189Section headers need not have distinct names.
190Subsequent assignments are applied to the section called
191.IR name ,
192up until the next section header, or the end of the file.
193Assignments prior to the first section header in a file
194are applied to the
195.B @CONFIG
196section.
197.PP
198An
199.I assignment
200begins with a line of the form
201.IP
202.I variable
203.B =
204.I rest
205.PP
206where
207.I variable
208is a name, as defined above,
209and it includes all subsequent
210(non-empty, non-comment)
211lines up to, but not including,
212the next line which does
213.I not
214begin with whitespace or a semicolon,
215or the end of the input file.
216There may be space before or after the
217.RB ` = '.
218The
219.I value
220assigned consists of the text of the initial line following the
221.RB ` = '
222character
223(shown as
224.I rest
225above),
226together with the contents of the subsequent lines;
227initial and trailing whitespace is removed from each piece,
228and the (nonempty) pieces are joined,
229separated by single spaces.
f8174852 230We say that an assignment
8996f767
MW
231assigns a value to the variable
232in some section \(en
233namely, the section in which the assignment is applied.
234.PP
235For example,
236consider the following file.
237.IP
238.ft B
239.nf
240long =
241 one
242
243 two
244; this line is a comment
245 ; not a comment
246 three
247
248short = just a quick note
249.fi
250.ft P
251.PP
252Then
253.B long
254is assigned the value
255.RB ` "one two ; not a comment three" ',
256and
ace01e71
MW
257.B short
258is assigned
8996f767
MW
259.RB ` "just a quick note" '.
260.PP
261The assignments applied to a section
262need not have distinct variable names.
263Only the last assignment to a particular variable name in a section is
264.IR effective ;
265the earlier assignments are simply ignored.
266If an effective assignment assigns a value to a variable in a section,
267we say that the variable is
268.I set
269to that value in the section.
270.
271.SS "Lookup and inheritance"
272A section may have zero or more
273.I parent
274sections.
275.PP
276The
10427eb2 277.B @BUILTIN
8996f767
MW
278and
279.B @ENV
280sections have no parents.
281The
e8f53d29 282.B @COMMON
8996f767
MW
283section has one parent, namely
284.BR @BUILTIN .
285.PP
286If the variable
287.B @parents
288is set in a section other than one of those named above,
44ccabcb 289then it must consist of a space- and/or comma-separated list
8996f767
MW
290of names,
291which name the section's parents.
292Currently, the parents need not be distinct,
293though duplicates have no effect other than slowing down lookup.
294The order in which parents are listed is not significant.
295If
296.B @parents
297is not set in a section other than one of those named above,
298then by default it has one parent, namely
299.BR @COMMON .
300.PP
301It is currently possible to build a cyclic structure of parent links.
302This is not recommended.
303If lookup (explained below) detects a cycle
304then it will report a fatal error,
305but cycles may exist without being detected.
306.PP
307A variable is
308.I "looked up"
309in a section as follows.
310.hP 1.
311If there is an effective assignment
312of a value to that variable in the section
313then lookup finds that assignment.
314.hP 2.
315If the section has no parents,
316then lookup fails.
317.hP 3.
318Otherwise, the variable is looked up in each of the section's parents.
319If none of these lookups succeeds, then the lookup fails.
320If all of the successful lookups found the
321.I "same assignment"
530dead4 322(not just the same value!)\&
8996f767
MW
323then lookup finds that assignment.
324Otherwise, the lookup reports an error.
325.
326.SS "Expansion and word-splitting"
327A value can be
328.I expanded
329relative to some home section,
330and optionally split into words.
331.PP
332Not all values are
333.IR expandable .
334Values set by assignments in a configuration file are always expandable.
335Values set on the command line \(en in
336.B \-o
337options \(en are not expandable.
338Values in the
339.B @ENV
340section from environment variables (see below) are not expandable.
341Some values set in the
342.B @BUILTIN
343section are expandable and some are not.
344Applying expansion to a value that is not expandable
345simply results in that same value, unchanged.
346.PP
347Applying expansion to an expandable value
348produces a result string as follows.
349The value is scanned from start to end.
350.hP \*o
351A backslash
352.RB ` \e '
353is discarded, but the immediately following character
354is copied to the output without further inspection.
355.hP \*o
356A
357.I variable substitution
358takes the form
359.BR ${ [ \c
360.IB sect : \c
361.RI ] var \c
362.RB [ | \c
eea3b0c7 363.IR filter ]\*(.. \c
8996f767
MW
364.RB [ ? \c
365.IR alt ] \c
366.BR } .
367A variable named
368.I var
369is looked up in the section named
370.IR sect ,
371or, if omitted, in the home section.
372If the lookup succeeds,
373then the value is expanded,
374processed by the
375.IR filter s
376(explained below),
377and appended to the output.
378If the lookup failed,
379and
380.BI ? alt
381is present,
382then
383.I alt
384is expanded and appended to the output.
385Otherwise,
386if the lookup fails and there is no
387.I alt
388text, then an error is reported.
389.IP
390A filter
391.B u
392causes the expanded value to be converted to uppercase;
393similarly,
394.B l
395causes the expanded value to be converted to lowercase.
396A filter
397.B q
398causes a backslash to be inserted before each
399backslash or double-quote character in the expanded value,
400so that this can be used as part of a quoted Common Lisp string.
401.hP \*o
402A
403.I conditional
404takes the form
405.BR $? [ \c
406.IB sect : \c
407.RI ] var \c
408.BI { conseq \c
409.RB [ | \c
410.IR alt ] \c
411.BR } .
412A variable named
413.I var
414is looked up in the section named
415.IR sect ,
416or, if omitted, in the home section.
417If the lookup succeeds, then
418.I conseq
419is expanded and appended to the output;
420otherwise, if
421.I alt
422is present, then it is expanded and appended to the output;
423otherwise, nothing happens.
424.hP \*o
425A dollar sign which doesn't introduce one of the forms above
426is invalid, and a fatal error is reported.
427.hP \*o
428Any other characters are simply appended to the output.
429.PP
430Word-splitting is similar but more complex.
431The result is not a string, but a sequence of strings.
432At any given point in this procedure,
433there may be a partially constructed word,
434or there might not.
435.hP \*o
436Outside of quotes (see below),
437whitespace serves to separate words.
438When a whitespace character is encountered,
439if there is a word under construction,
440then it is finished and added to the output list;
441otherwise it is simply ignored.
442.hP \*o
443If a backslash is encountered,
444then a word is started if there is none currently under construction,
445and the character following the backslash is added to the current word.
446.hP \*o
447If a single-quote character
448.RB ` ' '
449is encountered,
450then a word is started if there is none currently under construction,
451and
452.I all
453characters up to the next single quote
454are added to the current word.
455This includes double quotes, dollar signs, and backslashes.
456(Neither of the two single quotes is appended to the current word.)
457.hP \*o
458If a double-quote character
459.RB ` """" '
460is encountered,
461then a word is started if there is none currently under construction.
462Until the next double quote is encountered,
ace01e71 463whitespace and single quotes are treated literally,
8996f767
MW
464and simply added to the current word;
465backslashes can be used to escape characters,
466such as double quotes,
467as usual.
468.hP \*o
469If a
470.BR $ -expansion
471\(en a variable substitution or conditional (as described above) \(en
472is encountered
473and there is a current word under construction,
474then the result of the
475.BR $ -expansion
476is appended to the current word.
477If there is no current word,
478then the variable value, or consequent or alternative text,
479is subjected to word splitting in addition to expansion,
480and the resulting words appended to the output sequence.
481.hP \*o
482If any other character is encountered,
483then a word is started if there is none currently under construction,
484and the character is appended to the current word.
485.PP
486One case which deserves attention:
487if a
488.BR $ -expansion
489is encountered outside of a word,
490so that the result is subject to word splitting,
491then an error is reported if a new word is started
492without there being whitespace between the closing brace of the
ace01e71 493.BR $ -expansion
8996f767
MW
494and the character which started the new word.
495For example,
496.IP
497.B "bad = one ${x}two"
498.PP
499would be invalid in a word-splitting context.
500.
10427eb2
MW
501.SS "Other special variables"
502In every section, the section's name
503is automatically assigned to the variable
504.BR @name .
505This variable
506.I can
507be overridden by an explicit assignment,
508but this is not recommended.
509.
8996f767
MW
510.SS "Predefined variables in @BUILTIN"
511The
512.B @BULITIN
ace01e71 513section has no parents.
8996f767 514You should not override its settings in configuration files.
ace01e71 515It holds a number of variables set by the
8996f767
MW
516.B runlisp
517programs.
10427eb2 518.
8996f767
MW
519.TP
520.B @data-dir
521The directory in which
522.BR runlisp 's
523auxiliary data files and scripts are located.
524This is determined by the
525.B RUNLISP_DATADIR
526environment variable,
527the
528.B data-dir
529variable in the
530.B @CONFIG
531section,
532or a value determined at compile time.
10427eb2 533.
8996f767
MW
534.TP
535.B @ecl-opt
536The preferred option prefix for ECL, either
537.RB ` \- '
538or
539.RB ` \-\- '.
540(For some reason,
541the ECL developers are changing
542the way ECL recognizes command-line options,
530dead4 543because they think that the minor \(aesthetic improvement
8996f767
MW
544is worth breaking everyone's scripts.)
545This is determined by the
546.B ecl-opt
547variable in the
548.B @CONFIG
549section,
550or a value determined at compile time.
10427eb2 551.
8996f767 552.TP
c7af83cd
MW
553.B @hash
554Set by
555.BR dump-runlisp-image (1)
556to the hash
557(a string of hexadecimal digits)
558identifying the versions of the Lisp code included
559\(en or to be included \(en
560in a custom image.
561This is constructed by hashing the result of evaluating the
562.B lisp-version
563expression in the system definition.
564.
565.TP
8996f767
MW
566.B @image-dir
567The directory in which
568.B runlisp
569looks for, and
570.B dump-runlisp-image
571stores, custom Lisp images.
572This is determined by the
573.B RUNLISP_IMAGEDIR
574environment variable,
575the
576.B image-dir
577variable in the
578.B @CONFIG
579section,
580or a value determined at compile time.
10427eb2 581.
8996f767 582.TP
c7af83cd
MW
583.B @image-link
584The well-known name of the image;
585actually a symbolic link to the `real' image file,
586whose name includes a hash
587which identifies the versions of the Lisp code included in the image.
588.
589.TP
8996f767
MW
590.B @image-new
591Set by
592.BR dump-runlisp-image (1)
593to the filename that a
594.B dump-image
595command should create.
596.RB ( dump-runlisp-image
597will rename the image into place itself,
598if the command completes successfully.)
10427eb2 599.
8996f767 600.TP
c7af83cd
MW
601.B @image-newlink
602Set by
603.BR dump-runlisp-image (1)
604to the name to use for the updated symbolic link to the image file.
605This is used internally,
606and is not expected to be useful in Lisp system definitions.
607.
608.TP
8996f767
MW
609.B @image-out
610Set by
611.BR dump-runlisp-image (1)
612to the filename of the intended output image.
613(Don't use this in
614.B dump-image
615commands: use
616.B @image-new
617instread.)
10427eb2 618.
8996f767
MW
619.TP
620.B @script
621Set by
622.BR runlisp (1)
623to the name of the script being invoked.
10427eb2 624.
8996f767
MW
625.TP
626.B @tmp-dir
627Set by
628.BR dump-runlisp-image (1)
629to be the name of a directory in which a
630.B dump-image
631command can put temporary files.
632.
10427eb2
MW
633.SS "Environment variables in @ENV"
634The
635.B @ENV
636section is special,
637and is used to hold a copy of the system environment.
638At startup,
639it contains an assignment for every environment variable.
640The
641.B @ENV
642section has no parents.
643The values are not expandable.
644It is possible to override
645.B @ENV
646settings in configuration files
647or on the command line,
8996f767
MW
648but this is not recommended.
649.
10427eb2
MW
650.SS "The @COMMON section"
651The
652.B @COMMON section
653is the default parent for nearly all other configuration sections
654(the exceptions being
655.B @BUILTIN
656and
657.BR @ENV ,
658which have no parents, and
659.B @COMMON
660itself, whose parent is
661.BR @BUILTIN ).
662It is used in the provided configuration
663to hold various common snippets of Lisp code and other settings,
664but the
665.B runlisp
666programs themselves make no direct use of it.
8996f767 667.
10427eb2
MW
668.SS "Overall configuration in @CONFIG"
669Variable settings in
670.B @CONFIG
671are consulted for various administrative reasons.
672.PP
673Because of the open-ended nature of this configuration mechanism,
674users can easily invent new configuration variables
675for any purpose they can imagine.
676The following variables are used by the
677.B runlisp
678programs directly, or its default configuration.
679All values are expanded before use;
680the
681.B @CONFIG
682section's parent is
683.BR @COMMON ,
684as usual.
685.
686.TP
687.B data-dir
688The directory in which
689.BR runlisp 's
690auxiliary data files and scripts are located.
691There is a hardcoded default
692determined at compile-time,
693which is probably correct.
694Overridden by the
695.B RUNLISP_DATADIR
696environment variable.
697Don't refer to this setting directly:
698expand
699.B @data-dir
700from the
701.B @BUILTIN
702section instead.
703.
704.TP
705.B dump
706A comma-separated list of Lisp implementation names
707which should have custom images dumped by
708.BR "dump-runlisp-image \-a" .
709The order is not especially significant.
710The default is all of the configured implementations
711which define a
712.B dump-image
713variable
714and whose command can be found.
715.
716.TP
717.B ecl-opt
718The preferred option prefix for ECL, either
719.RB ` \- '
720or
721.RB ` \-\- '.
722There is a hardcoded default
723determined at compile-time,
724which was correct for the system on which
725.B runlisp
726was built.
727Don't refer to this setting directly:
728expand
729.B @ecl-opt
730from the
731.B @BUILTIN
732section instead.
733.
734.TP
44ccabcb 735.B image-dir
10427eb2
MW
736The directory in which
737.B runlisp
738looks for, and
739.B dump-runlisp-image
740stores, custom Lisp images.
741Overridden by the
742.B RUNLISP_IMAGEDIR
743environment variable.
744Don't refer to this setting directly:
745expand
746.B @image-dir
747from the
748.B @BUILTIN
749section instead.
750.
751.TP
752.B prefer
753A comma-separated list of names of
754.I preferred
755Lisp implementations,
756Overridden by the
757.B RUNLISP_PREFER
758environment variable.
759.
760.SS "Lisp implementation definitions"
761A Lisp implementation is described to
762.B runlisp
763by a configuration section.
764The section's name is used to refer to the implementation,
765e.g., in
766.BR runlisp 's
767.B \-L
768option,
769or in the
770.B dump
771and
772.B prefer
773lists described above.
774.PP
775The following variable settings are used directly;
776of course, a Lisp implementation definition may contain other settings
777for internal purposes.
778.
779.TP
780.B command
781The name of the program used to invoke the Lisp implementation.
782.BR dump-runlisp-image
783looks to see whether this program is installed when invoked with the
784.B \-i
785option:
786it will fail if there is no
787.B command
788setting.
789It is also commonly
790(but not universally)
791used in the
792.B run-script
793and
794.B dump-image
795variables.
796It's conventional to set this to
797.B ${@ENV:FOO?foo}
798so that the command name can be overridden from the environment.
799.
800.TP
801.B dump-image
802The complete command to use to dump a custom image
803for this Lisp implementation.
804The value is subjected to expansion and word-splitting before use.
805It should write the newly created image to the file named by the
806.B @image-new
807setting in the
808.B @BUILTIN
809section.
810.
811.TP
812.B image-file
813The basename of the custom image file
814(i.e., not containing any
815.BR ` / '
816characters)
817to use when invoking this Lisp implementation.
818.BR runlisp (1)
819and
820.BR dump-runlisp-image (1)
821use the presence of this setting to decide
822whether the implementation supports custom images.
823.
824.TP
825.B image-path
826The complete (but not necessarily absolute) pathname
827of the custom image file for this Lisp implementation.
828It is the (expanded) value of this variable
829which is used by
830.BR runlisp (1)
831when it checks whether a custom image exists.
832It's set to
833.B ${@image-dir}/${image-file}
834in the standard configuration file's
835.B @COMMON
836section,
837and there is probably no need to override it;
838.B @image-dir
839is set in the
840.B @BUILTIN
10427eb2
MW
841section \(en see above \(en and
842.B image-file
843must be set in this section
844(or one of its ancestors)
845before
846.BR runlisp (1)
847would not attempt to check for an image file.
848.
849.TP
850.B run-script
851The complete command to use
852to get this Lisp implementation to execute a script.
853The value is subjected to expansion and word-splitting before use.
854The script name is available as
855.B @script
856in the
857.B @BUILTIN
858section \(en see above.
859If a custom image is available, then
860.B @image
861is defined
862(to the value
863.BR t )
864.I "in this section"
865(not in
866.BR @BUILTIN );
867the full path to the image file to use is given by
868.B ${image-path}
869\(en see above.
870.
871.\"--------------------------------------------------------------------------
8996f767
MW
872.
873.SH SEE ALSO
874.BR dump-runlisp-image (1),
875.BR query-runlisp-config (1),
876.BR runlisp (1).
877.
878.SH AUTHOR
879Mark Wooding, <mdw@distorted.org.uk>
880.
881.\"----- That's all, folks --------------------------------------------------