cmake: speed up curldown processing, enable by default

- cmake: enable `BUILD_DOCS` by default (this controls converting and
  installing `.3` files from `.md` sources)

- cmake: speed up generating `.3` files by using a single command per
  directory, instead of a single command per file. This reduces external
  commands by about a thousand. (There remains some CMake logic kicking
  in resulting in 500 -one per file- external `-E touch_nocreate` calls.)

- cd2nroff: add ability to process multiple input files.

- cd2nroff: add `-k` option to use the source filename to form the
  output filename. (instead of the default in-file `Title:` line.)

Follow-up to 3f08d80b22
Follow-up to ea0b575dab #12753
Follow-up to eefcc1bda4 #12730

Closes #12762
This commit is contained in:
Viktor Szakats 2024-01-23 06:40:11 +00:00
parent fe290cbadd
commit 2620aa930b
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
3 changed files with 36 additions and 9 deletions

View file

@ -33,6 +33,7 @@ Converts a curldown file to nroff (man page).
my $cd2nroff = "0.1"; # to keep check
my $dir;
my $extension;
my $keepfilename;
while(1) {
if($ARGV[0] eq "-d") {
@ -43,6 +44,10 @@ while(1) {
shift @ARGV;
$extension = shift @ARGV;
}
elsif($ARGV[0] eq "-k") {
shift @ARGV;
$keepfilename = 1;
}
elsif($ARGV[0] eq "-h") {
print <<HELP
Usage: cd2nroff [options] [file.md]
@ -318,6 +323,10 @@ sub single {
close($fh);
push @desc, outseealso(@seealso);
if($dir) {
if($keepfilename) {
$title = $f;
$title =~ s/\.[^.]*$//;
}
open(O, ">$dir/$title.$section$extension");
print O @desc;
close(O);
@ -328,4 +337,16 @@ sub single {
return $errors;
}
exit single($ARGV[0]);
$f = $ARGV[0];
if(defined($f)) {
while($f) {
$r = single($f);
if($r) {
exit $r;
}
$f = shift @ARGV;
}
}
else {
exit single();
}