LinuxCommandLibrary

pkgctl-build

Build packages from build instructions

TLDR

Automatically choose the right build script to build packages in a clean chroot

$ pkgctl build
copy

Manually build packages in a clean chroot
$ pkgctl build --arch [architecture] --repo [repository] --clean
copy

SYNOPSIS

pkgctl build [
    --chroot | -c
    --force | -f
    --install | -i
    --syncdeps | -s
    --rmdeps | -r
    --skipinteg
    --noextract
    --nodeps
    --noconfirm
    --clean
    --log
    --log-level <level>
    ...
][<package-path>]

PARAMETERS

[package-path]
    Path to the directory containing the PKGBUILD file, or the PKGBUILD file itself. Defaults to the current working directory.

-c, --chroot
    Build the package in a clean chroot environment. This ensures a pristine build free from system-specific dependencies.

-f, --force
    Force the build process, even if a package with the same version already exists or is considered up-to-date.

-i, --install
    Install the built package(s) using pacman after a successful build.

-s, --syncdeps
    Sync and install any missing build dependencies from the official repositories before building.

-r, --rmdeps
    Remove build dependencies after the package has been successfully built and/or installed.

--skipinteg
    Skip integrity checks (MD5, SHA256, etc.) for source files. Use with caution.

--noextract
    Do not extract the source files. Useful if sources are already extracted in the build directory.

--nodeps
    Do not check for or install any dependencies. Assumes all necessary dependencies are already satisfied.

--noconfirm
    Do not prompt for any user confirmation during the build or installation process.

--clean
    Clean up the build directory before and after the build process.

--log
    Log the build output to a file for later review.

--log-level <level>
    Set the verbosity level for logging output (e.g., info, debug, warn).

DESCRIPTION

pkgctl-build is a powerful subcommand of the pkgctl utility, specifically designed to streamline the process of building Arch Linux packages. It acts as an intelligent wrapper around makepkg, automating crucial steps such as resolving and installing build dependencies, fetching source files, and executing the build process. This command is particularly valuable for users who frequently interact with the Arch User Repository (AUR) or manage custom local packages. It aims to simplify the common workflow, often reducing it to a single command, making package creation and maintenance more efficient and less prone to manual errors. Features like optional chroot builds ensure clean environments, while integration with pkgctl's broader capabilities offers a cohesive package management experience on Arch-based systems. It handles various build scenarios, providing a more integrated and user-friendly interface compared to manual makepkg invocations.

CAVEATS

pkgctl-build relies heavily on the underlying makepkg utility and its configuration found in /etc/makepkg.conf.
Using the --chroot option requires arch-install-scripts and a properly set up chroot environment (e.g., via mkarchroot).
Building packages from the Arch User Repository (AUR) carries inherent risks as these packages are user-contributed and not officially supported.
This command is primarily designed for Arch Linux and its derivatives.

PKGBUILD FILES

pkgctl-build operates on PKGBUILD files, which are essential shell scripts in Arch Linux. These files contain all the metadata and instructions necessary for makepkg (and by extension, pkgctl-build) to download sources, resolve dependencies, compile software, and package it into an Arch Linux package (.pkg.tar.zst).

CHROOT BUILDS EXPLAINED

Building in a chroot (change root) environment, enabled by the --chroot option, involves creating a minimal, isolated Arch Linux installation. This ensures that the package is built against a clean, consistent set of dependencies, preventing 'polluted' builds where a package might inadvertently link against libraries or files present only on the host system. This is crucial for reproducible builds and for ensuring the package works correctly on other Arch systems.

HISTORY

pkgctl is a relatively modern addition to the Arch Linux ecosystem, developed to provide a more unified and user-friendly command-line interface for various package management tasks. pkgctl-build specifically emerged to streamline the often complex process of building local or AUR packages, offering a more automated approach than direct makepkg commands. Its development reflects a trend towards consolidating and improving the user experience for Arch Linux package maintainers and users.

SEE ALSO

makepkg(8), pacman(8), pkgctl(1), git(1)

Copied to clipboard