# Template file for 'calligra'
pkgname=calligra
version=2.9.11
revision=15
build_style=cmake
configure_args="-Wno-dev -DBUILD_active=OFF -DWITH_Soprano=OFF -DBUILD_krita=OFF"
hostmakedepends="automoc4 perl pkg-config eigen3.2"
short_desc="Illustration application"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
makedepends="phonon-devel libpng-devel sqlite-devel boost-devel exiv2-devel
 qt-webkit-devel kdelibs-devel libressl-devel lcms2-devel libwpd-devel
 libwpg-devel libwps-devel libodfgen-devel libvisio-devel libetonyek-devel
 fontconfig-devel poppler-qt4-devel glew-devel fftw-devel libspnav-devel
 gsl-devel libokular-devel qca-devel kactivities-devel kdepimlibs-devel
 marble-devel libmysqlclient-devel postgresql-libs-devel freetds-devel"
license="GPL-2"
homepage="http://www.calligra-suite.org/"
distfiles="https://download.kde.org/Attic/calligra-2.9.11/calligra-2.9.11.tar.xz"
checksum=b18d2d0f87bc92753ec8b1eb780a596770a49141e3e60d811da51e752e54ea09

subpackages="calligra-filters calligra-libs calligra-plugins calligra-karbon
 calligra-kexi calligra-plan calligra-stage calligra-krita calligra-sheets
 calligra-words calligra-handbook calligra-braindump calligra-flow
 calligra-extras calligra-devtools calligra-gemini"
depends="${subpackages}"

CXXFLAGS="-D_DEFAULT_SOURCE"
nocross=yes
case "$XBPS_TARGET_MACHINE" in
	x86_64-musl) broken="not yet supported";;
esac

do_install() {
	vdoc README
}

calligra-filters_package() {
	short_desc+=" - filters"
	pkg_install() {
		cd ${wrksrc}/build/filters
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-libs_package() {
	short_desc+=" - libraries"
	pkg_install() {
		for d in interfaces libs pics servicetypes; do
			cd ${wrksrc}/build/${d}
			make DESTDIR=$PKGDESTDIR install
		done
	}
}
calligra-plugins_package() {
	short_desc+=" - plugins"
	pkg_install() {
		cd ${wrksrc}/build/plugins
		make DESTDIR=$PKGDESTDIR install
		cd ../3rdparty/kdchart
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-karbon_package() {
	short_desc+=" - Create scalable vector drawings"
	pkg_install() {
		cd ${wrksrc}/build/karbon
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-kexi_package() {
	short_desc+=" - Develop desktop db apps"
	pkg_install() {
		cd ${wrksrc}/build/kexi
		make DESTDIR=$PKGDESTDIR install
		cd ../doc/kexi
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-plan_package() {
	short_desc+=" - Project Management Component"
	depends="calligra-words-${version}_${revision}"
	pkg_install() {
		cd ${wrksrc}/build/plan
		make DESTDIR=$PKGDESTDIR install
		cd ../3rdparty/kdgantt
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-stage_package() {
	short_desc+=" - Write presentation documents"
	pkg_install() {
		cd ${wrksrc}/build/stage
		make DESTDIR=$PKGDESTDIR install
		cd ../doc/stage
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-krita_package() {
	build_style=meta
	short_desc+=" - Edit and paint images (transitional dummy package)"
	depends="krita>=${version}_${revision}"
}
calligra-sheets_package() {
	short_desc+=" - Write spreadsheet documents"
	pkg_install() {
		cd ${wrksrc}/build/sheets
		make DESTDIR=$PKGDESTDIR install
		cd ../doc/sheets
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-words_package() {
	short_desc+=" - Word Processor"
	pkg_install() {
		cd ${wrksrc}/build/words
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-handbook_package() {
	noarch=yes
	short_desc+=" - Documentation"
	pkg_install() {
		cd ${wrksrc}/build/doc/calligra
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-braindump_package() {
	short_desc+=" - Notes & idea gathering"
	pkg_install() {
		cd ${wrksrc}/build/braindump
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-flow_package() {
	depends="calligra-plugins"
	short_desc+=" - Flowchart & Diagram Editing"
	pkg_install() {
		cd ${wrksrc}/build/flow
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-extras_package() {
	short_desc+=" - Extras"
	pkg_install() {
		cd ${wrksrc}/build/extras
		make DESTDIR=$PKGDESTDIR install
		cd ../data
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-devtools_package() {
	short_desc+=" - Developer tools"
	pkg_install() {
		cd ${wrksrc}/build/devtools
		make DESTDIR=$PKGDESTDIR install
	}
}
calligra-gemini_package() {
	short_desc+=" - QML interface for Calligra Words and Stage"
	pkg_install() {
		cd ${wrksrc}/build/qtquick
		make DESTDIR=$PKGDESTDIR install
		cd ${wrksrc}/build/gemini
		make DESTDIR=$PKGDESTDIR install
	}
}
