Compare commits

..

No commits in common. "f15fc0f00a41bb9ee53cf46dc78a7dbf2b371221" and "504f1ce2f53a9d77f9fb9c81d5c411025f09d944" have entirely different histories.

6 changed files with 129 additions and 77 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.0)
project (sdtui VERSION 0.1.0 LANGUAGES C)
project (sdtui C)
cmake_minimum_required (VERSION 2.8.5)
# Moar warnings
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
@ -8,6 +8,15 @@ if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
"${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra -Wno-missing-field-initializers")
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
# Version
set (project_VERSION_MAJOR "0")
set (project_VERSION_MINOR "1")
set (project_VERSION_PATCH "0")
set (project_VERSION "${project_VERSION_MAJOR}")
set (project_VERSION "${project_VERSION}.${project_VERSION_MINOR}")
set (project_VERSION "${project_VERSION}.${project_VERSION_PATCH}")
# For custom modules
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
@ -96,29 +105,36 @@ GETTEXT_CREATE_TRANSLATIONS (
ALL ${project_PO_FILES})
# Documentation
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)
if (NOT ASCIIDOCTOR_EXECUTABLE)
message (FATAL_ERROR "asciidoctor not found")
endif (NOT ASCIIDOCTOR_EXECUTABLE)
find_program (XSLTPROC_EXECUTABLE xsltproc)
if (NOT XSLTPROC_EXECUTABLE)
message (FATAL_ERROR "xsltproc not found")
endif (NOT XSLTPROC_EXECUTABLE)
foreach (page "${PROJECT_NAME}.1")
set (project_MAN_PAGES "${PROJECT_NAME}.1")
foreach (page ${project_MAN_PAGES})
set (page_output "${PROJECT_BINARY_DIR}/${page}")
list (APPEND project_MAN_PAGES "${page_output}")
list (APPEND project_MAN_PAGES_OUTPUT "${page_output}")
add_custom_command (OUTPUT ${page_output}
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage
-a release-version=${PROJECT_VERSION}
"${PROJECT_SOURCE_DIR}/docs/${page}.adoc"
-o "${page_output}"
DEPENDS "docs/${page}.adoc"
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
"${PROJECT_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})
# Project libraries
set (project_common_libraries ${ZLIB_LIBRARIES} ${icu_LIBRARIES}
${dependencies_LIBRARIES} ${Ncursesw_LIBRARIES} termo-static)
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES_OUTPUT})
# Project source files
set (project_common_sources
src/dictzip-input-stream.c
src/generator.c
src/stardict.c
src/utils.c)
set (project_common_headers
${PROJECT_BINARY_DIR}/config.h
src/dictzip-input-stream.h
@ -127,14 +143,24 @@ set (project_common_headers
src/generator.h
src/utils.h)
# Project libraries
set (project_common_libraries ${ZLIB_LIBRARIES} ${icu_LIBRARIES}
${dependencies_LIBRARIES} ${Ncursesw_LIBRARIES} termo-static)
# Create a common project library so that source files are only compiled once
if (${CMAKE_VERSION} VERSION_GREATER "2.8.7")
add_library (stardict OBJECT
${project_common_headers}
src/dictzip-input-stream.c
src/generator.c
src/stardict.c
src/utils.c)
${project_common_sources}
${project_common_headers})
set (project_common_sources $<TARGET_OBJECTS:stardict>)
else (${CMAKE_VERSION} VERSION_GREATER "2.8.7")
add_library (stardict STATIC
${project_common_sources}
${project_common_headers})
target_link_libraries (stardict ${project_common_libraries})
list (APPEND project_common_libraries stardict)
set (project_common_sources)
endif (${CMAKE_VERSION} VERSION_GREATER "2.8.7")
# Generate a configuration file
configure_file (${PROJECT_SOURCE_DIR}/config.h.in
@ -177,7 +203,7 @@ include (GNUInstallDirs)
install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
foreach (page ${project_MAN_PAGES})
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}")
@ -203,13 +229,16 @@ set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "StarDict terminal UI")
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR ${project_VERSION_MAJOR})
set (CPACK_PACKAGE_VERSION_MINOR ${project_VERSION_MINOR})
set (CPACK_PACKAGE_VERSION_PATCH ${project_VERSION_PATCH})
set (CPACK_GENERATOR "TGZ;ZIP")
set (CPACK_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
"${PROJECT_NAME}-${project_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${project_VERSION}")
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${project_VERSION}")
include (CPack)

View File

@ -30,7 +30,7 @@ a package with the latest development version from Archlinux's AUR.
Building and Running
--------------------
Build dependencies: CMake, pkg-config, asciidoctor +
Build dependencies: CMake, pkg-config, xsltproc, docbook-xsl +
Runtime dependencies: ncursesw, zlib, ICU, termo (included),
glib-2.0, pango, xcb and xcb-xfixes (optional)
@ -49,6 +49,9 @@ Or you can try telling CMake to make a package for you. For Debian it is:
$ cpack -G DEB
# dpkg -i sdtui-*.deb
Note that for versions of CMake before 2.8.9, you need to prefix `cpack` with
`fakeroot` or file ownership will end up wrong.
Having the program installed, simply run it with a StarDict '.ifo' file as an
argument. It is however highly recommended to configure it, see below.

View File

@ -2,7 +2,8 @@
#define CONFIG_H
#define PROJECT_NAME "${PROJECT_NAME}"
#define PROJECT_VERSION "${PROJECT_VERSION}"
#define PROJECT_VERSION "${project_VERSION}"
#define PROJECT_URL "${project_URL}"
#define GETTEXT_PACKAGE PROJECT_NAME
#define GETTEXT_DIRNAME "${CMAKE_INSTALL_PREFIX}/share/locale"

View File

@ -1,45 +0,0 @@
sdtui(1)
========
:doctype: manpage
:manmanual: sdtui Manual
:mansource: sdtui {release-version}
Name
----
sdtui - StarDict terminal UI
Synopsis
--------
*sdtui* [_OPTION_]... [_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 to load the dictionary.
Some options as well as dictionaries to load on start-up by default can be
specified in a configuration file. See the README for an example.
// FIXME: the README isn't even installed, so this manual isn't very useful
Options
-------
*-h*, *--help*::
Display a help message and exit.
*-V*, *--version*::
Output version information and exit.
Files
-----
_~/.config/sdtui/sdtui.conf_::
The configuration file, in which you can configure some settings, terminal
colours and the set of dictionaries to be loaded automatically on start-up.
Reporting bugs
--------------
Use https://git.janouch.name/p/sdtui to report bugs, request features,
or submit pull requests.

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="opt" rep="repeat">
<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>Some options as well as dictionaries to load on start by default can be
specified in a configuration file. See the README for an example.</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>

2
termo

@ -1 +1 @@
Subproject commit 065cd3b3e1781ebfddbb272b568918c60c8962c8
Subproject commit 8c4e867760eb20e3cdf997a301c8f8672c01e380