# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.

# The following guidelines are specific to BZR, GIT, HG and SVN packages.
# Other VCS sources are not natively supported by makepkg yet.

# Maintainer: Your Name <youremail@domain.com>
_pkgname="yggdrasil"
pkgname="${_pkgname}-git"
pkgver=0.3.1
pkgrel=1
pkgdesc="Remote data transmission and processing client"
arch=("x86_64")
url="https://github.com/RedHatInsights/yggdrasil"
license=('GPL')
groups=()
depends=()
makedepends=('bash-completion' 'git' 'go' 'meson')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
replaces=()
backup=()
options=()
install=
source=('yggdrasil::git+https://github.com/RedHatInsights/yggdrasil.git')
noextract=()
md5sums=('SKIP')

pkgrel() {
	cd "${srcdir}/${pkgname%-git}"
	printf "%s" "$(git rev-parse --short HEAD)"
}

prepare() {
	cd "${srcdir}/${pkgname%-git}"
}

build() {
	cd "${srcdir}/${pkgname%-git}"
	meson setup -Dprefix=/usr builddir
	meson compile
}

check() {
	cd "${srcdir}/${pkgname%-git}"
	meson test -C builddir
}

package() {
	cd "${srcdir}/${pkgname%-git}"
	meson install -C builddir --destdir "$pkgdir/"
}
