3.5. Directory and anybuild of trial package

Each package needs anybuild for handling with any system: file in shell language with actions for building. Review the installed anybuild for xz package: ./xz-5.2.5/xz.build file.

#!/bin/sh


src_config()
{
    ./configure \
        --prefix=${PREFIX} \
        --docdir=${PREFIX}/share/doc/${P}
}

src_compile()
{
    make ${MAKEOPTS}
}

src_install()
{
    make install ${MAKEOPTS} DESTDIR=${D}
}

First feature: build commands are distributed by functions. As build is not directly executable, functions are not called there.

Second feature: code uses variables. The variables are initialised by build system. The variables with upper-register names are part of API, provided by any. The purpose of variables alongside with the rest of API is to provide powerful and flexible functionality for build processes. Their part and meaning we will consider in more details inside further guide sections.

For the trial project with its current settings the code of anybuild above is equivalent to the following code:

    ./configure \
        --prefix=/usr \
        --docdir=/usr/share/doc/xz-5.2.5
    make
    make install DESTDIR=$(pwd)/build/image/amd64/xz-5.2.5

Besides ./xz-5.2.5/xz.build anybuild and ./xz-5.2.5/xz-5.2.5.tar.gz sources archive the package directory contains the directory ./xz-5.2.5/patch/. It stores patches, which are applying automatically before the build. In our example above ther is one patch ./xz-5.2.5/patch/001-xzgrep-ZDI-CAN-16587.patch from the authors of xz package.

The approach with patches allows to create and accumulate edits in the source text, made on your own, without changing the entire archive from their authors.