MAKEPKG(8)

๐Ÿ’– MAKEPKG(8) โ€” the Pacman Manual, bestie edition ๐Ÿ’–

okay so. makepkg is part of the Pacman Manual and honestly? she's the whole personality of building packages. let's get into it ๐Ÿซถ


โœจ NAME โœจ

makepkg โ€” package build utility ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

makepkg [options] [ENVVAR=value] [ENVVAR+=value] ...

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

makepkg is a script that automates the building of packages. the requirements to use her are: a build-capable *nix platform, and a custom build script for each package you wanna build (this is called a PKGBUILD). go read PKGBUILD(5) for all the deets on writing your own build scripts, iykyk.

the way that script-based builds are iconic is that the work is only done once. once you have the build script for a package, makepkg does the rest: download and validate source files, check dependencies, configure the build-time settings, build the package, install the package into a temporary root, make customizations, generate meta-info, and package the whole thing up for pacman to use. she literally does everything. main character energy fr fr โœจ

Note ๐ŸŽ€ makepkg uses your current locale by default and does not unset it when building packages. so if you wanna share your build output with others when you're asking for help, or for literally any other reason, you might wanna run "LC_ALL=C makepkg" so your logs and output aren't localized. periodt.

๐Ÿ’œ OPTIONS ๐Ÿ’œ

  • -A, --ignorearch โ€” ignore a missing or incomplete arch field in the build script. this one's for rebuilding packages from source when the PKGBUILD is maybe a little outdated and hasn't been updated with an arch=('yourarch') field. lowkey relatable.
  • -c, --clean โ€” clean up leftover work files and directories after a successful build. we love a tidy queen ๐Ÿงน
  • --config <file> โ€” use an alternate configuration file instead of the /etc/makepkg.conf default.
  • -d, --nodeps โ€” do not perform any dependency checks. this lets you override and ignore any dependencies required. but bestie, listen: there is a good chance this option will break the build process if all of the dependencies are not installed. ๐Ÿ’€
  • -e, --noextract โ€” do not extract source files or run the prepare() function (if present); just use whatever source already exists in the $srcdir/ directory. this is handy if you wanna go into $srcdir/ and manually patch or tweak code, then make a package out of the result. keep in mind that creating a patch may be a better solution to allow others to use your PKGBUILD tho ๐Ÿซถ
  • --verifysource โ€” for each source file in the source array of PKGBUILD, download the file if required and perform the integrity checks. no extraction or build is performed. dependencies specified in the PKGBUILD will not be handled unless --syncdeps is used. useful for performing subsequent offline builds.
  • -f, --force โ€” makepkg will not build a package if a built package already exists in the PKGDEST (set in makepkg.conf(5)) directory, which may default to the current directory. this option allows the built package to be overwritten. she said move over ๐Ÿ’…
  • -g, --geninteg โ€” for each source file in the source array of PKGBUILD, download the file if required and generate integrity checks. the integrity checks generated are determined by the checks present in the PKGBUILD, falling back to the value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent. this output can be redirected into your PKGBUILD for source validation using "makepkg -g >> PKGBUILD". so easy โœจ
  • --skipinteg โ€” do not perform any integrity checks (checksum and PGP) on source files.
  • --skipchecksums โ€” do not verify checksums of source files.
  • --skippgpcheck โ€” do not verify PGP signatures of source files.
  • -h, --help โ€” output syntax and command line options.
  • --holdver โ€” when using VCS sources (PKGBUILD(5)) any currently checked out source will not be updated to the latest revision. she's staying right where she is ๐Ÿ™ˆ
  • -i, --install โ€” install or upgrade the package after a successful build using pacman(8).
  • -L, --log โ€” enable logging. this will use the tee program to send the output of each of the PKGBUILD functions to both the console and to a text file in the build directory named pkgbase-pkgver-pkgrel-arch-<function>.log. as mentioned above, the logs will be localized so you may wanna set your locale accordingly if you're sharing the log output with others ๐Ÿ‘‘
  • -m, --nocolor โ€” disable color in output messages. (sad, i know, but sometimes you gotta ๐Ÿฅฒ)
  • -o, --nobuild โ€” download and extract files, run the prepare() function, but do not build them. useful with the --noextract option if you wish to tweak the files in $srcdir/ before building.
  • -p <buildscript> โ€” read the package script buildscript instead of the PKGBUILD default; see PKGBUILD(5). the buildscript must be located in the directory makepkg is called from. no wandering off, she has to be right there ๐ŸŽ€
  • -r, --rmdeps โ€” upon successful build, remove any dependencies installed by makepkg during dependency auto-resolution and installation when using -s.
  • -R, --repackage โ€” repackage contents of the package without rebuilding the package. this is useful if you forgot, for example, a dependency or install file in your PKGBUILD and the build itself will not change. been there ๐Ÿ˜ญ
  • -s, --syncdeps โ€” install missing dependencies using pacman. when build-time or run-time dependencies are not found, pacman will try to resolve them. if successful, the missing packages will be downloaded and installed. slay ๐Ÿซถ
  • -S, --source โ€” do not actually build the package, but build a source-only tarball that does not include sources that can be fetched via a download URL. this is useful for passing a single tarball to another program such as a chroot, remote builder, or a tarball upload. because integrity checks are verified, all source files of the package need to be present or downloadable.
  • -V, --version โ€” display version information.
  • -C, --cleanbuild โ€” clean build artifacts from previous runs of makepkg in the current directory by removing $srcdir before building the package. out with the old ๐Ÿงผ
  • -D <dir>, --dir <dir> โ€” change to directory <dir> before reading the PKGBUILD or doing anything else. first thing she does, no cap.
  • --allsource โ€” do not actually build the package, but build a source-only tarball that includes all sources, including those that are normally downloaded via makepkg. this is useful for passing a single tarball to another program such as a chroot or remote builder. it will also satisfy requirements of the GPL when distributing binary packages. iconic, honestly.
  • --check โ€” run the check() function in the PKGBUILD, overriding the setting in makepkg.conf(5).
  • --noarchive โ€” do not create the archive at the end of the build process. this can be useful to test the package() function or if your target distribution does not use pacman.
  • --nocheck โ€” do not run the check() function in the PKGBUILD or handle the checkdepends.
  • --noprepare โ€” do not run the prepare() function in the PKGBUILD.
  • --noverify โ€” do not run the verify() function in the PKGBUILD.
  • --sign โ€” sign the resulting package with gpg, overriding the setting in makepkg.conf(5).
  • --nosign โ€” do not create a signature for the built package.
  • --key <key> โ€” specify a key to use when signing packages, overriding the GPGKEY setting in makepkg.conf(5). if not specified in either location, the default key from the keyring will be used.
  • --noconfirm โ€” (passed to pacman) prevent pacman from waiting for user input before proceeding with operations. no thoughts, just vibes.
  • --needed โ€” (passed to pacman) tell pacman not to reinstall a target if it is already up-to-date. (used with -i / --install).
  • --asdeps โ€” (passed to pacman) install packages as non-explicitly installed (used with -i / --install).
  • --noprogressbar โ€” (passed to pacman) prevent pacman from displaying a progress bar; useful if you are redirecting makepkg output to file.
  • --packagelist โ€” list the package filenames that would be produced without building. listed package filenames include PKGDEST and PKGEXT.
  • --printsrcinfo โ€” generate and print the SRCINFO file to stdout.

๐ŸŽ€ ADDITIONAL FEATURES ๐ŸŽ€

makepkg supports building development versions of packages without having to manually update the pkgver in the PKGBUILD. this was formerly done using the separate utility versionpkg. see PKGBUILD(5) for details on how to set up a development PKGBUILD. glow up โœจ


๐ŸŒˆ REPRODUCIBILITY ๐ŸŒˆ

makepkg is designed to be compatible with Reproducible Builds. if the SOURCE_DATE_EPOCH environment variable is set, it will be exported to subprocesses, and source and package file modification times and package metadata will be unified based on the timestamp specified. consistent queen ๐Ÿ‘‘

if the SOURCE_DATE_EPOCH environment variable is not set, makepkg will use its own start date for internal use, but will not unify source file timestamps before building.


๐ŸŒˆ ENVIRONMENT VARIABLES ๐ŸŒˆ

bestie, these are the lil knobs you can twist from outside before makepkg even wakes up. they override stuff from makepkg.conf(5), so set them and go ๐Ÿ’…

  • MAKEPKG_LIBRARY="/path/to/directory" โ€” wanna use a different libmakepkg instead of the default /usr/share/makepkg? this is your girl. point it wherever โœจ
  • PACMAN โ€” the command used to check for missing dependencies and to install/remove packages. it has to support pacman's -Qq, -Rns, -S, -T, and -U operations. if it's unset or empty, makepkg just falls back to pacman. simple as ๐Ÿซถ
  • MAKEPKG_CONF="/path/to/file" โ€” use a whole different config file instead of the default /etc/makepkg.conf. iconic behavior honestly ๐ŸŽ€
  • MAKEPKG_GIT_CONFIG="/path/to/file" โ€” an alternate config file for Git instead of the default /etc/makepkg.d/gitconfig. and no cap, makepkg always stops Git from loading any other config files. it said "my config, my rules" ๐Ÿ’…
  • PKGDEST="/path/to/directory" โ€” where the finished packages go. overrides the matching value in makepkg.conf(5) ๐Ÿ“ฆ
  • SRCDEST="/path/to/directory" โ€” where downloaded sources get stored. overrides the matching value in makepkg.conf(5) ๐ŸŒธ
  • SRCPKGDEST="/path/to/directory" โ€” where source package files get stored. overrides the matching value in makepkg.conf(5) โœจ
  • LOGDEST="/path/to/directory" โ€” where generated log files land. overrides the matching value in makepkg.conf(5) ๐Ÿ“
  • PACKAGER="John Doe <john@doe.com>" โ€” the string that says who made this package. overrides the matching value in makepkg.conf(5). put your name on it, you earned it ๐Ÿ‘‘
  • BUILDDIR="/path/to/directory" โ€” where the package actually gets built. overrides the matching value in makepkg.conf(5) ๐Ÿ› ๏ธ
  • CARCH="(i686|x86_64)" โ€” force a build for one specific architecture. super useful for cross-compiling. overrides the matching value in makepkg.conf(5) ๐Ÿฆ‹
  • PKGEXT=".pkg.tar.gz", SRCEXT=".src.tar.gz" โ€” sets the compression used when making compiled packages or source packages. overrides the matching values in makepkg.conf(5) ๐Ÿ—œ๏ธ
  • GNUPGHOME="/path/to/directory" โ€” the directory where the gpg keyring used to sign the built package lives ๐Ÿ”
  • GPGKEY="keyid" โ€” pick a key to sign packages with, overriding the GPGKEY setting in makepkg.conf(5) ๐Ÿ”‘
  • SOURCE_DATE_EPOCH="<date>" โ€” used for Reproducible Builds โ™ป๏ธ
  • BUILDTOOL="<name>" โ€” the name of a tool ecosystem used to set up the build environment. it's for defining a spec for reproducible builds, like which makepkg.conf(5) was used ๐Ÿงฐ
  • BUILDTOOLVER="<version>" โ€” the version of the $BUILDTOOL being used ๐Ÿ”ข
  • MAKEPKG_LINT_PKGBUILD=0 โ€” setting this to 0 disables PKGBUILD linting inside makepkg. lowkey a lifesaver on systems with slow bash subshell operations, or on PKGBUILDs with extreme amounts of package splitting ๐Ÿ’€

๐ŸŽ€ CONFIGURATION ๐ŸŽ€

head over to makepkg.conf(5) for the full tea on configuring makepkg with the makepkg.conf file ๐Ÿซ–


๐Ÿ’€ ERRORS ๐Ÿ’€

when it exits, makepkg returns one of these codes. memorize them or keep this open in another tab, your call bestie ๐Ÿ˜ญ

  • 0 โ€” normal exit condition. we love a clean exit โœจ
  • 1 โ€” unknown cause of failure. mysterious. not in a fun way ๐Ÿ™ˆ
  • 2 โ€” error in configuration file.
  • 3 โ€” user specified an invalid option.
  • 4 โ€” error in a user-supplied function in PKGBUILD.
  • 5 โ€” failed to create a viable package.
  • 6 โ€” a source or auxiliary file specified in the PKGBUILD is missing.
  • 7 โ€” the PKGDIR is missing.
  • 8 โ€” failed to install dependencies.
  • 9 โ€” failed to remove dependencies.
  • 10 โ€” user attempted to run makepkg as root. (we do NOT do that here ๐Ÿšซ)
  • 11 โ€” user lacks permissions to build or install to a given location.
  • 12 โ€” error parsing PKGBUILD.
  • 13 โ€” a package has already been built.
  • 14 โ€” the package failed to install.
  • 15 โ€” programs necessary to run makepkg are missing.
  • 16 โ€” specified GPG key does not exist or failed to sign package.
  • 17 โ€” the local repository is not a clone of the source repository specified in PKGBUILD.

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

makepkg.conf(5), PKGBUILD(5), pacman(8)

and fr fr, check the pacman website at https://archlinux.org/pacman/ for the current info on pacman and all its related tools ๐ŸŒ


๐Ÿ› BUGS ๐Ÿ›

bugs?? bestie be serious, there are NO bugs in this software ๐Ÿ’… but if we happen to be wrong (we're not, but like, hypothetically), report them to the issue tracker at https://gitlab.archlinux.org/pacman/pacman/-/issues with the specifics โ€” your command-line, the nature of the bug, and even the package database if it helps. receipts, always ๐Ÿซถ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

current maintainers, the ones holding it down rn:

  • Allan McRae <allan@archlinux.org>
  • Andrew Gregory <andrew.gregory.8@gmail.com>
  • Morgan Adamiec <morganamilo@archlinux.org>

past major contributors, the ogs, the legends:

  • Judd Vinet <jvinet@zeroflux.org>
  • Aurelien Foret <aurelien@archlinux.org>
  • Aaron Griffin <aaron@archlinux.org>
  • Dan McGee <dan@archlinux.org>
  • Xavier Chantry <shiningxc@gmail.com>
  • Nagy Gabor <ngaba@bibl.u-szeged.hu>
  • Dave Reisner <dreisner@archlinux.org>
  • Eli Schwartz <eschwartz@archlinux.org>

wanna see everyone who ever contributed? run git shortlog -s on the pacman.git repository. shoutout to the whole group chat ๐ŸŒˆ๐Ÿ’–


and that's the page bestie!! this one's from Pacman 7.1.0, dated 2026-10-15, and it's the MAKEPKG(8) manual โ€” go build something iconic, and remember: never as root, always with love ๐Ÿซถโœจ๐ŸŽ€

๐Ÿ“ฆ where this page comes from