#!/usr/bin/make -f

export DH_OPTIONS

DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
SRC     = src
VERSION = $(shell grep LinthesiaVersionString $(SRC)/Version.h | cut -f 6 -d " " | tr -d \"\;)

%:
	dh  $@ --build-system=meson

override_dh_auto_build:
	xsltproc -o debian/linthesia.6 --param man.charmap.use.subset "0" --novalid --nonet $(DB2MAN) debian/linthesia.xml

override_dh_install:
	cp extra/linthesia.desktop debian/linthesia/usr/share/applications

build-orig-source:
	mkdir -p linthesia-$(VERSION)
	tar --exclude=debian --exclude=\*~ --exclude=.svn --exclude=\*.pyc \
		--exclude=linthesia-$(VERSION) -cf - . \
		| ( cd linthesia-$(VERSION) && tar xf - )
	tar -czf ../tarballs/linthesia_$(VERSION).orig.tar.gz linthesia-$(VERSION)
	$(RM) -r linthesia-$(VERSION)
