makepkg
From ArchWiki
| Article summary |
|---|
| An overview of Arch Linux's package build utility. |
| Available in languages |
| English |
| Italiano |
| Ελληνικά |
| 简体中文 |
| Русский |
| Türkçe |
| Nederlands |
| Related articles |
| Arch Build System |
| Arch User Repository |
| Building Packages |
| makepkg.conf |
| pacman |
| PKGBUILD |
| External links |
| AUR |
| makepkg(8) Manual Page |
makepkg is used for compiling and building packages suitable for installation with pacman, Arch Linux's package manager. makepkg is a script that automates the building of packages; it can download and validate source files, check dependencies, configure build-time settings, compile the sources, install into a temporary root, make customizations, generate meta-info, and package everything together.
Configuration
To be able to install dependencies with makepkg as an unprivileged user (with makepkg -s, see below) install sudo and add desired users to /etc/sudoers:
USER_NAME ALL=(ALL) NOPASSWD: /usr/bin/pacman
The above will negate the need to enter a password with pacman. See the sudo wiki article for detailed information.
Next, one can configure where finished packages should be placed. This step is optional; packages will be created in the working directory where makepkg is run by default.
Create the directory:
$ mkdir /home/$USER/packages
Then modify the PKGDEST variable in /etc/makepkg.conf accordingly.
/etc/makepkg.conf is the main configuration file for makepkg. Most users will wish to fine-tune makepkg configuration options prior to building any packages. (For example, modifying the MAKEFLAGS variable on SMP systems for a reduction in compile times, or modifying the PACKAGER variable to personalize packages.) See makepkg.conf for detailed information.
Usage
Before continuing, ensure the "base-devel" group is installed. Packages belonging to this group are not required to be listed as dependencies in PKGBUILD files. Install the "base-devel" group by issuing (as root):
# pacman -Sy base-devel
To build a package, one must first create a PKGBUILD, or build script, as described in Building Packages, or obtain one from the Arch Build System, Arch User Repository, or some other source.
Once in possession of a PKGBUILD, change to the directory where it is saved and issue the following command to build the package described by said PKGBUILD:
$ makepkg
If required dependencies are missing, makepkg will issue a warning before failing. To build the package and install needed dependencies automatically, simply use the command:
$ makepkg -s
Note that these dependencies must be available in the configured repositories; see pacman#Repositories for details. Alternatively, one can manually install dependencies prior to building (pacman -Sy dep1 dep2).
Once all dependencies are satisfied and the package builds successfully, a package file (pkgname-pkgver.pkg.tar.gz) will be created in the working directory. To install, run (as root):
# pacman -U pkgname-pkgver.pkg.tar.gz