# Maintainer: Kimiblock Moe

pkgname=snotify-git
pkgver=1.1.1.r2.g4caa594
pkgrel=1
epoch=1
pkgdesc="Play sounds when receiving a notification."
arch=("any")
url="https://github.com/Kimiblock/snotify"
license=("GPL-2.0-or-later")
depends=("dbus" "glibc" libpulse coreutils)
optdepends=(
	"glib2: Do not disturb support for GNOME"
)
makedepends=('go' 'git')
backup=()
source=("git+https://github.com/Kimiblock/snotify.git")
sha256sums=('SKIP')

pkgver() {
	cd snotify
	git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//'
}

function prepare() {
	cd "${srcdir}/snotify"
}

function build() {
	cd "${srcdir}/snotify"
	go build -trimpath -buildmode=pie -mod=readonly -modcacherw -ldflags "-linkmode external -extldflags \"${LDFLAGS}\""
}

function check() {
	cd "${srcdir}/snotify"
	go test ./...
}

function package() {
	install -Dm755 "${srcdir}/snotify/snotify" "${pkgdir}/usr/bin/snotify"
	install -Dm644 "${srcdir}/snotify/snotify.service" "${pkgdir}/usr/lib/systemd/user/snotify.service"
	install -Dm644 "${srcdir}/snotify/message.ogg" "${pkgdir}/opt/snotify/message.ogg"
}
