From 14af2cf1bcea3dd069a5bc08edcbd0ef9776edf4 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Tue, 18 Aug 2020 14:10:50 +0300 Subject: [PATCH] Convert more manpages to DocBook 5 XML. cmake generating code. 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 | 20 +++++++++++++++++++ .../fortune/gen-fortune-docbook-page.pl | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fortune-mod/CMakeLists.txt b/fortune-mod/CMakeLists.txt index d0b8bd5..72545f7 100644 --- a/fortune-mod/CMakeLists.txt +++ b/fortune-mod/CMakeLists.txt @@ -201,6 +201,26 @@ LIST(APPEND _my_man_pages_list "${_my_man_page}") INSTALL_RENAME_MAN("fortune.6" "6" "fortune" "${_my_man_page_dir}") +MACRO(_fortune__generate_docbook basename offensive_flags) + + SET (_my_man_page_dir "${CMAKE_CURRENT_SOURCE_DIR}/fortune") + # SET (_my_man_page "${_my_man_page_dir}/${basename}.man") + SET (_my_man_docbook "${_my_man_page_dir}/${basename}.docbook5.xml") + SET (_my_man_prog "${_my_man_page_dir}/gen-fortune-docbook-page.pl") + SET (_my_args "${_my_man_prog}" "--output" "${_my_man_docbook}" --cookiedir "[[cookiedir_placeholder]]" --ocookiedir "[[ocookiedir_placeholder]]" ${offensive_flags}) + ADD_CUSTOM_COMMAND( + OUTPUT "${_my_man_docbook}" + COMMAND "${PERL_EXECUTABLE}" + ARGS ${_my_args} + DEPENDS "${_my_man_prog}" + ) + + LIST(APPEND _my_man_pages_list "${_my_man_docbook}") +ENDMACRO() + +_fortune__generate_docbook("fortune_with_offensive" "") +_fortune__generate_docbook("fortune_without_offensive" "--without-offensive") + MACRO(_fortune__generate_manpage basename) SET (_my_man_page_dir "${CMAKE_CURRENT_SOURCE_DIR}/util") diff --git a/fortune-mod/fortune/gen-fortune-docbook-page.pl b/fortune-mod/fortune/gen-fortune-docbook-page.pl index 008657f..45aa421 100644 --- a/fortune-mod/fortune/gen-fortune-docbook-page.pl +++ b/fortune-mod/fortune/gen-fortune-docbook-page.pl @@ -381,7 +381,7 @@ $out->print(<<"END_OF_STRING"); -[[cookiedir placeholder]] +${cookiedir} Directory for innoffensive fortunes. END_OF_STRING @@ -390,7 +390,7 @@ if ($OFF) { $out->print(<<"EOF"); -[[ocookiedir placeholder]] +${ocookiedir} Directory for offensive fortunes. EOF } -- 2.40.0