Abuild - ArchWiki

Jump to content

# Abuild

From ArchWiki

The abuild tooling provides necessary scripts to build and maintain Alpine Linux packages.

It can be used to maintain and build Alpine packages (in an Alpine clean chroot) from an Arch Linux system, without requiring to rely on a separate Alpine installation, such as a container or a VM.

Due to technical differences between Alpine and Arch Linux (e.g. in terms of package manager, init system and C library implementation), building Alpine packages on an Arch system outside of an Alpine clean chroot is not possible. As such, when building Alpine packages on an Arch system, only `abuild rootbld` is relevant to use.

Tip Do not confuse Arch Linux clean chroot with an Alpine one.

## Installation

Install the abuild package.

The atools package provides additional tools like apkbuild-lint(1) and apkbuild-fixer(1) that may also be of interest (see #Usage).

## Configuration

abuild subcommands that are not about building packages should be usable right out of the box (e.g. generating / updating checksums, fetch sources, cleaning temporary directories, ... see the abuild(1) § COMMANDS).

To be able to build Alpine packages in an Alpine clean chroot, you need to generate a public / private rsa key pair with the abuild-keygen tool and add your user to the `abuild` user group (which is created when installing the abuild package):

    $ abuild-keygen -a -i

Note You need to logout / login for the addition of your user to the `abuild` group to take effect.

One can optionally edit the `/etc/abuild.conf` configuration file to their liking and requirements. For instance, the paths used to store downloaded sources (`/var/cache/distfiles` by default) and built packages (`~/packages` by default) can be customized by modifying the `SRCDEST` and `REPODEST` parameters respectively in that configuration file.

The `PACKAGER` and `MAINTAINER` parameters are used by `newapkbuild` when creating new aports for the APKBUILD's "Contributor:" and "Maintainer:" comments, respectively.

## Usage

A basic packaging workflow example using the abuild and atools tooling would start by creating a new port for a package and entering its directory:

    $ newapkbuild package_name && cd package_name

The next step would be editing the APKBUILD, then running the apkbuild linter (provided by the atools package):

    $ apkbuild-lint APKBUILD

One could then run the apkbuild fixer to attempt to automatically fix potential warnings raised by apkbuild-lint (provided by the atools package):

    $ apkbuild-fixer APKBUILD

Afterwards, generate / upgrade checksum for the source(s) contained in the APKBUILD source array:

    $ abuild checksum

Finally, build the package in an Alpine clean chroot:

    $ abuild rootbld

Note `abuild rootbld` assumes your APKBUILD file is in a directory whose structure like Alpine aports.

The `abump` script can be used to bump existing packages.

For instance, the following command will bump the `pandora_box` APKBUILD to version `0.22.0` in a newly created git branch, build the package in a clean chroot, create a commit on successful build (including the link of the related upstream release in the commit message's body) and push said commit to the default `origin` git remote (see abump(1) for an extensive list of available options and arguments):

    $ abump --branch --rootbld --message "https://gitlab.exherbo.org/sydbox/sydbox/-/tags/pandora-0.22.0" --push origin pandora_box-0.22.0

See Alpine Linux Wiki's "Abuild and Helpers" page for more details and usage examples.

Category:

- Package development

Abuild
Add topic