-
Notifications
You must be signed in to change notification settings - Fork 51
FreeDict HOWTO – FreeDict Build System
Development takes place in the Git repository. When a release takes place, the
converted dictionaries are uploaded and made available as a download.
The meta data from all dictionaries is collected in an XML file, which is used to build the download and details pages on the FreeDict website.
This file is sometimes also called FreeDict API, fore more details, please
see the corresponding chapter.
A strength of FreeDict is its support for different dictionary platforms. Once a dictionary is available in TEI format, it can be converted to many other formats, to be used with dictionary applications, spell checkers (for this only the headwords or translation equivalents are taken), for printing a book using XSL-FO etc.
Note
Support for aspell and XSL-FO is still a wish.
This is enabled by two factors. First, XML is purposely very flexible. Second, the tools for converting the TEI files are kept in one place (the tools module) and are shared between the dictionary modules.
The backbone of the FreeDict build system is the file Makefile.common
in the tools
module. It is designed to be included by the Makefile of each dictionary module.
Every Makefile of a dictionary module should start with these lines:
FREEDICTDIR ?= ..
# Adjust per dictionary variables like DISTFILES, TEI2DICTFLAGS, DICTFMTFLAGS etc.
DISTFILES = la1-la2.tei README Makefile NEWS
include $(FREEDICTDIR)/tools/Makefile.common
# Optional, space separated list of platform identifiers:
# Default: all supported
# UNSUPPORTED_PLATFORMS = evolutionary bedic
# Add targets specific for this dictionary module,
# eg. instructions how to create the TEI file from
# another source format.
In the first line, FREEDICTDIR is per default set to the parent directory. If you have set FREEDICTDIR to something else, that value will be used. In the next lines you can optionally adjust some variables. After that, the Makefile.common is included from the tools subdirectory of the FreeDict directory.
Makefile.common provides the support for the following targets (as well as some more internally used targets):
The default target currently converts to the DICT and Stardict format and compresses them as a release.
This extracts interesting information from the dictionary module and writes it into freedict-database.xml.
This puts a release file of the dictionary module source into $(FREEDICTDIR)/release/src.
This removes the non-source files generated during the build of anything from the dictionary module.
Looks for "double-entries" in the TEI file of the dictionary module, ie. entries with headwords that follow the same orthography.
Make will exit with an error message and an exit status of 1 if the PLATFORM in question is not supported by this dictionary module. Which platforms are supported is determined by the UNSUPPORTED_PLATFORMS variable. This target is used by the release-PLATFORM targets as a guard to prevent builds for unsupported platforms. The support status information is also saved in freedict-database.xml
This puts a release file for the specified platform into the corresponding directory of $(FREEDICTDIR)/release.
Example make release-stardict
This tests whether all words can be looked up from the dictionary in dictd by extracting a list of headwords, starting a dictd server and looking up each headword in turn.
Tis target validates the TEI file of the dictionary module.
The shown target extracts the pieces from the TEI header and prints them on STDOUT. Used during dbupdate.
The releases directory is created whenever make release
is executed. It
contains all the files which are generated from a TEI file and are released
through the appropriate make
command.
Underneath the releases directory, each export format has its own subdirectory,
so e.g. startdict
would be the directory name for the output format with the
same name.