# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5
inherit cmake-utils eutils

DESCRIPTION="Featureful personal font manager"
HOMEPAGE="http://www.fontmatrix.be/"

MY_PV="${PV/_p/+svn}"
SRC_URI="mirror://debian/pool/main/f/${PN}/${PN}_${MY_PV}.orig.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"

# Fontmatrix includes the harfbuzz source code itself, so no IUSE for it.
# For the same reason, harfbuzz is not listed in *DEPEND.
IUSE="debug +icu -m17n pdf +python"

DEPEND="
	>=dev-util/cmake-2.6.0
	>=media-libs/freetype-2.3.5

	>=dev-qt/qtcore-4.4.0:4
	>=dev-qt/qtopengl-4.4.0:4
	>=dev-qt/qtsql-4.4.0:4[sqlite]
	>=dev-qt/qtsvg-4.4.0:4
	>=dev-qt/qtwebkit-4.4.0:4
	>=dev-qt/qtxmlpatterns-4.4.0:4

	icu? ( >=dev-libs/icu-3.8 )
	m17n? ( dev-libs/m17n-lib )
	pdf? ( app-text/podofo )
	python? ( dev-lang/python:2.7 )
"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${PN}-${MY_PV}"
DOCS=( "${S}"/{help/README,TODO} )

src_prepare() {
	epatch "${FILESDIR}"/"${P}"-qreal.diff
}

src_configure() {
	use debug && CMAKE_BUILD_TYPE=Debug
	local mycmakeargs=(
		-DWANT_HARFBUZZ=ON
		$(cmake-utils_use_want icu ICU)
		$(cmake-utils_use_want m17n M17N)
		$(cmake-utils_use_want python PYTHONQT)
		$(cmake-utils_use_want pdf PODOFO)
	)
	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile
}

src_install() {
	cmake-utils_src_install
	doicon "${PN}".png
	domenu "${PN}".desktop
	doman "${PN}".1
}