# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=ksmtp
pkgver=20.08.1
pkgrel=0
pkgdesc="SMTP library for KDE"
url="https://kde.org/"
arch="all"
license="LGPL-2.1+"
depends=""
makedepends="qt5-qtbase-dev cmake extra-cmake-modules kauth-dev kcodecs-dev
	kcoreaddons-dev ki18n-dev kio-dev kjobwidgets-dev kservice-dev
	solid-dev cyrus-sasl-dev"
subpackages="$pkgname-dev $pkgname-lang"
source="https://download.kde.org/stable/release-service/$pkgver/src/ksmtp-$pkgver.tar.xz
	lts.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} \
		.
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="2f1fda7840b59a889e1f73c5a84589a37ebb1edadd9255297b3979a722d1aa153b59392c4a2438d896f40b22a4936d724cfb377e932d77d5ee681897c718434e  ksmtp-20.08.1.tar.xz
eb0fc856526bba24c5fe6f98f99696c14d6249cb175787f46545f3c70adc6f98a7d031f74b1c22f564d30cce724dd4569550ff9db23869b0f7eb83b57527ef7a  lts.patch"