# Template file for 'kio'
pkgname=kio
version=5.74.1
revision=2
build_style=cmake
configure_args="-DBUILD_TESTING=OFF
 -DDESKTOPTOJSON_EXECUTABLE=/usr/bin/desktoptojson"
hostmakedepends="kcoreaddons extra-cmake-modules kauth gettext
 qt5-host-tools qt5-qmake python kdoctools libxml2 kcoreaddons"
makedepends="kdoctools-devel ksolid-devel kbookmarks-devel kjobwidgets-devel
 kwallet-devel acl-devel mit-krb5-devel libxslt-devel libxml2-devel"
depends="desktop-file-utils"
short_desc="KDE Network transparent access to files and data"
maintainer="John <me@johnnynator.dev>"
license="LGPL-2.0-or-later"
homepage="https://invent.kde.org/frameworks/kio"
distfiles="${KDE_SITE}/frameworks/${version%.*}/${pkgname}-${version}.tar.xz"
checksum=2f88a383b751194d4f327d3f87f8ea25fe882f8cc5c58a368529d9ab7143a6e7

CXXFLAGS+=" -fpermissive"

pre_build() {
	# Commands below are taken and modified (FILESDIR) from `prepare` function of:
	# https://git.parabola.nu/abslibre.git/tree/libre/kio/PKGBUILD

	# Removing search providers
	rm -v src/urifilters/ikws/searchproviders/*.desktop

	# Adding DuckDuckGo HTML and DuckDuckGo Lite
	# Contributions of other search engines that satisfy pkgdesc are welcome!
	cp -v "${FILESDIR}"/duckduckgo_{html,lite}.desktop src/urifilters/ikws/searchproviders
}

kio-devel_package() {
	short_desc+=" - development"
	depends="${makedepends} ${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/qt5/mkspecs
		vmove usr/lib/qt5/plugins/designer
		vmove usr/lib/cmake
		vmove "usr/lib/*.so"
	}
}
