]> granicus.if.org Git - fortune-mod/commitdiff
Convert more manpages to DocBook 5 XML.
authorShlomi Fish <shlomif@shlomifish.org>
Sat, 15 Aug 2020 16:34:40 +0000 (19:34 +0300)
committerShlomi Fish <shlomif@shlomifish.org>
Wed, 16 Sep 2020 11:00:36 +0000 (14:00 +0300)
See:

* https://github.com/shlomif/fortune-mod/issues/41

Made use of doclifter ( http://www.catb.org/~esr/doclifter/ ),
docmake ( https://www.shlomifish.org/open-source/projects/docmake/ ),
cmake, and Perl 5. Thanks!

The current plan is to provide the resultant nroff outputs (or easily 's/.../.../'able
templates of them) inside the source tarballs to avoid a build time dependency on
DocBook XSL and docmake.

fortune-mod/CMakeLists.txt
fortune-mod/fortune/gen-randstr-manpage.pl [deleted file]
fortune-mod/fortune/gen-strfile-manpage.pl [deleted file]

index 026b44f6073a2dc63045456fdeb1c871f9787374..380f8d0cad3cc12fe626c8bbaa38e930be75de7a 100644 (file)
@@ -204,13 +204,12 @@ INSTALL_RENAME_MAN("fortune.6" "6" "fortune" "${_my_man_page_dir}")
 SET (_my_man_page_dir "${CMAKE_CURRENT_SOURCE_DIR}/util")
 SET (_my_man_page "${_my_man_page_dir}/strfile.man")
 SET (_my_man_docbook "${_my_man_page_dir}/strfile.docbook5.xml")
-SET (_my_man_gen "${CMAKE_CURRENT_SOURCE_DIR}/fortune/gen-strfile-manpage.pl")
 SET (_my_args "-I${CMAKE_CURRENT_SOURCE_DIR}/util" "-MFortuneMod_GenManPage_App" "-E" "FortuneMod_GenManPage_App-\\>run" "--" "--src-dir" "${CMAKE_CURRENT_SOURCE_DIR}" "--basename=strfile")
 ADD_CUSTOM_COMMAND(
     OUTPUT "${_my_man_page}"
     COMMAND "${PERL_EXECUTABLE}"
     ARGS ${_my_args}
-    DEPENDS "${_my_man_gen}" "${_my_man_docbook}"
+    DEPENDS "${_my_man_docbook}"
 )
 
 LIST(APPEND _my_man_pages_list "${_my_man_page}")
@@ -219,13 +218,13 @@ INSTALL_RENAME_MAN("strfile.man" "1" "strfile" "${_my_man_page_dir}")
 SET (_my_man_page_dir "${CMAKE_CURRENT_SOURCE_DIR}/util")
 SET (_my_man_page "${_my_man_page_dir}/randstr.man")
 SET (_my_man_docbook "${_my_man_page_dir}/randstr.docbook5.xml")
-SET (_my_man_gen "${CMAKE_CURRENT_SOURCE_DIR}/fortune/gen-randstr-manpage.pl")
 SET (_my_args "--src-dir" "${CMAKE_CURRENT_SOURCE_DIR}")
+SET (_my_args "-I${CMAKE_CURRENT_SOURCE_DIR}/util" "-MFortuneMod_GenManPage_App" "-E" "FortuneMod_GenManPage_App-\\>run" "--" "--src-dir" "${CMAKE_CURRENT_SOURCE_DIR}" "--basename=randstr")
 ADD_CUSTOM_COMMAND(
     OUTPUT "${_my_man_page}"
     COMMAND "${PERL_EXECUTABLE}"
-    ARGS "${_my_man_gen}" ${_my_args}
-    DEPENDS "${_my_man_gen}" "${_my_man_docbook}"
+    ARGS ${_my_args}
+    DEPENDS  "${_my_man_docbook}"
 )
 
 LIST(APPEND _my_man_pages_list "${_my_man_page}")
diff --git a/fortune-mod/fortune/gen-randstr-manpage.pl b/fortune-mod/fortune/gen-randstr-manpage.pl
deleted file mode 100644 (file)
index a4889f8..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use autodie;
-
-use Getopt::Long qw/ GetOptions /;
-use Path::Tiny qw/ path tempdir tempfile cwd /;
-
-sub do_system
-{
-    my ( $self, $args ) = @_;
-
-    my $cmd = $args->{cmd};
-    print "Running [@$cmd]\n";
-    if ( system(@$cmd) )
-    {
-        die "Running [@$cmd] failed!";
-    }
-
-    return;
-}
-
-my $output_fn;
-my $cookiedir;
-my $ocookiedir;
-my $no_offensive = 0;
-my $CMAKE_CURRENT_SOURCE_DIR;
-GetOptions(
-    '--src-dir=s'          => \$CMAKE_CURRENT_SOURCE_DIR,
-    '--cookiedir=s'        => \$cookiedir,
-    '--ocookiedir=s'       => \$ocookiedir,
-    '--without-offensive!' => \$no_offensive,
-    '--output=s'           => \$output_fn,
-) or die "Wrong options - $!";
-
-die "missing --src-dir" if ( not $CMAKE_CURRENT_SOURCE_DIR );
-__PACKAGE__->do_system(
-    {
-        cmd => [
-            "docmake", "manpages",
-            "${CMAKE_CURRENT_SOURCE_DIR}/util/randstr.docbook5.xml",
-        ],
-    },
-);
-
-path("${CMAKE_CURRENT_SOURCE_DIR}/util/randstr.man")
-    ->spew_utf8( cwd()->child("randstr.1")->slurp_utf8() =~
-        s#^[\t ]+(\.RE|\.PP)[\t ]*$#$1#gmrs =~ s#^[\t ]+$##gmrs =~
-        s#\n\n+#\n\n#gmrs );
diff --git a/fortune-mod/fortune/gen-strfile-manpage.pl b/fortune-mod/fortune/gen-strfile-manpage.pl
deleted file mode 100644 (file)
index 78b610d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use autodie;
-
-use Getopt::Long qw/ GetOptions /;
-use Path::Tiny qw/ path tempdir tempfile cwd /;
-
-sub do_system
-{
-    my ( $self, $args ) = @_;
-
-    my $cmd = $args->{cmd};
-    print "Running [@$cmd]\n";
-    if ( system(@$cmd) )
-    {
-        die "Running [@$cmd] failed!";
-    }
-
-    return;
-}
-
-my $output_fn;
-my $cookiedir;
-my $ocookiedir;
-my $no_offensive = 0;
-my $CMAKE_CURRENT_SOURCE_DIR;
-GetOptions(
-    '--src-dir=s'          => \$CMAKE_CURRENT_SOURCE_DIR,
-    '--cookiedir=s'        => \$cookiedir,
-    '--ocookiedir=s'       => \$ocookiedir,
-    '--without-offensive!' => \$no_offensive,
-    '--output=s'           => \$output_fn,
-) or die "Wrong options - $!";
-
-die "missing --src-dir" if ( not $CMAKE_CURRENT_SOURCE_DIR );
-__PACKAGE__->do_system(
-    {
-        cmd => [
-            "docmake", "manpages",
-            "${CMAKE_CURRENT_SOURCE_DIR}/util/strfile.docbook5.xml",
-        ],
-    },
-);
-
-path("${CMAKE_CURRENT_SOURCE_DIR}/util/strfile.man")
-    ->spew_utf8( cwd()->child("strfile.1")->slurp_utf8() =~
-        s#^[\t ]+(\.RE|\.PP)[\t ]*$#$1#gmrs =~ s#^[\t ]+$##gmrs =~
-        s#\n\n+#\n\n#gmrs );