Arch Build System
Related articles
- Arch packaging standards
- Arch User Repository
- Creating packages
- Kernel Compilation with ABS
- makepkg
- Official repositories
- pacman
- PKGBUILD
- Patching in ABS The Arch build system is a ports-like system for building and packaging software from source code. While pacman is the specialized Arch tool for binary package management (including packages built with the ABS), ABS is a collection of tools for compiling source into installable .pkg.tar.zst packages. Ports is a system used by *BSD to automate the process of building software from source code. The system uses a port to download, unpack, patch, compile, and install the given software. A port is merely a small directory on the user's computer, named after the corresponding software to be installed, that contains a few files with the instructions for building and installing the software from source. This makes installing software as simple as typing or within the port's directory. ABS is a similar concept. A part of ABS is a SVN repository and an equivalent Git repository. The repository contains a directory corresponding to each package available in Arch Linux. The directories of the repository contain a PKGBUILD file (and sometimes other files), and do not contain the software source nor binary. By issuing makepkg inside a directory, the software sources are downloaded, the software is compiled, and then packaged within the build directory. Then you can use pacman to install the package.
- Repository tree
- The directory structure containing files needed to build all official packages but not the packages themselves nor the source files of the software. It is available in svn and git repositories. See the section #Repository tree for more information.
- PKGBUILD
- A Bash script that contains the URL of the source code along with the compilation and packaging instructions.
- makepkg
- A shell command tool which reads the PKGBUILDs, automatically downloads and compiles the sources and creates a .pkg.tar* according to the array in
makepkg.conf
. You may also use makepkg to make your own custom packages from the AUR or third-party sources. See Creating packages for more information. - pacman
- pacman is completely separate, but is necessarily invoked, either by makepkg or manually, to install and remove the built packages and for fetching dependencies.
- AUR
- The Arch User Repository is separate from ABS but AUR (unsupported) PKGBUILDs are built using makepkg to compile and package up software. In contrast to the ABS tree which is simply a bare git repository, the AUR exists as a polished website interface with various interactive features. It contains many thousands of user-contributed PKGBUILDs for software which is unavailable as an official Arch package. If you need to build a package outside the official Arch tree, chances are it is in the AUR.
- Any use case that requires you to compile or recompile a package.
- Make and install new packages from source of software for which no packages are yet available (see Creating packages).
- Customize existing packages to fit your needs (e.g. enabling or disabling options, patching).
- Rebuild your entire system using your compiler flags, "à la FreeBSD".
- Cleanly build and install your own custom kernel (see Kernel compilation).
- Get kernel modules working with a custom kernel.
- Easily compile and install a newer, older, beta, or development version of an Arch package by editing the version number in the PKGBUILD.
- check your spelling of the package name
- check that the package has not been moved to another repository (i.e. from community to the main repository)
- check https://archlinux.org/packages to see if the package is built from another base package (for example, is built from the PKGBUILD)
- pbget - retrieve PKGBUILDs for individual packages directly from the web interface. Includes AUR support.
Overview
'ABS' may be used as an umbrella term since it includes and relies on several other components; therefore, though not technically accurate, 'ABS' can refer to the following tools as a complete toolkit:
Repository tree
The core, extra, and testing official repositories are in the packages repository for checkout. The community and multilib repositories are in the community repository.
Each package has its own subdirectory. Within it, there are and directories. is further broken down by repository name (e.g., core) and architecture. PKGBUILDs and files found in are used in official builds. Files found in are used by developers in preparation before being copied to .
For example, the tree for looks like this:
acl acl/repos acl/repos/core-x86_64 acl/repos/core-x86_64/PKGBUILD acl/trunk acl/trunk/PKGBUILDThe source code for the package is not present in the ABS directory. Instead, the contains a URL that will download the source code when the package is built.
Use cases
ABS automates certain tasks related to compilation from source. Its use cases are:
Usage
Retrieve PKGBUILD source
To retrieve the PKGBUILD file required to build a certain package from source, you can either use SVN or a Git-based approach.
Retrieve PKGBUILD source using Git
Using the asp tool
As a precondition, install the package. Asp is a tool to retrieve the build source files for Arch Linux packages using the Git interface. Also see the Arch Linux BBS forum thread .
A start point to using can be to
$ asp export pkgnameThis will mark pkgname for tracking by , and also dump the current build source files for pkgname into a directory of the pkgname in the current working directory. It auto magically
$ asp update pkgnamefollowed by
$ asp export pkgnameThese 2 commands can be run manually. Note that here, build source files refers to PKGBUILD, possibly with some few other required files, such as keys. That is, the essential files the are required for Arch Linux build system. It does not refer to the source files of the package that were written by the team that authored the package, such as C or Python files.
To clone the git repository of the build source files for a given package into a directory named like the package, use
$ asp checkout pkgnameThis will give you not only the current source build files, but also their previous versions. Furthermore, you can use all other git commands to checkout an older version of the package or to track custom changes. For more information on git usage, see the git page. Note you do not need if you do not want to look at previous versions. Also, note again for the distinction between build source files, and source files. That is, Arch Linux added files, and the upstream author files.
In any case, to update what tracks, you have to run . In the case of the from above, you also have to inside the git repository to make it up to date.
Do read asp(1) for more insight, and for the other commands available.
Using git directly
Use the following git command to clone only a specific branch. This way you avoid copying the whole repository:
$ git clone --branch branch/package --single-branch https://github.com/archlinux/svntogit-packages.gitFor example, to copy the apache build files:
$ git clone --branch packages/apache --single-branch https://github.com/archlinux/svntogit-packages.gitRetrieve PKGBUILD source using SVN
Prerequisites
Install the package.
Checkout a repository
To checkout the core, extra, and testing official repositories:
$ svn checkout --depth=empty svn://svn.archlinux.org/packagesTo checkout the community and multilib repositories:
$ svn checkout --depth=empty svn://svn.archlinux.org/communityIn both cases, it simply creates an empty directory, but it does know that it is an svn checkout.
Checkout a package
In the directory containing the svn repository you checked out (i.e., packages or community), do:
$ svn update package-nameThis will pull the package you requested into your checkout. From now on, any time you svn update at the top level, this will be updated as well.
If you specify a package that does not exist, svn will not warn you. It will just print something like "At revision 115847", without creating any files. If that happens:
You should periodically update all of your checked out packages if you wish to perform rebuilds on more recent revisions of the repositories. To do so, do:
$ svn updateCheckout an older version of a package
Within the svn repository you checked out as described in #Checkout a repository (i.e. "packages" or "community"), first examine the log:
$ svn log package-nameFind out the revision you want by examining the history, then specify the revision you wish to checkout. For example, to checkout revision you would do:
$ svn update -r1729 package-nameThis will update an existing working copy of package-name to the chosen revision.
You can also specify a date. If no revision on that day exists, svn will grab the most recent package before that time. The following example checks out the revision from 2009-03-03:
$ svn update -r'{20090303}' package-nameIt is possible to checkout packages at versions before they were moved to another repository as well; check the logs thoroughly for the date they were moved or the last revision number.
Build package
Configure makepkg for building packages from the PKGBUILDs you have checked out, as explained in makepkg#Configuration.
Then, copy the directory containing the PKGBUILD you wish to modify to a new location. Make the desired modifications there and use makepkg there as described in makepkg#Usage to create and install the new package.
Tips and tricks
Preserve modified packages
Updating the system with pacman will replace a modified package from ABS with the package of the same name from the official repositories. See the following instructions for how to avoid this.
Insert a group array into the PKGBUILD, and add the package to a group called .
Add this group to the section in .
/etc/pacman.conf
IgnoreGroup = modified
If new versions are available in the official repositories during a system update, pacman prints a note that it is skipping this update because it is in the IgnoreGroup section. At this point, the modified package should be rebuilt from ABS to avoid partial upgrades.