# Maintainer: <reg-archlinux AT klein DOT tuxli DOT ch>
# Contributor: Danila Fedotov <mail at danilafedotov dot com>
# Contributor: Gökberk Yaltıraklı <webdosusb at gmail dot com>
# Contributor: Tuur Vanhoutte <vanhouttetuur at gmail dot com>

pkgname=notes
pkgver=2.3.1
pkgrel=5
pkgdesc="Note taking application, write down your thoughts"
arch=('x86_64')
url="https://www.notes-foss.com"
license=('MPL-2.0')
depends=('hicolor-icon-theme' 'qt6-base' 'qt6-declarative' 'qt6-quick3d')
makedepends=('git' 'cmake')
source=("git+https://github.com/nuttyartist/notes.git#commit=v${pkgver}"
	'git+https://github.com/b00f/qautostart.git'
	'git+https://github.com/pbek/qmarkdowntextedit.git'
	'qt-6.10.patch')
sha256sums=('a7b0b8af30bec001b2d9fd47af6bac3751b24afeea7a136e3eb0f1ab33da8274'
            'SKIP'
            'SKIP'
            'd898e0a8bde651cc1af53684d0eba1a45c1243b81cc39a81760ae07aa7f144ad')

prepare() {
	cd "${pkgname}/"
	git rm 3rdParty/QSimpleUpdater

	git submodule init
	git submodule set-url 3rdParty/qautostart "${srcdir}/qautostart"
	git submodule set-url 3rdParty/qmarkdowntextedit "${srcdir}/qmarkdowntextedit"
	git -c protocol.file.allow=always submodule update

	patch -Np1 -i ../qt-6.10.patch
}

build() {
	cmake -B build \
		-S "${pkgname}" \
		-D CMAKE_BUILD_TYPE=Release \
		-D CMAKE_INSTALL_PREFIX=/usr \
		-D USE_QT_VERSION=6 \
		-D UPDATE_CHECKER=OFF \
		-W no-dev

	cmake --build build
}

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