Add a manpage

This commit is contained in:
Přemysl Eric Janouch 2013-05-19 07:49:47 +02:00
parent c38f1046f3
commit 1636c34f83
2 changed files with 99 additions and 3 deletions

View File

@ -1,5 +1,5 @@
project (sdtui C)
cmake_minimum_required (VERSION 2.8.0)
cmake_minimum_required (VERSION 2.8.4)
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUC)
@ -30,6 +30,31 @@ GETTEXT_CREATE_TRANSLATIONS (
${CMAKE_CURRENT_SOURCE_DIR}/po/${CMAKE_PROJECT_NAME}.pot
ALL ${project_PO_FILES})
# Documentation
find_program (XSLTPROC_EXECUTABLE xsltproc)
if (NOT XSLTPROC_EXECUTABLE)
message (FATAL_ERROR "xsltproc not found")
endif (NOT XSLTPROC_EXECUTABLE)
set (project_MAN_PAGES "${CMAKE_PROJECT_NAME}.1")
foreach (page ${project_MAN_PAGES})
set (page_output "${CMAKE_CURRENT_BINARY_DIR}/${page}")
list (APPEND project_MAN_PAGES_OUTPUT "${page_output}")
add_custom_command (OUTPUT ${page_output}
COMMAND ${XSLTPROC_EXECUTABLE}
--nonet
--param make.year.ranges 1
--param make.single.year.ranges 1
--param man.charmap.use.subset 0
--param man.authors.section.enabled 0
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
"${CMAKE_CURRENT_SOURCE_DIR}/docs/${page}.xml"
DEPENDS "docs/${page}.xml"
COMMENT "Generating man page for ${page}" VERBATIM)
endforeach (page)
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES_OUTPUT})
# Project source files
set (project_common_sources
src/generator.c
@ -80,8 +105,15 @@ add_executable (add-pronunciation
target_link_libraries (add-pronunciation ${project_common_libraries})
# The files to be installed
install (TARGETS ${CMAKE_PROJECT_NAME} DESTINATION bin)
install (FILES LICENSE DESTINATION share/doc/${CMAKE_PROJECT_NAME})
include (GNUInstallDirs)
install (TARGETS ${CMAKE_PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
foreach (page ${project_MAN_PAGES_OUTPUT})
string (REGEX MATCH "\\.([0-9])" manpage_suffix "${page}")
install (FILES "${page}"
DESTINATION "${CMAKE_INSTALL_MANDIR}/man${CMAKE_MATCH_1}")
endforeach (page)
# Do some unit tests
option (BUILD_TESTING "Build tests" OFF)

64
docs/sdtui.1.xml Normal file
View File

@ -0,0 +1,64 @@
<refentry>
<refentryinfo>
<title>sdtui</title>
<productname>sdtui</productname>
<author>
<firstname>Přemysl</firstname>
<surname>Janouch</surname>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>sdtui</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>sdtui</refname>
<refpurpose>StarDict terminal UI</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>sdtui</command>
<arg choice="opt" rep="repeat">
<option><replaceable>OPTION</replaceable></option>
</arg>
<arg choice="plain">
<replaceable>dictionary.ifo</replaceable>
</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para><command>sdtui</command> is a StarDict dictionary viewer custom tailored
for viewing translation dictionaries, using a simple curses-based terminal UI.
</para>
<para>The program expects to find on its command line the path to a dictionary's
.ifo file, which contains further information required for loading the
dictionary.</para>
<para>Future versions may additionally show a list of dictionaries available in
preset search paths on startup.</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>
show help options
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-V</option>, <option>--version</option></term>
<listitem><para>
output version information and exit
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>