makepkg Command Examples in Linux

“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.
Note: When using makepkg, it is important to verify the authenticity of the source code and PKGBUILD file, as malicious code could be included that could compromise the system.

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
Related Post