makechrootpkg
builds Arch Linux packages in a clean chroot environment
TLDR
SYNOPSIS
makechrootpkg [options] -r chroot [--] [makepkg-args]
DESCRIPTION
makechrootpkg builds a PKGBUILD inside a clean, isolated chroot environment. This ensures reproducible builds by insulating the build from the host system's installed packages and configuration, making it the standard method for building official Arch Linux packages.The chroot is managed as a root template plus per-user working copies that are cloned from it. Options such as -c and -u refresh the working copy, while -I and -d let you customize the build environment.
PARAMETERS
-r dir
Chroot directory to build in (required).-c
Clean the chroot copy before building.-u
Update the working copy (chroot) before building.-I pkg
Install the given package file into the working copy before building.-d dir[:dest]
Bind-mount a host directory into the chroot as read-write.-D dir[:dest]
Bind-mount a host directory into the chroot as read-only.-t dir[:opts]
Mount a tmpfs at the specified directory inside the chroot.-l name
Name of the working copy directory (defaults to `$USER`).-n
Run namcap quality checks on the built package.-C
Run checkpkg validation against the previous package version.-T
Build inside a temporary copy (discarded after the build).-U user
Run makepkg as the specified user.-x when
Launch an interactive shell inside the chroot: `never`, `always`, or `failure`.-h
Display usage information.
SETUP
mkarchroot /var/lib/archbuild/extra-x86_64/root base-devel
# Build the package in the current directory
cd package-dir
makechrootpkg -c -r /var/lib/archbuild/extra-x86_64
CAVEATS
Requires the devtools package. The chroot must be initialized with mkarchroot before first use. Root privileges are needed; slower than running makepkg directly but produces cleaner, more reproducible builds. Anything after -- is forwarded to makepkg.
HISTORY
makechrootpkg is part of Arch Linux devtools, maintained by Arch Linux developers and Trusted Users for building official packages in reproducible chroot environments.
SEE ALSO
makepkg(8), pacman(8), devtools(7), pkgctl(1), systemd-nspawn(1)
