knowledge/technology/applications/package managers/PKGBUILD.md
2023-12-04 11:02:23 +01:00

49 lines
No EOL
1.2 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
arch-wiki: https://wiki.archlinux.org/title/PKGBUILD
obj: concept
---
A `PKGBUILD` is a shell script containing the build information required by Arch Linux packages. [Arch Wiki](https://wiki.archlinux.org/title/PKGBUILD)
Packages in Arch Linux are built using the makepkg utility. When makepkg is run, it searches for a PKGBUILD file in the current directory and follows the instructions therein to either compile or otherwise acquire the files to build a package archive (pkgname.pkg.tar.zst). The resulting package contains binary files and installation instructions, readily installable with pacman.
Mandatory variables are `pkgname`, `pkgver`, `pkgrel`, and `arch`. `license` is not strictly necessary to build a package, but is recommended for any PKGBUILD shared with others, as makepkg will produce a warning if not present.
# Example
PKGBUILD:
```sh
# Maintainer: User <mail>
pkgname=NAME
pkgver=VERSION
pkgrel=1
pkgdesc="DESCRIPTION"
arch=('x86_64')
url=URL
license=("MIT")
depends=("git")
makedepends=("git")
source=("FILE_NAME::FILE_URL")
sha256sums=("SKIP")
prepare() {
}
pkver() {
}
build() {
cd "$pkgname"
make
}
check() {
}
package() {
cd "$pkgname"
install -Dm755 ./app "$pkgdir/usr/bin/app"
}
```