Skip to content
Marco edited this page Feb 16, 2026 · 3 revisions

Syntax reference for writing PKGBUILDs. See The PKGBUILD for an introduction to the format.

Strings

pkgname="mypackage"
pkgdesc=`string with "quotes" inside`

Variable Expansion

url="https://github.com/user/${pkgname}"

Arrays

# Single element
arch=('x86_64')

# Multiple elements
depends=(
  'libfoo'
  'libbar'
)

Functions

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
}

Directives

Append __<directive> to any variable or array to make it target-specific:

pkgdesc="Default description"
pkgdesc__ubuntu="Ubuntu-specific description"

makedepends=(
  'gcc'
)
makedepends__apt=(
  'build-essential'
)

See Directives for the full list.

Clone this wiki locally