makepkg is used for compiling your own packages suitable for Pacman to use. It uses a script-based build system which can download and validate source files, check dependencies, configure build time settings, build the package, install the package into a temporary root, make customizations, generate meta-info and package the whole thing up. As you can see
makepkg has a lot of features, the basics of which are described below.
Setting Things Up
Arch Build System
If you want to use ABS - The Arch Build System first obtain it by running as root:
You can allow your user to access the ABS directories by running (replace "user" at the end of the usermod command with your user name):
groupadd abs usermod -aG users,slocate,abs user chown root:abs /var/abs/local chmod 775 /var/abs/local
You need to install fakeroot if you want to build packages as a non-root user:
pacman -Sy fakeroot
If you want to be able to install dependencies with makepkg as user you need to install sudo and add yourself to /etc/sudoers using this line:
Next you need to decide where you want to create your packages, for instance you could have them under your home directory under a separate folder. As your your normal user account make the directory (replace user below with your user name):
Building a Package
To build a package you either need to create one as described at The_Arch_package_making_HOW-TO_-_with_guidelines, or obtain one from AUR or ABS or some other source. You should be careful where you obtain your packages from and only install those from people and sources you trust.
Say you found an excellent package on AUR that you wanted to build and install (in this example we will use "rufus" the Python based bit torrent client). You can obtain the
PKGBUILD and all files needed from here, click on the "Tarball" link.
cd /path/to/file tar -zxf rufus.tar.gz cd rufus
You will notice there are a number of files located under this directory including the
PKGBUILD script that is used to build your package. To build this package just issue:
Which will then set up, download and attempt to build your package. If you don't have all the required dependencies installed
makepkg will warn you before failing. To install these just issue the usual command as root to install packages:
pacman -Sy somepackage1 somepackage2
Note that these dependences will need to be in your configured repositories though, if they are not you will either have to configure a repository that contains the dependences or install them first using the above methods.
Once you have satisfied all the dependencies and your package builds successfully you should now have the rufus-0.7.0-1.pkg.tar.gz file in the directory you run
makepkg in. To install it (as the root user) issue:
pacman -A rufus-0.7.0-1.pkg.tar.gz
Congratulations! You now have successfully installed your own package!