LinuxCommandLibrary

makepkg

Build packages from PKGBUILD files

TLDR

Make a package

$ makepkg
copy

Make a package and install its dependencies
$ makepkg [[-s|--syncdeps]]
copy

Make a package, install its dependencies then install it to the system
$ makepkg [[-s|--syncdeps]] [[-i|--install]]
copy

Make a package, but skip checking the source's hashes
$ makepkg --skipchecksums
copy

Clean up work directories after a successful build
$ makepkg [[-c|--clean]]
copy

Verify the hashes of the sources
$ makepkg --verifysource
copy

Generate and save the source information into .SRCINFO
$ makepkg --printsrcinfo > .SRCINFO
copy

SYNOPSIS

makepkg [options]

PARAMETERS

-A
    Bypass the arch test. Useful when building packages for other architectures.

-c | --clean
    Clean up working directory after build.

-C | --noextract
    Do not extract source files.

-d | --nodeps
    Do not perform dependency checks.

-e | --edit
    Edit PKGBUILD after extracting source files.

-f | --force
    Overwrite existing package.

-g | --geninteg
    Generate integrity checks (md5sums, sha256sums, etc.) for source files.

-h | --help
    Show help message and exit.

-i | --install
    Install the package after building it.

-L | --log
    Enable logging.

-m | --nocolor
    Disable color output.

-o | --nobuild
    Only prepare the build environment without building the package.

-p | --pkg=
    Use a different PKGBUILD function to build the package.

-r | --rmdeps
    Remove dependencies after installation (if used with -i).

-s | --syncdeps
    Install missing dependencies using pacman.

-S | --source
    Only create source package.

-V | --version
    Show version and exit.

DESCRIPTION

makepkg is a command-line tool used in Arch Linux to automate the process of building installable packages from source code.

It reads a PKGBUILD file, which contains instructions and metadata about the software to be packaged, and performs the necessary steps to download the source code, verify its integrity, compile it, install it to a temporary location, create package metadata, and finally create a package archive (.pkg.tar.zst by default).

It's a fundamental tool for Arch Linux users who want to install software that's not available in the official repositories or to build custom versions of existing packages. makepkg simplifies the packaging process and ensures consistency across package builds, making it easier to install, update, and uninstall software.

CAVEATS

makepkg relies heavily on a well-formed PKGBUILD file. Errors in the PKGBUILD can lead to build failures or incorrect packages.

Root privileges are usually not required to run makepkg itself, but may be needed during the build process depending on the software being packaged.

PKGBUILD FILE

The PKGBUILD file is a shell script that defines how a package is built. It contains information such as the package name, version, dependencies, source URLs, and build instructions.

Understanding the PKGBUILD format is essential for using makepkg effectively.

PACKAGE INTEGRITY

makepkg supports various integrity checks (md5sums, sha256sums, sha512sums, etc.) to verify the authenticity and integrity of source files. It is crucial to verify the source's authenticity, especially when downloading it from untrusted sources.

HISTORY

makepkg has been a core component of Arch Linux since its early days.

It's evolved alongside the Arch Linux distribution, adapting to new technologies and package management practices.

The PKGBUILD format and makepkg's functionality have been refined over time to provide a robust and flexible package building system.

SEE ALSO

pacman(8), PKGBUILD(5)

Copied to clipboard