4.5. Packages and anybuilds

Anybuild (.build):
file in shell language (bourne-compatible), containing individual code to build the package.
Many of build activities are the same for every package, so they are taken out into library functions: for example, source copying or patch applying. In its part anybuild contains commands, which are unique for the given package.

Examine the anybuild xz-5.2.5/xz.build from the example more close.


    ./configure \
        --prefix=${PREFIX} \

    make ${MAKEOPTS}

    make install ${MAKEOPTS} DESTDIR=${D}

The first string contains command interpretator: #!/bin/sh
Pay attention to the usage of more universal variation sh, instead of bash. Anybuilds from our examples do not use language constructions, which require bash.

Function src_config(3) serves to configure the package. It is called inside map sequence, listed in previous section.

Package configuration sets up the main phase of building (for example, compilation). In the given case the simple launch of configure script with two arguments occurs.

The variables from upper letters are part of program agreements, which any system provides. Their values are initialised by the engine before the calling of functions from the anybuild.

Contains basic prefix for program installation. The default value is /usr
The value for the variable is provided by option any_program_prefix from rdd.conf.d/ config directory. To change that value, one needs to write the new prefix into rdd.def file or put it in command line during the build.

The example of value inside rdd.def file:
The example of value in command line:
    any do id xz-5.2.5 any_program_prefix=/usr/local

Contains full package name. That is xz-5.2.5 in our case. The variable does not depend on options from configuration.

The same effect would be after direct assigning for --prefix without variables:

    ./configure \
The main advantage in variables (and in interfaces of other types) is the ability to change the behaviour in consistent way without anybuild editing. If from some moment the need arises to change the value of --prefix, direct assignment --prefix=/usr leads to editing of each anybuild (and there can be lots of them).
If the value is assigned via the variable, the further adaptation is performed through the single edit of that variable in the configuration file, and modification applies to all packages.

Function src_compile(3) launches the essential building. That is traditional execution of make in the example above.

variable with parameters for make.
The example for such parameters is parallel option: MAKEOPTS=-j8

Function src_install(3) installs the package content, producing the file tree.

variable with the path to intermediate location of package installation. That is initially empty directory, containing only package files after its installation. That way it would be possible to produce the installable archive with that package.
For the example above D contains the following path:
rootrdd(1) outputs the path to the root of working directory, which is the starting point for all paths inside it.

Large description of anybuilds and their capabilities is located at any-build(7).
The description of all variables, composing API, is located at any-api(7).