andersch.dev

<2023-04-10 Mon>
[ linux ]

PKGBUILD

PKGBUILD is the name of the shell script containing build information required by Arch Linux packages.

Example PKGBUILD

# Maintainer: my_name <no@domain.xyz>
# see https://wiki.archlinux.org/title/PKGBUILD
pkgname='example_project'
pkgver=r152.cca745b
pkgrel=1
pkgdesc="Testing how to use PKGBUILD"
arch=('x86_64')
url="domain.xyz"
license=('unknown')
depends=('sdl2' 'sdl2_image>=2.0.0' 'sdl2_ttf>=2.0.0' 'glibc')
makedepends=('git' 'clang' 'glu')
source=("$pkgname::git+ssh://user@127.0.0.1/path/to/example_project.git")
md5sums=('SKIP')

pkgver() {
        cd "$pkgname"
        printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
        cd "$pkgname"
        ./build.sh
}

package() {
        cd "$pkgname"
        #make DESTDIR="$pkgdir/" install
        install -Dm644 $pkgname "/usr/local/bin/"
}

Resources