# Maintainer: Yves Schumann <yves@eisfair.org>

pkgname=quassel
pkgver=0.12.4
pkgrel=3
url="http://www.quassel-irc.org/"
pkgdesc="Distributed IRC client - metapackage"
arch="all"
license="GPL"
install="quassel-core.pre-install"
depends="quassel-common"
makedepends="qt-dev cmake dbus-dev libressl-dev paxmark"
subpackages="$pkgname-common::noarch $pkgname-core $pkgname-client"
source="http://www.quassel-irc.org/pub/quassel-$pkgver.tar.bz2
       quasselcore.confd
       quasselcore.initd"

build() {
	cd "$srcdir"
	mkdir build

	cd build
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr/ \
		-DWITH_KDE=0 \
		-DCMAKE_BUILD_TYPE="Release" \
		-DWITH_OPENSSL=ON \
		-DWANT_CORE=ON \
		-DWANT_MONO=ON \
		-DWANT_QTCLIENT=ON \
		-DWITH_DBUS=OFF \
		-DWITH_OXYGEN=OFF \
		-DWITH_PHONON=OFF \
		-DWITH_WEBKIT=OFF \
		../quassel-$pkgver/ || return 1
	make
}

package() {
	cd "$srcdir"/build
	make DESTDIR="$pkgdir" install/fast || return 1
	paxmark -m "$pkgdir"/usr/bin/quasselcore || return 1
}

common() {
	pkgdesc="Quassel common/shared files"
	depends=
	mkdir -p "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/share/icons \
		"$subpkgdir"/usr/share
}

core() {
	pkgdesc="Core component of distributed IRC client"
	depends="$pkgname-common"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/quasselcore "$subpkgdir"/usr/bin/ || return 1
	install -Dm0644 "$srcdir"/quasselcore.confd \
		"$subpkgdir"/etc/conf.d/quasselcore || return 1
	install -Dm0755 ${srcdir}/quasselcore.initd \
		"$subpkgdir"/etc/init.d/quasselcore || return 1
}

client() {
	pkgdesc="Quassel client"
	depends="$pkgname-common"
	mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/bin/quasselclient "$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/share/pixmaps \
		"$pkgdir"/usr/share/applications \
		"$subpkgdir"/usr/share/
}
md5sums="56abcde46decc5e341888a05189cece3  quassel-0.12.4.tar.bz2
b196216514a44fd596a664a53e05d93e  quasselcore.confd
4829d210877966aebc5893fbdefead14  quasselcore.initd"
sha256sums="93e4e54cb3743cbe2e5684c2fcba94fd2bc2cd739f7672dee14341b49c29444d  quassel-0.12.4.tar.bz2
16cfaf919268ee3c3281fc4ad0dfc128b1c98f5edfc5cc522addd512f36d293c  quasselcore.confd
942c41b3159728bbcf759d0e57bf20cf383ceb99455077bece8c1ae86bfb999c  quasselcore.initd"
sha512sums="66bc12a9634534e6492787172a199c774ef1642d1ddb268c24ed96608698628bca7b278021a006a4db76783b19b1e1dead9d019bb8a6cbe1e12b8857792e7b92  quassel-0.12.4.tar.bz2
e03df342f47945f948106883a7757262ab7a8a7d21f0b4dd01cfcc95e836c2e00f2e0177a353b4f7a4b6f80ffa970be06d49aa9a42cad1f3834382267e5a0d7f  quasselcore.confd
a7181ea28d821e39c005aaaaeed821f815371f76c2e98bd5935013bb9a0ba0ab6fce9c202bab6be3eaa7895773150fc5832ea3ce9050dbea73d6db514f51da6a  quasselcore.initd"
