# Contributor: Luca Weiss <luca@lucaweiss.eu>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kookbook
pkgver=0.2.1
pkgrel=5
pkgdesc="Simple recipe manager taking structured markdown for recipes"
url="https://github.com/KDE/kookbook/blob/master/doc/intro.md"
arch="all !armhf"
license="MIT"
depends="$pkgname-common"
makedepends="extra-cmake-modules qt5-qtbase-dev qt5-qtdeclarative-dev discount-dev samurai"
subpackages="$pkgname-common $pkgname-touch:ktouch"
source="https://download.kde.org/unstable/kookbook/kookbook-$pkgver.tar.xz"
options="!check" # No tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

common() {
	pkgdesc="Common files for kookbook and kookbook-touch"
	mkdir -p "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/share/icons "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/share/kookbook "$subpkgdir"/usr/share/
}

ktouch() {
	depends="$pkgname-common"
	pkgdesc="Touch friendly recipe manager taking structured markdown for recipes"
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/share/applications
	mv "$pkgdir"/usr/bin/kookbooktouch "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/share/applications/kookbooktouch.desktop "$subpkgdir"/usr/share/applications/
}

sha512sums="806ee828584771b4e8fe42aeb1cae7068e887a73cd119bfde23ea9a2583b7fbbb000c4cd13e80f201c1fa8f32fc58195a13e75c1ffd5b7c943183cc6483b1c08  kookbook-0.2.1.tar.xz"
