Chapter 9. The definitions script

Table of Contents

9.1. Requiring a Buildtool version
9.2. Package information
9.3. Module flags
9.4. Example

The definitions script tells Buildtool several important and basic information about a software package. This information is used in almost all Buildtool modules to determine the package name, its version, its license, etc. Therefore, it must exist in all buildtoolized packages.

The script is located inside the defs, to be placed inside the Generic.bt file (see Chapter 8, Script files). It should only define variable values, hence the name.

9.1. Requiring a Buildtool version

When you develop a package, you use a specific Buildtool version. End users may have a different (older) version than you, so they will have problems to compile your program. Therefore, you must tell Buildtool which version you used when creating your program, so it can check if the installed one is good enough to compile the package. See Section 1.3, “Versioning” for more details on how Buildtool versions are handled.

The BT_REQUIRE is used to accomplish this task; it simply contains the version number you used to develop your program.

bt_lint will complain if you don't follow these rules.

9.2. Package information

The following variables describe the basic details of a package. They should appear in the same order as described here:

BT_PKG_NAME

The package name. Should be one word, without capitalization and without spaces. The distribution file will take its name from this variable. Must be defined.

BT_PKG_VERSION

The package version number. May be a dotted number (following the usual X.Y convention), a date, or whatever you prefer. Must be defined.

BT_PKG_LICENSE

A word indicating the license name of your project. If any of the following names is applicable, use them (instead of changing case, adding spaces, etc.): apache, bsd, lgpl, gplv1, gplv2 (you get the idea). Must be defined.

BT_PKG_MAINTAINER

An email address pointing to the responsible person of the software package. Can be a mailing lists if multiple persons feel responsible of it. Must be defined.

BT_PKG_HOMEPAGE

The homepage of the program, if applicable. May be ommited.

BT_PKG_COMMENT

A single, short sentence describing the package. Shouldn't start with the A word. Should start with uppercase. Must be defined.

BT_PKG_DISTFMTS

Whitespace separated list of the default distribution files that the bt_dist module (see Chapter 14, Creating distribution files) will build. Defaults to tar.gz. Can be ommited.

9.3. Module flags

A package might require you to always pass some extra arguments to specific modules to work (this is very rare, though). Buildtool can do this job for you, so you do not have to worry about those specific details. Anyway, be careful with this feature. Do not use it if you do not have a good reason to do so.

The following variables are recognized:

BT_PKG_CONFIG_FLAGS

Extra arguments to be passed to the bt_config module.

BT_PKG_DIST_FLAGS

Extra arguments to be passed to the bt_dist module.

BT_PKG_DOC_FLAGS

Extra arguments to be passed to the bt_doc module.

BT_PKG_LINT_FLAGS

Extra arguments to be passed to the bt_lint module.

BT_PKG_MAKE_FLAGS

Extra arguments to be passed to the bt_make module.

9.4. Example

This section contains an example of a definitions script. Please note how variables are grouped in blocks; follow these conventions when writting your file.

defs() {
    # Package definitions

    BT_REQUIRE="0.12"

    BT_PKG_NAME="exampledefs"
    BT_PKG_VERSION="0.1"
    BT_PKG_LICENSE="bsd"

    BT_PKG_MAINTAINER="somebody@somewhere.org"
    BT_PKG_HOMEPAGE="http://somewhere.org/"
    BT_PKG_COMMENT="Example definitions file"
}