“makepkg” is a command line tool for building packages for the Arch Linux package manager, “pacman”. It is used to create a package file (with a “.pkg.tar” extension) from a source code archive, along with the build instructions specified in the PKGBUILD file.
A PKGBUILD file is a shell script that contains the information necessary to build a package, including:
- Package name, version, and description
- Source code location and checksums
- Build dependencies and other required packages
- Compilation flags and build instructions
By using makepkg, a user can build a package from source code, including downloading and verifying the source code, building the package, and creating the package file. This is useful for:
- Building packages for systems with limited internet access, since the package and its dependencies can be installed from a local package file.
- Customizing packages by modifying the PKGBUILD file to include different build options.
- Creating packages from source code that is not available in the official Arch Linux repository.
If you encounter the below error while running the command makepkg:
makepkg: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install pacman |
Ubuntu | apt-get install pacman |
Alpine | apk add pacman |
Arch Linux | pacman -S pacman |
Kali Linux | apt-get install pacman |
Fedora | dnf install pacman |
OS X | brew install makepkg |
Raspbian | apt-get install pacman |
makepkg Command Examples
1. Make a package:
# makepkg
2. Make a package and install its dependencies:
# makepkg --syncdeps
3. Make a package, install its dependencies then install it to the system:
# makepkg --syncdeps --install
4. Make a package, but skip checking the source’s hashes:
# makepkg --skipchecksums
5. Clean up work directories after a successful build:
# makepkg --clean
6. Verify the hashes of the sources:
# makepkg --verifysource
7. Generate and save the source information into `.SRCINFO`:
# makepkg --printsrcinfo > .SRCINFO