Skip to content

Autobuild3 Architectural Manipulation

Yunyang Liu edited this page Apr 4, 2017 · 9 revisions

Architectural Manipulation

Autobuild3 is able to deal with multiple architectures. Meaning that one could write configurations for multiple architectures in one autobuild/ directory.

This section discusses multiple ways one may use Autobuild3 to write build configurations for different architectures.

Using architecture sub-directories

Autobuild3 defines all supported architectures in "$AB"/arch/ (where "$AB" is the path at which Autobuild3 is deployed, defaults to /usr/lib/autobuild3), scripts like mipsel.sh is definitions for the mipsel architecture. An autobuild/ directory with special configurations for mipsel may be presented like below.

$ find `autobuild/`

autobuild/
autobuild/defines
autobuild/mipsel
autobuild/mipsel/defines

Where autobuild/defines is presented like below.

PKGNAME=foo
PKGVER=1.2.2
PKGSEC=libs
PKGDEP="gcc-runtime"
BUILDDEP="graphviz"
PKGDES="Example victim"

In the example above, foo will require graphviz to build, which has a huge dependency set. A packager may not want graphviz to be one of the build dependencies on mipsel, and he/she may write in autobuild/mipsel/defines that:

BUILDDEP=""

Or if the packager would want doxygen as an extra build dependency on mipsel, he/she may write in autobuild/mipsel/defines that:

BUILDDEP+=" doxygen"

The defines file in architecture sub-directories are sourced after the common defines. Other files in architecture sub-directories will replace the common files if found; Autobuild3 will use the overrides directory in the architecture sub-directories instead of the common directory; The patches directory in the architecture sub-directories is not in use.

Using Shell declarations

For packagers that prefer not to use the sub-directories, simple Shell syntaxes may be used as well. Architectures are declared by Autobuild3 according to the packager's configurations in /etc/autobuild/defaults, in the $ARCH variable.

In cross-compiling an extra variable called $CROSS will be defined, and that variable will in turn be the architecture you are building for. So something like ${CROSS:-$ARCH} gives the architecture being built for.

So an example autobuild/defines file may be presented like below, using the example from the "Using architecture sub-directories" section above.

PKGNAME=foo
PKGVER=1.2.2
PKGSEC=libs
PKGDEP="gcc-runtime"
BUILDDEP="graphviz"

if [[ "${CROSS:-$ARCH}" = "mipsel" ]]; then
    BUILDDEP=""
fi
if [[ "${CROSS:-$ARCH}" = *64* ]]; then
    BUILDDEP+=" doxygen"
fi

# The following format is not recommended, as defines may
# return 1 when condition(s) is not met.
# [[ "${CROSS:-$ARCH}" = *64* ]] && BUILDDEP+=" doxygen"

PKGDES="Example victim"

Note that when using glob matching, you would need to use double bracket, and there should not be quotes around the glob declaration (just general Bash syntax requirement, bring your own book).

Clone this wiki locally