# Template file for 'plume-creator'
pkgname=plume-creator
version=0.66.1
revision=2
_debianversion=0.66+dfsg1
_debianbuild=3.1build2
build_style=qmake
hostmakedepends="qt5-qmake qt5-host-tools pkg-config"
makedepends="qt5-devel qt5-declarative-devel qt5-tools-devel
 qt5-quickcontrols2-devel qt5-multimedia-devel qt5-svg-devel
 hunspell-devel libzip-devel quazip-devel"
short_desc="An open-source tool for novelists"
maintainer="VargMon <VargMon98@gmail.com>"
license="GPL-3.0-or-later"
homepage="http://plume-creator.eu/"
configure_args="plume-creator-all.pro"
distfiles="
 ${UBUNTU_SITE}/universe/p/plume-creator/${pkgname}_${_debianversion}.orig.tar.xz
 ${UBUNTU_SITE}/universe/p/plume-creator/${pkgname}_${_debianversion}-${_debianbuild}.debian.tar.bz2"
checksum="
 f88f9524184bcf60dae855d6ad37899aefa39de0edd56098e93ce3b97b679e0c
 7d473ee7283bc311c7d4dd3311d1e7726df7d45fa0123894265f355b436298e1"

if [  "$CROSS_BUILD" ]; then
	hostmakedepends+="
 qt5-multimedia-devel qt5-devel qt5-declarative-devel qt5-quickcontrols2-devel hunspell-devel
 libzip-devel quazip-devel"
fi

post_extract() {
	mv -f ${wrksrc}/../debian ${wrksrc}/
	mv -f ${wrksrc}/../resources/themes ${wrksrc}/
	mv -f ${wrksrc}/../src/pics/* ${wrksrc}/src/pics/
	patch -p1 <${wrksrc}/debian/patches/git.2014-01-09.patch
	patch -p1 <${wrksrc}/debian/patches/remove-external.patch
	patch -p1 <${wrksrc}/debian/patches/remove-SlimUpdater.patch
	patch -p1 <${wrksrc}/debian/patches/translations-es.patch
	patch -p1 <${wrksrc}/debian/patches/built-in-Qt5.patch
	sed -i 's/-lhunspell/-lhunspell-1.6/g' ${wrksrc}/plume-creator.pro
	patch -p1 <${wrksrc}/debian/patches/desktop.patch
	sed -i 's|quazip/JlCompress|quazip5/JlCompress|g' src/fileupdater.cpp src/hub.h \
		src/themes.cpp src/importuserdictdialog.cpp src/zipper/zipper.cpp \
		src/common/utils.h
}

pre_build() {
	[ -d ${wrksrc}/externals/quazip ] || ln -s -T ${XBPS_CROSS_BASE}/usr/include/quazip5 ${wrksrc}/externals/quazip
}
