Autotools plugin

The plugin makes use of the following tools:

The Autotools plugin builds using the ./configure, make and make install sequence seen in most GNU projects.

After a successful build, this plugin will install the generated binaries in $CRAFT_PART_INSTALL.

Keywords

In addition to the common plugin and sources keywords, this plugin provides the following plugin-specific keywords:

autotools-bootstrap-parameters

Type: list of strings Default: []

Bootstrap flags to pass to the build if a bootstrap file is found in the project. These can in some cases be seen by running ./bootstrap --help.

autotools-configure-parameters

Type: list of strings Default: []

configure flags to pass to the build such as those shown by running ./configure --help.

Environment variables

The plugin does not set any environment variables.

Dependencies

The Autotools plugin needs the autoconf, automake, make, autopoint and libtool executables to work. These are provided by the plugin as a build-packages entry.

The plugin also sets up gcc as it is the most commonly used compiler for an Autotools based project. Other compiler or library dependencies the source requires to build are to be provided.

How it works

During the build step the plugin performs the following actions:

  • If the source does not provide a configure file, one will be generated through the following options:

    1. If an autogen.sh file is found in the sources it will be run with NOCONFIGURE set to generate a configure file;

    2. Alternatively, if a bootstrap file is found in the sources, it will run the bootstrap with any set autotools-bootstrap-parameters without configuring the project;

  • Call configure with any set autotools-configure-parameters;

  • Call make to build;

  • Call make install with DESTDIR set to $CRAFT_PART_INSTALL.

Examples

The following snippet declares a part using the autotools plugin. It sets GNU Hello as a source, which has a bootstrap file. To setup the configure file to not care for translations autotools-bootstrap-parameters is using the project’s option --skip-po. During configure the installation --prefix is set to /usr with autotools-configure-parameters.

The source also requires the following packages to correctly build: git, gperf, help2man and texinfo.

parts:
  hello:
    source: https://git.savannah.gnu.org/git/hello.git
    plugin: autotools
    autotools-bootstrap-parameters:
      - --skip-po
    autotools-configure-parameters:
      - --prefix=/usr/
    build-packages:
      - git
      - gperf
      - help2man
      - texinfo