Build And Install Packages From The Arch User Repository (AUR).


This article explains how to build and install packages from the Arch User Repository. The Arch User Repository contains user submitted packages. It is abbreviated to AUR and is the equivalent to the Universe repository in Ubuntu.

The author recently required the obexftp package for bluetooth file transfer. This package was not available in the Arch main package repository. However, it was available in AUR.

The following packages are necessary to build and install packages available in AUR:

  • base-devl: Contains utilities, such as gcc, make and fakeroot etc. for building packages from source.
  • cower: Utility to search and download PKGBUILD files for a given package, available in AUR.

Use pacman to install dependencies for building AUR packages from source.

sudo pacman -S base-dev cower

Search the AUR, via the web interface, for the package that must be built. Alternatively, use the cower utility to search, using the -s switch, e.g:

cower -s search_string

Create a folder to store package builds.

mkdir ~/builds
cd ~/builds

Use the cower utility to download the installation script from AUR, for the package to build. Cower is a utility that downloads a PKGBUILD file. This is a shell script that performs the build process, e.g. downloading and compiling package dependencies.

cower -d package_name

This will create a subfolder, named after the package to build and install. The subfolder contains the PKGBUILD script, in addition to supporting files and documentation for installation.

The makepkg utility can then be used to perform the build process, using a PKGBUILD file in the current directory. A package archive file is produced that can then be installed using the pacman package manager.

The author uses the following makepkg command line switches to build AUR packages from source on the Raspberry Pi:

  • -A: Ignore architecture. Packages in the AUR reference the x86 architecture. The Raspberry Pi uses the ARM chipset.
  • -c: Clean directory after install.
  • -s: Install package build dependencies.
  • -r: Remove build dependencies after the package has been successfully built.

For example, the following set of commands will download and build the openobex library from AUR.

cower -d openobex
cd openobex
makepkg -Acsr

A local package archive file is produced, for installation. Install the local package file using the -U switch of the pacman package manager.

sudo pacman -U pkg_file_name

Further documentation relating to AUR and building packages from source is detailed in the Arch Linux Wiki.

Comments

Leave a comment