Arch Linux Packaging


Distributed Design

The Arch Linux project encourages and empowers users to create their own software packages.

The Arch Linux project also supports code for running public and private mirrors of the official binary packages.


PKGBUILD

A PKGBUILD is a shell script to build a software package installable by pacman(8). The shell script is called by the makepkg(8) utility.

A PKGBUILD...

It's also possible to specify build-time dependencies with the makedepends variable (same format as depends), test suite dependencies with the checkdepends variables (again, same format), and optional (feature gate) dependencies with the optdepends variable (try: optdepends=('cups: printing support')).

If a package provides software that may be depended upon by other packages, set the provides array variable accordingly. Try: provides=('foobar=1.2.3').


makepkg

The makepkg(8) utility uses PKGBUILD scripts to build a package.

To build a package, try:

makepkg

To install all of a package's dependencies, built it, and install it, try:

makepkg --syncdeps --install

To build a source code only package (a tarball that does not include sources that can be fetched via a download URL), try:

makepkg -S

makepkg(8) is configured with makepkg.conf(5) and through environment variables. In particular, these variables are often configured:

Variable

Default

Suggested Value

Meaning

PKGDEST

.

$HOME/packages

built package base directory

SRCDEST

.

$HOME/sources

package source code base directory

SRCPKGDEST

.

$HOME/srcpackages

source code only package base directory

LOGDEST

.

$HOME/makepkglogs

build logs base directory

PACKAGER

packager name and contact info

GPGKEY

packager GPG key


makechrootpkg

The makechrootpkg(8) utility builds packages in a clean chroot.

The chroot must first be setup like:

mkdir ~/chroot
export CHROOT=$HOME/chroot
mkarchroot $CHROOT/root base-devel

To keep the chroot up-to-date, run:

arch-nspawn $CHROOT/root pacman -Syu

Lastly, build packages with:

makechrootpkg -c -r $CHROOT


Arch User Repository

The AUR (Arch User Repository) is a public git repository of user-created and user-maintained PKGBUILD scripts.

The AUR is chiefly a way to coordinate the distribution of non-free and closed source applications on Arch Linux. Because a PKGBUILD script itself does not contain copyrighted material, they can be distributed freely and developed as open source code.

While these PKGBUILD scripts can be cloned and used directly, there are a number of 'AUR helpers' that automate this process. See pacaur, paru, pikaur, trizen, yaourt, and yay.


CategoryRicottone

Linux/Arch/Packaging (last edited 2023-12-02 01:46:19 by DominicRicottone)