diff --git a/CMakeLists.txt b/CMakeLists.txt index e83ddc1..eb40db7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/docs/sdtui.1.xml b/docs/sdtui.1.xml new file mode 100644 index 0000000..c0ed3ec --- /dev/null +++ b/docs/sdtui.1.xml @@ -0,0 +1,64 @@ + + + + sdtui + sdtui + + Přemysl + Janouch + + + + + sdtui + 1 + User Commands + + + + sdtui + StarDict terminal UI + + + + + sdtui + + + + + dictionary.ifo + + + + +Description +sdtui is a StarDict dictionary viewer custom tailored +for viewing translation dictionaries, using a simple curses-based terminal UI. + +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. +Future versions may additionally show a list of dictionaries available in +preset search paths on startup. + + +Options + + + , + + show help options + + + + + , + + output version information and exit + + + + + +