Chapter 8. FreeDict Build System

Figure 8.1. Overview of the FreeDict Build System

Overview of the FreeDict Build System

The data flow from the point of view of the FreeDict Build System originates in the FreeDict CVS repository. From there checkouts are made to buildhosts, where the data is converted to the formats of the supported platforms and where the FreeDict website is generated. The most interesting metadata is collected in an XML file. That is used to build the download and details pages on the FreeDict website. Other projects may use that XML file to find out about new releases of the FreeDict databases.


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]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):

public targets in Makefile.common

validation

validates the TEI file of the dictionary module.

find-homographs

Looks for "double-entries" in the TEI file of the dictionary module, ie. entries with headwords that follow the same orthography.

test, test-reverse

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

release-dict-tgz, release-dict-tgz-reverse, release-dict-tbz2, release-dict-tbz2-reverse, release-dict-tbz2-c5, release-dict-tbz2-c5-reverse, release-evolutionary, release-rpm, release-bedic, release-zaurus

puts a release file for the specified platform into the corresponding directory of $(FREEDICTDIR)/release.

query-PLATFORM
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
dist

puts a release file of the dictionary module source into $(FREEDICTDIR)/release/src.

commit

shortcut for cvs -z3 commit. The -z3 is forgotten too often.

version, sourceURL, status

extracts these pieces from the TEI header and prints them on STDOUT. Used during dbupdate.

dbupdate

extracts interesting information from the dictionary module and writes it into freedict-database.xml.

all

default target. It currently converts to dictd database format without packaging the result as a release. In the future it would make sense to generate the files for all supported platforms when this target is invoked.

clean

removes the non-source files generated during the build of anything from the dictionary module.