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