summaryrefslogtreecommitdiff
blob: 62fc424f42b97818aed760366fe594853da8b76c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
From c1f553b92a7a4873b33026463866101e18be8e76 Mon Sep 17 00:00:00 2001
From: Jonathan Dowland <jon@dow.land>
Date: Mon, 27 Nov 2017 22:24:04 +0000
Subject: [PATCH] further manpage substitutions and fixes

Convert chocolate-setup.6 into a template file and generate outputs
based on @PROGRAM_PREFIX@.

Add @PACKAGE_SHORTNAME@ to the list of parameters handed to docgen
and make appropriate substitutions in the manpage templates.
---
 man/Makefile.am                           | 15 ++++++++----
 man/docgen                                | 30 ++++++++++++++---------
 man/heretic.template                      |  8 +++---
 man/hexen.template                        |  8 +++---
 man/{chocolate-setup.6 => setup.template} |  4 +--
 man/strife.template                       | 14 +++++------
 6 files changed, 45 insertions(+), 34 deletions(-)
 rename man/{chocolate-setup.6 => setup.template} (94%)

diff --git a/man/Makefile.am b/man/Makefile.am
index 5916edf9..f0099c79 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -30,6 +30,7 @@ GENERATED_MAN_PAGES =               \
            @PROGRAM_PREFIX@strife.6       \
            strife.cfg.5             \
            @PROGRAM_PREFIX@strife.cfg.5   \
+           @PROGRAM_PREFIX@setup.6  \
            @PROGRAM_PREFIX@server.6
 
 SETUP_MAN_PAGES =                          \
@@ -38,8 +39,7 @@ SETUP_MAN_PAGES =                          \
            @PROGRAM_PREFIX@hexen-setup.6   \
            @PROGRAM_PREFIX@strife-setup.6
 
-man_MANS = chocolate-setup.6              \
-           $(GENERATED_MAN_PAGES)         \
+man_MANS = $(GENERATED_MAN_PAGES)         \
            $(SETUP_MAN_PAGES)
 
 doomdocs_DATA    = INSTALL.doom    CMDLINE.doom
@@ -51,10 +51,10 @@ CLEANFILES = $(GENERATED_MAN_PAGES) $(SETUP_MAN_PAGES) \
              $(doomdocs_DATA) $(hereticdocs_DATA) \
              $(hexendocs_DATA) $(strifedocs_DATA)
 DOCGEN = $(srcdir)/docgen
-DOCGEN_COMMON_ARGS = -n "@PROGRAM_SPREFIX@" -s "@PACKAGE_NAME@"
+DOCGEN_COMMON_ARGS = -n "@PROGRAM_SPREFIX@" -s "@PACKAGE_NAME@" -z "@PACKAGE_SHORTNAME@"
 
-$(SETUP_MAN_PAGES): chocolate-setup.6
-	cp $(srcdir)/chocolate-setup.6 $@
+$(SETUP_MAN_PAGES): @PROGRAM_PREFIX@setup.6
+	cp $(srcdir)/@PROGRAM_PREFIX@setup.6 $@
 
 @PROGRAM_PREFIX@doom.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
 	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
@@ -138,6 +138,11 @@ INSTALL.hexen: INSTALL.template
                   -g server -m $(srcdir)/server.template \
                   $(top_srcdir)/src > $@
 
+@PROGRAM_PREFIX@setup.6: $(top_srcdir)/src $(MANPAGE_GEN_FILES)
+	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
+                  -g setup -m $(srcdir)/setup.template \
+                  $(top_srcdir)/src > $@
+
 strife.cfg.5: $(top_srcdir)/src default.cfg.template
 	$(DOCGEN) $(DOCGEN_COMMON_ARGS) \
                   -g strife -m $(srcdir)/default.cfg.template \
diff --git a/man/docgen b/man/docgen
index defb9060..1c8a2471 100755
--- a/man/docgen
+++ b/man/docgen
@@ -430,7 +430,7 @@ def process_files(path):
 
         process_file(path)
 
-def print_template(template_file, program_prefix, package_name, content):
+def print_template(template_file, program_prefix, package_name, package_shortname, content):
     f = io.open(template_file, encoding='UTF-8')
 
     try:
@@ -440,16 +440,18 @@ def print_template(template_file, program_prefix, package_name, content):
                 filename = match.group(1)
                 filename = os.path.join(os.path.dirname(template_file),
                                         filename)
-                print_template(filename, program_prefix, package_name, content)
+                print_template(filename, program_prefix, package_name, package_shortname, content)
             else:
                 line = line.replace("@content", content)
                 line = line.replace("@PROGRAM_SPREFIX@", program_prefix)
-                line = line.replace("@PACKAGE_SHORTNAME@", package_name)
+                line = line.replace("@PACKAGE_NAME@", package_name)
+                if package_shortname:
+                    line = line.replace("@PACKAGE_SHORTNAME@", package_shortname)
                 stdout(line.rstrip().encode('UTF-8') + b'\n')
     finally:
         f.close()
 
-def manpage_output(targets, program_prefix, package_name, template_file):
+def manpage_output(targets, program_prefix, package_name, package_shortname, template_file):
 
     content = ""
 
@@ -458,7 +460,7 @@ def manpage_output(targets, program_prefix, package_name, template_file):
 
     content = content.replace("-", "\\-")
 
-    print_template(template_file, program_prefix, package_name, content)
+    print_template(template_file, program_prefix, package_name, package_shortname, content)
 
 def wiki_output(targets, template):
     read_wikipages()
@@ -466,30 +468,31 @@ def wiki_output(targets, template):
     for t in targets:
         stdout(t.wiki_output().encode('UTF-8') + b'\n')
 
-def plaintext_output(targets, program_prefix, package_name, template_file):
+def plaintext_output(targets, program_prefix, package_name, package_shortname, template_file):
 
     content = ""
 
     for t in targets:
         content += t.plaintext_output() + "\n"
 
-    print_template(template_file, program_prefix, package_name, content)
+    print_template(template_file, program_prefix, package_name, package_shortname, content)
 
-def completion_output(targets, program_prefix, package_name, template_file):
+def completion_output(targets, program_prefix, package_name, package_shortname, template_file):
 
     content = ""
 
     for t in targets:
         content += t.completion_output() + "\n"
 
-    print_template(template_file, program_prefix, package_name, content)
+    print_template(template_file, program_prefix, package_name, package_shortname, content)
 
 def usage():
-    print("Usage: %s [-V] [-c tag] [-g game] -n name ( -m | -w | -p ) <dir>..." \
+    print("Usage: %s [-V] [-c tag] [-g game] -n program_name -s package_name [ -z shortname ] ( -m | -w | -p ) <dir>..." \
             % sys.argv[0])
     print("   -c :  Provide documentation for the specified configuration file")
     print("         (matches the given tag name in the source file)")
     print("   -s :  Package name (for substitution)")
+    print("   -z :  Package short-name (for substitution)")
     print("   -n :  Program name (for substitution)")
     print("   -m :  Manpage output")
     print("   -w :  Wikitext output")
@@ -501,7 +504,7 @@ def usage():
 
 # Parse command line
 
-opts, args = getopt.getopt(sys.argv[1:], "n:s:m:wp:b:c:g:V")
+opts, args = getopt.getopt(sys.argv[1:], "n:s:z:m:wp:b:c:g:V")
 
 output_function = None
 template = None
@@ -509,12 +512,15 @@ doc_config_file = None
 match_game = None
 program_prefix = None
 package_name = None
+package_shortname = None
 
 for opt in opts:
     if opt[0] == "-n":
         program_prefix = opt[1]
     if opt[0] == "-s":
         package_name = opt[1]
+    if opt[0] == "-z":
+        package_shortname = opt[1]
     if opt[0] == "-m":
         output_function = manpage_output
         template = opt[1]
@@ -556,5 +562,5 @@ else:
 
     # Generate the output
 
-    output_function(documentation_targets, program_prefix, package_name, template)
+    output_function(documentation_targets, program_prefix, package_name, package_shortname, template)
 
diff --git a/man/heretic.template b/man/heretic.template
index c078c7c6..3fa4ce1d 100644
--- a/man/heretic.template
+++ b/man/heretic.template
@@ -6,7 +6,7 @@
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
-Chocolate Heretic is a port of Raven Software's 1994 game "Heretic" that
+@PACKAGE_SHORTNAME@ Heretic is a port of Raven Software's 1994 game "Heretic" that
 aims to behave as similar to the original DOS version of Heretic as
 possible.
 .br
@@ -14,16 +14,16 @@ possible.
 .SH IWAD SEARCH PATHS
 @include iwad_paths.man
 .SH ENVIRONMENT
-This section describes environment variables that control Chocolate Heretic's
+This section describes environment variables that control @PACKAGE_SHORTNAME@ Heretic's
 behavior.
 @include environ.man
 .SH FILES
 .TP
 \fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/heretic.cfg\fR
-The main configuration file for Chocolate Heretic.  See \fBheretic.cfg\fR(5).
+The main configuration file for @PACKAGE_SHORTNAME@ Heretic.  See \fBheretic.cfg\fR(5).
 .TP
 \fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-heretic.cfg\fR
-Extra configuration values that are specific to Chocolate Heretic and not
+Extra configuration values that are specific to @PACKAGE_SHORTNAME@ Heretic and not
 present in Vanilla Heretic. See \fB@PROGRAM_SPREFIX@\-heretic.cfg\fR(5).
 .SH SEE ALSO
 \fB@PROGRAM_SPREFIX@\-doom\fR(6),
diff --git a/man/hexen.template b/man/hexen.template
index 9184a27e..fc953edf 100644
--- a/man/hexen.template
+++ b/man/hexen.template
@@ -6,7 +6,7 @@
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
-Chocolate Hexen is a port of Raven Software's 1995 game "Hexen" that
+@PACKAGE_SHORTNAME@ Hexen is a port of Raven Software's 1995 game "Hexen" that
 aims to behave as similar to the original DOS version of Hexen as
 possible.
 .br
@@ -14,16 +14,16 @@ possible.
 .SH IWAD SEARCH PATHS
 @include iwad_paths.man
 .SH ENVIRONMENT
-This section describes environment variables that control Chocolate Hexen's
+This section describes environment variables that control @PACKAGE_SHORTNAME@ Hexen's
 behavior.
 @include environ.man
 .SH FILES
 .TP
 \fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/hexen.cfg\fR
-The main configuration file for Chocolate Hexen.  See \fBhexen.cfg\fR(5).
+The main configuration file for @PACKAGE_SHORTNAME@ Hexen.  See \fBhexen.cfg\fR(5).
 .TP
 \fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-hexen.cfg\fR
-Extra configuration values that are specific to Chocolate Hexen and not
+Extra configuration values that are specific to @PACKAGE_SHORTNAME@ Hexen and not
 present in Vanilla Hexen.  See \fB@PROGRAM_SPREFIX@\-hexen.cfg\fR(5).
 .SH SEE ALSO
 \fB@PROGRAM_SPREFIX@\-doom\fR(6),
diff --git a/man/chocolate-setup.6 b/man/setup.template
similarity index 94%
rename from man/chocolate-setup.6
rename to man/setup.template
index 64f65937..2b5a45ea 100644
--- a/man/chocolate-setup.6
+++ b/man/setup.template
@@ -25,9 +25,9 @@ Load configuration from the specified file, instead of default.cfg.
 \fB-extraconfig <file>\fR
 Load extra configuration from the specified file, instead of @PROGRAM_SPREFIX@\-doom.cfg. 
 .SH SEE ALSO
-\fB@CHOCOLATE_SPREFIX@\-doom\fR(6),
+\fB@PROGRAM_SPREFIX@\-doom\fR(6),
 \fBdefault.cfg\fR(5),
-\fB@CHOCOLATE_SPREFIX@\-doom.cfg\fR(5)
+\fB@PROGRAM_SPREFIX@\-doom.cfg\fR(5)
 .SH AUTHOR
 Chocolate Doom is written and maintained by Simon Howard.
 .PP
diff --git a/man/strife.template b/man/strife.template
index 9ca7f14e..b82c39d4 100644
--- a/man/strife.template
+++ b/man/strife.template
@@ -6,7 +6,7 @@
 [\fIOPTIONS\fR]
 .SH DESCRIPTION
 .PP
-Chocolate Strife is an accurate and complete recreation of Rogue
+@PACKAGE_SHORTNAME@ Strife is an accurate and complete recreation of Rogue
 Entertainment's "Strife: Quest for the Sigil". It was created through
 more than two years of reverse engineering effort with the blessings
 of the original programmers of the game (see the section HISTORY below).
@@ -16,17 +16,17 @@ of the original programmers of the game (see the section HISTORY below).
 .SH IWAD SEARCH PATHS
 @include iwad_paths.man
 .SH ENVIRONMENT
-This section describes environment variables that control Chocolate Strife's
+This section describes environment variables that control @PACKAGE_SHORTNAME@ Strife's
 behavior.
 @include environ.man
 
 .SH FILES
 .TP
 \fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/strife.cfg\fR
-The main configuration file for Chocolate Strife.  See \fBstrife.cfg\fR(5).
+The main configuration file for @PACKAGE_SHORTNAME@ Strife.  See \fBstrife.cfg\fR(5).
 .TP
 \fB$HOME/.local/share/@PROGRAM_SPREFIX@\-doom/@PROGRAM_SPREFIX@\-strife.cfg\fR
-Extra configuration values that are specific to Chocolate Strife and not
+Extra configuration values that are specific to @PACKAGE_SHORTNAME@ Strife and not
 present in Vanilla Strife.  See \fB@PROGRAM_SPREFIX@\-strife.cfg\fR(5).
 .SH SEE ALSO
 \fB@PROGRAM_SPREFIX@\-doom\fR(6),
@@ -57,15 +57,15 @@ and neither Rogue nor their publisher, Velocity, Inc., exist any longer as
 legal entities, this is effectively legal permission.
 
 .SH BUGS
-Chocolate Strife is almost, but not entirely perfect, in recreating the
+@PACKAGE_SHORTNAME@ Strife is almost, but not entirely perfect, in recreating the
 behavior of Vanilla Strife.  Help us by reporting any discrepancies you
 might notice between this executable and the vanilla DOS program.
 
 However, do *not* report any glitch that you can replicate in the vanilla EXE
-as a bug. The point of Chocolate Strife, like Chocolate Doom before it, is to
+as a bug. The point of @PACKAGE_SHORTNAME Strife, like Chocolate Doom before it, is to
 be as bug-compatible with the original game as possible. Also be aware that
 some glitches are impossible to compatibly recreate, and wherever this is the
-case, Chocolate Strife has erred on the side of not crashing the program,
+case, @PACKAGE_SHORTNAME@ Strife has erred on the side of not crashing the program,
 for example by initializing pointers to NULL rather than using them without
 setting a value first.
 
-- 
2.26.2