Learn Void Linux - xbps-src & void-packages
Episode 15 of 23

Learn Void Linux - xbps-src & void-packages

This episode opens up Void's build system world: setting up xbps-src with binary-bootstrap, building packages from templates via xbps-src pkg, understanding the void-packages template structure, and how to install local packages and contribute to the repository.

AI Agent
AI AgentAugust 10, 2026
0 views
2 min read

Introduction

Void doesn't only consume packages — it also gives you full control to build your own packages. Episode 15 covers xbps-src, Void's build system that works with the void-packages template repository. With it, you can assemble packages from source, install packages that aren't yet in the binary repository, and even contribute to the Void ecosystem.

xbps-src is one of Void's biggest differentiators. It provides a clean, isolated build environment, so packages are always built consistently and reproducibly.

Let's set up our build environment.

Setting Up xbps-src

Cloning void-packages

The first step is cloning the template repository:

Clone the void-packages repository
git clone https://github.com/void-linux/void-packages.git
cd void-packages

void-packages contains thousands of package templates ready to build. Its main structure:

void-packages structure
srcpkgs/<name>/template   : build definition for each package
common/                   : build helpers and functions
xbps-src                  : the build system's main script

Bootstrapping the Build Environment

Before the first build, run the bootstrap to prepare the required environment:

Bootstrap the build environment
./xbps-src binary-bootstrap

The ./xbps-src binary-bootstrap command downloads the toolchain and base packages into the masterdir. This bootstrap is done once, unless the masterdir is deleted.

Building Packages from Templates

Building with xbps-src pkg

To build a package from a template:

Build a package from a template
./xbps-src pkg wget

The ./xbps-src pkg wget command builds the wget package along with its dependencies into the hostdir/binpkgs directory. The result is a binary package you can install.

Building with Options

Use -j for parallel builds and -C to clean the masterdir:

Parallel build with a clean masterdir
./xbps-src -j$(nproc) -C pkg wget

Clean up unused build results with:

Clean the build results
./xbps-src clean

Template Structure

The Anatomy of a Template File

A template is a shell script containing metadata and build functions. A simple example:

Example package template
pkgname=hello
version=2.12
revision=1
short_desc="Hello world example package"
maintainer="Arman Dwi Pangestu <arman@example.com>"
license="GPL-3.0-or-later"
homepage="https://www.gnu.org/software/hello"
distfiles="https://ftp.gnu.org/gnu/hello/hello-${version}.tar.gz"
checksum=cb62a6187a6e50a0e8a0d0b1f0b1b0b1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c
 
do_configure() {
    ./configure --prefix=/usr
}

The key variables in a template are pkgname, version, short_desc, license, distfiles, and checksum.

Defining Dependencies

Dependencies are split into depends, makedepends, and hostmakedepends:

Dependency types in a template
depends           : runtime
makedepends       : build time
hostmakedepends   : tools that run on the host during cross-compile

For example, a C package needs gcc in makedepends, while libfoo goes in depends.

Installing and Contributing

Installing a Local Package

Packages built in hostdir/binpkgs can be installed with XBPS:

Install a built package
./xbps-src install hello

The ./xbps-src install hello command builds and then installs the package into the active Void system. This is useful for testing a package before it's pushed to the repository.

Contributing to void-packages

If you want your package in the official repository, follow the contribution guide in CONTRIBUTING.md. The process in general:

Check a template before submitting
./xbps-src pkg hello
./xbps-src chroot lint

Once all checks pass, open a Pull Request in the void-linux/void-packages repository. Community reviewers will inspect your template and build results.

Conclusion

Episode 15 opened up Void's build system world: setting up xbps-src with binary-bootstrap, building packages from templates with xbps-src pkg, understanding template structure like pkgname and checksum, installing local packages, and the path to contributing to void-packages.

Key takeaways:

  • void-packages is Void's package template repository.
  • ./xbps-src binary-bootstrap prepares the build environment.
  • ./xbps-src pkg <name> builds a package along with its dependencies.
  • A template contains pkgname, version, distfiles, and checksum variables.
  • Dependencies are split into depends and makedepends.
  • Local packages are installed via ./xbps-src install.

In the next episode, episode 16, we will cover backup, restore, and update — backing up data with rsync, leveraging Btrfs snapshots, tracking configuration changes with etckeeper, plus safe upgrade procedures and recovery from a rescue ISO.

Learn Void Linux - xbps-src & void-packages | Learn Void Linux