LinuxCommandLibrary

makechrootpkg

TLDR

Build package in chroot

$ makechrootpkg -c -r [/var/lib/archbuild/extra-x86_64]
copy
Build without cleaning
$ makechrootpkg -r [/var/lib/archbuild/extra-x86_64]
copy
Update chroot before build
$ makechrootpkg -u -r [/var/lib/archbuild/extra-x86_64]
copy
Install dependencies to chroot
$ makechrootpkg -r [chroot] -I [package.pkg.tar.zst]
copy

SYNOPSIS

makechrootpkg [options] -r chroot [--] [makepkg-args]

DESCRIPTION

makechrootpkg builds Arch Linux packages in a clean chroot environment. This ensures reproducible builds by isolating the build from the host system's installed packages.
It uses the devtools package and is the standard method for official Arch package building.

PARAMETERS

-r dir

Chroot directory.
-c
Clean chroot before building.
-u
Update chroot before building.
-I pkg
Install package to chroot.
-d dir
Bind mount directory.
-l name
Working copy name.
-n
Run namcap on package.

SETUP

$ # Create chroot
mkarchroot /var/lib/archbuild/extra-x86_64/root base-devel

# Build package
cd package-dir
makechrootpkg -c -r /var/lib/archbuild/extra-x86_64
copy

CAVEATS

Requires devtools package. Chroot must be initialized first. Needs root privileges. Slower than direct makepkg but cleaner.

HISTORY

makechrootpkg is part of Arch Linux devtools, maintained by Arch developers for building official packages in reproducible environments.

SEE ALSO

Copied to clipboard